Skip to content

Commit

Permalink
remove confusing mention of Android Auto from "Connected devices" screen
Browse files Browse the repository at this point in the history
  • Loading branch information
muhomorr authored and thestinger committed Jan 4, 2024
1 parent c39e7ea commit 5d3d0cc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class AdvancedConnectedDeviceController extends BasePreferenceController

private static final String DRIVING_MODE_SETTINGS_ENABLED =
"gearhead:driving_mode_settings_enabled";
private static final String GEARHEAD_PACKAGE = "com.google.android.projection.gearhead";

public AdvancedConnectedDeviceController(Context context, String preferenceKey) {
super(context, preferenceKey);
Expand All @@ -59,7 +58,7 @@ public static int getConnectedDevicesSummaryResourceId(Context context) {
new NfcPreferenceController(context, NfcPreferenceController.KEY_TOGGLE_NFC);

return getConnectedDevicesSummaryResourceId(nfcPreferenceController,
isDrivingModeAvailable(context), isAndroidAutoSettingAvailable(context));
isDrivingModeAvailable(context), false);
}

@VisibleForTesting
Expand All @@ -68,13 +67,6 @@ static boolean isDrivingModeAvailable(Context context) {
getInt(context.getContentResolver(), DRIVING_MODE_SETTINGS_ENABLED, 0) == 1;
}

@VisibleForTesting
static boolean isAndroidAutoSettingAvailable(Context context) {
final Intent intent = new Intent(IA_SETTINGS_ACTION);
intent.setPackage(GEARHEAD_PACKAGE);
return intent.resolveActivity(context.getPackageManager()) != null;
}

@VisibleForTesting
static int getConnectedDevicesSummaryResourceId(NfcPreferenceController
nfcPreferenceController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,6 @@ public void isDrivingModeAvailable_returnFalse() {
AdvancedConnectedDeviceController.isDrivingModeAvailable(mContext)).isFalse();
}

@Test
public void isAndroidAutoSettingAvailable_returnTrue() {
final ApplicationInfo appInfo =
ApplicationInfoBuilder.newBuilder().setPackageName(ANDROID_AUTO_PACKAGE).build();
final ActivityInfo activityInfo = new ActivityInfo();
activityInfo.packageName = ANDROID_AUTO_PACKAGE;
activityInfo.name = ANDROID_AUTO_PACKAGE;
activityInfo.applicationInfo = appInfo;
final ResolveInfo resolveInfo = new ResolveInfo();
resolveInfo.activityInfo = activityInfo;
mShadowPackageManager.addResolveInfoForIntent(
buildAndroidAutoSettingsIntent(),
resolveInfo);

assertThat(
AdvancedConnectedDeviceController.isAndroidAutoSettingAvailable(mContext)).isTrue();
}

@Test
public void isAndroidAutoSettingAvailable_returnFalse() {
// No ResolveInfo for Android Auto, expect false.
assertThat(
AdvancedConnectedDeviceController.isAndroidAutoSettingAvailable(mContext)).isFalse();
}

@Test
public void getConnectedDevicesSummaryResourceId_NFCAndDrivingModeAvailable() {
// NFC available, driving mode available
Expand Down

0 comments on commit 5d3d0cc

Please sign in to comment.