Loading src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java +3 −9 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.content.IntentFilter; import android.content.om.OverlayInfo; import android.content.om.OverlayManager; import android.content.pm.ApplicationInfo; import android.content.pm.Flags; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; Loading Loading @@ -462,14 +461,9 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp // there is more than one candidate enabled = (mHomePackages.size() > 1); } else if (mPackageInfo.packageName.equals(currentDefaultHome.getPackageName())) { if (Flags.improveHomeAppBehavior()) { // Allow uninstallation of current home app if it is a non-system app // and/or there are other candidate apps available. if (mPackageInfo.applicationInfo.isSystemApp() || mHomePackages.size() == 1) { enabled = false; } } else { if (mPackageInfo.applicationInfo.isSystemApp() || mHomePackages.size() == 1) { enabled = false; } } Loading src/com/android/settings/spa/app/appinfo/AppButtonRepository.kt +2 −8 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.content.ComponentName import android.content.Context import android.content.om.OverlayManager import android.content.pm.ApplicationInfo import android.content.pm.Flags import android.content.pm.PackageManager import android.content.pm.ResolveInfo import android.util.Log Loading Loading @@ -124,13 +123,8 @@ class AppButtonRepository(private val context: Context) { homePackageInfo.homePackages.size == 1 -> true packageName == homePackageInfo.currentDefaultHome?.packageName -> { if (Flags.improveHomeAppBehavior()) { // Disallow the uninstallation of the current home app if it is a system app. return applicationInfo.isSystemApp() } else { // Disallow if this is the explicit default home app. return true } } else -> false Loading tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java +0 −4 Original line number Diff line number Diff line Loading @@ -45,13 +45,11 @@ import android.content.Intent; import android.content.om.OverlayInfo; import android.content.om.OverlayManager; import android.content.pm.ApplicationInfo; import android.content.pm.Flags; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.RemoteException; import android.os.UserManager; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.SetFlagsRule; import android.util.ArraySet; import android.view.View; Loading Loading @@ -360,7 +358,6 @@ public class AppButtonsPreferenceControllerTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) public void updateUninstallButton_isNotSystemAndIsCurrentHomeAndHasOneHome_setButtonDisable() { doReturn(false).when(mController).isSystemPackage(any(), any(), any()); doReturn(new ComponentName(PACKAGE_NAME, "cls")).when(mPackageManager).getHomeActivities( Loading @@ -374,7 +371,6 @@ public class AppButtonsPreferenceControllerTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) public void updateUninstallButton_isNotSystemAndIsCurrentHomeAndHasOtherHome_setButtonEnable() { doReturn(false).when(mController).isSystemPackage(any(), any(), any()); doReturn(new ComponentName(PACKAGE_NAME, "cls")).when(mPackageManager).getHomeActivities( Loading tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppButtonRepositoryTest.kt +0 −5 Original line number Diff line number Diff line Loading @@ -21,10 +21,8 @@ import android.content.ComponentName import android.content.Context import android.content.pm.ActivityInfo import android.content.pm.ApplicationInfo import android.content.pm.Flags import android.content.pm.PackageManager import android.content.pm.ResolveInfo import android.platform.test.annotations.RequiresFlagsEnabled import androidx.core.os.bundleOf import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 Loading Loading @@ -130,7 +128,6 @@ class AppButtonRepositoryTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) fun uninstallDisallowedDueToHomeApp_isNotSystemAndIsCurrentHomeAndHasOnlyOneHomeApp() { val app = ApplicationInfo().apply { packageName = PACKAGE_NAME Loading @@ -147,7 +144,6 @@ class AppButtonRepositoryTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) fun uninstallDisallowedDueToHomeApp_isNotSystemAndIsCurrentHomeAndHasOtherHomeApps() { val app = ApplicationInfo().apply { packageName = PACKAGE_NAME Loading @@ -164,7 +160,6 @@ class AppButtonRepositoryTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) fun uninstallDisallowedDueToHomeApp_isSystemAndIsCurrentHomeAndHasOtherHomeApps() { val app = ApplicationInfo().apply { packageName = PACKAGE_NAME Loading Loading
src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java +3 −9 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.content.IntentFilter; import android.content.om.OverlayInfo; import android.content.om.OverlayManager; import android.content.pm.ApplicationInfo; import android.content.pm.Flags; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; Loading Loading @@ -462,14 +461,9 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp // there is more than one candidate enabled = (mHomePackages.size() > 1); } else if (mPackageInfo.packageName.equals(currentDefaultHome.getPackageName())) { if (Flags.improveHomeAppBehavior()) { // Allow uninstallation of current home app if it is a non-system app // and/or there are other candidate apps available. if (mPackageInfo.applicationInfo.isSystemApp() || mHomePackages.size() == 1) { enabled = false; } } else { if (mPackageInfo.applicationInfo.isSystemApp() || mHomePackages.size() == 1) { enabled = false; } } Loading
src/com/android/settings/spa/app/appinfo/AppButtonRepository.kt +2 −8 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.content.ComponentName import android.content.Context import android.content.om.OverlayManager import android.content.pm.ApplicationInfo import android.content.pm.Flags import android.content.pm.PackageManager import android.content.pm.ResolveInfo import android.util.Log Loading Loading @@ -124,13 +123,8 @@ class AppButtonRepository(private val context: Context) { homePackageInfo.homePackages.size == 1 -> true packageName == homePackageInfo.currentDefaultHome?.packageName -> { if (Flags.improveHomeAppBehavior()) { // Disallow the uninstallation of the current home app if it is a system app. return applicationInfo.isSystemApp() } else { // Disallow if this is the explicit default home app. return true } } else -> false Loading
tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java +0 −4 Original line number Diff line number Diff line Loading @@ -45,13 +45,11 @@ import android.content.Intent; import android.content.om.OverlayInfo; import android.content.om.OverlayManager; import android.content.pm.ApplicationInfo; import android.content.pm.Flags; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.RemoteException; import android.os.UserManager; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.SetFlagsRule; import android.util.ArraySet; import android.view.View; Loading Loading @@ -360,7 +358,6 @@ public class AppButtonsPreferenceControllerTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) public void updateUninstallButton_isNotSystemAndIsCurrentHomeAndHasOneHome_setButtonDisable() { doReturn(false).when(mController).isSystemPackage(any(), any(), any()); doReturn(new ComponentName(PACKAGE_NAME, "cls")).when(mPackageManager).getHomeActivities( Loading @@ -374,7 +371,6 @@ public class AppButtonsPreferenceControllerTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) public void updateUninstallButton_isNotSystemAndIsCurrentHomeAndHasOtherHome_setButtonEnable() { doReturn(false).when(mController).isSystemPackage(any(), any(), any()); doReturn(new ComponentName(PACKAGE_NAME, "cls")).when(mPackageManager).getHomeActivities( Loading
tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppButtonRepositoryTest.kt +0 −5 Original line number Diff line number Diff line Loading @@ -21,10 +21,8 @@ import android.content.ComponentName import android.content.Context import android.content.pm.ActivityInfo import android.content.pm.ApplicationInfo import android.content.pm.Flags import android.content.pm.PackageManager import android.content.pm.ResolveInfo import android.platform.test.annotations.RequiresFlagsEnabled import androidx.core.os.bundleOf import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 Loading Loading @@ -130,7 +128,6 @@ class AppButtonRepositoryTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) fun uninstallDisallowedDueToHomeApp_isNotSystemAndIsCurrentHomeAndHasOnlyOneHomeApp() { val app = ApplicationInfo().apply { packageName = PACKAGE_NAME Loading @@ -147,7 +144,6 @@ class AppButtonRepositoryTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) fun uninstallDisallowedDueToHomeApp_isNotSystemAndIsCurrentHomeAndHasOtherHomeApps() { val app = ApplicationInfo().apply { packageName = PACKAGE_NAME Loading @@ -164,7 +160,6 @@ class AppButtonRepositoryTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_IMPROVE_HOME_APP_BEHAVIOR) fun uninstallDisallowedDueToHomeApp_isSystemAndIsCurrentHomeAndHasOtherHomeApps() { val app = ApplicationInfo().apply { packageName = PACKAGE_NAME Loading