From f872495d519430a1903f7e4a5537e4f7842c1d94 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Tue, 30 Apr 2019 21:51:47 +0000 Subject: [PATCH] Revert "Add useSystemProvidedLauncherForSecondary config" This reverts commit 4626518fcd65b8b0698e45c1faca4d3e77d0cef3. Reason for revert: Broke RootActivityContainerTests.testStartHomeOnAllDisplays Bug: 131112301 Change-Id: I87b574ff4d289d159aeea4312dc0ad0c64b414ac --- core/res/res/values/config.xml | 4 -- core/res/res/values/symbols.xml | 1 - .../server/wm/ActivityTaskManagerService.java | 6 +- .../server/wm/RootActivityContainerTests.java | 67 ------------------- 4 files changed, 2 insertions(+), 76 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 6416c10713f6f..21a8f4c7ff89d 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3862,10 +3862,6 @@ {@see android.view.Display#FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS} --> com.android.launcher3/com.android.launcher3.SecondaryDisplayLauncher - - false - true diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 9b918ecc32043..186b84ceb2557 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3673,7 +3673,6 @@ - diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 0ae1ff503094f..ee6cf541547b0 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -5798,10 +5798,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { */ Intent getSecondaryHomeIntent(String preferredPackage) { final Intent intent = new Intent(mTopAction, mTopData != null ? Uri.parse(mTopData) : null); - final boolean useSystemProvidedLauncher = mContext.getResources().getBoolean( - com.android.internal.R.bool.config_useSystemProvidedLauncherForSecondary); - if (preferredPackage == null || useSystemProvidedLauncher) { - // Using the component stored in config if no package name or forced. + if (preferredPackage == null) { + // Using the component stored in config if no package name. final String secondaryHomeComponent = mContext.getResources().getString( com.android.internal.R.string.config_secondaryHomeComponent); intent.setComponent(ComponentName.unflattenFromString(secondaryHomeComponent)); diff --git a/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java index f6c57b0ef2a13..94def2bb78465 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java @@ -31,7 +31,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; import static com.android.dx.mockito.inline.extended.ExtendedMockito.reset; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy; -import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.times; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.server.wm.ActivityDisplay.POSITION_TOP; @@ -56,7 +55,6 @@ import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.ResolveInfo; -import android.content.res.Resources; import android.graphics.Rect; import android.platform.test.annotations.Presubmit; import android.util.Pair; @@ -496,71 +494,6 @@ public class RootActivityContainerTests extends ActivityTestsBase { assertEquals(comp.getClassName(), resolvedInfo.first.name); } - /** - * Tests that the default secondary home activity is always picked when it is in forced by - * config_useSystemProvidedLauncherForSecondary. - */ - @Test - public void testResolveSecondaryHomeActivityForced() { - Resources resources = mContext.getResources(); - spyOn(resources); - final String defaultSecondaryHome = - "com.android.test/com.android.test.TestDefaultSecondaryHome"; - final ComponentName secondaryComp = ComponentName.unflattenFromString(defaultSecondaryHome); - doReturn(defaultSecondaryHome).when(resources).getString( - com.android.internal.R.string.config_secondaryHomeComponent); - doReturn(true).when(resources).getBoolean( - com.android.internal.R.bool.config_useSystemProvidedLauncherForSecondary); - - final Intent secondaryHomeIntent = mService.getSecondaryHomeIntent(null); - assertEquals(secondaryComp, secondaryHomeIntent.getComponent()); - - final ActivityInfo aInfoSecondary = new ActivityInfo(); - aInfoSecondary.name = secondaryComp.getClassName(); - aInfoSecondary.applicationInfo = new ApplicationInfo(); - aInfoSecondary.applicationInfo.packageName = secondaryComp.getPackageName(); - doReturn(aInfoSecondary).when(mRootActivityContainer).resolveHomeActivity(anyInt(), - refEq(secondaryHomeIntent)); - - final Intent homeIntent = mService.getHomeIntent(); - final ActivityInfo aInfoDefault = new ActivityInfo(); - aInfoDefault.name = "fakeHomeActivity"; - aInfoDefault.applicationInfo = new ApplicationInfo(); - aInfoDefault.applicationInfo.packageName = "fakeHomePackage"; - doReturn(aInfoDefault).when(mRootActivityContainer).resolveHomeActivity(anyInt(), - refEq(homeIntent)); - - // Let resolveActivities call to validate both main launcher and second launcher so that - // resolveActivities call does not work as enabler for secondary. - final List resolutions1 = new ArrayList<>(); - final ResolveInfo resolveInfo1 = new ResolveInfo(); - resolveInfo1.activityInfo = new ActivityInfo(); - resolveInfo1.activityInfo.name = aInfoDefault.name; - resolveInfo1.activityInfo.applicationInfo = aInfoDefault.applicationInfo; - resolutions1.add(resolveInfo1); - doReturn(resolutions1).when(mRootActivityContainer).resolveActivities(anyInt(), - refEq(homeIntent)); - final List resolutions2 = new ArrayList<>(); - final ResolveInfo resolveInfo2 = new ResolveInfo(); - resolveInfo2.activityInfo = new ActivityInfo(); - resolveInfo2.activityInfo.name = aInfoSecondary.name; - resolveInfo2.activityInfo.applicationInfo = aInfoSecondary.applicationInfo; - resolutions2.add(resolveInfo2); - doReturn(resolutions2).when(mRootActivityContainer).resolveActivities(anyInt(), - refEq(secondaryHomeIntent)); - - doReturn(true).when(mRootActivityContainer).canStartHomeOnDisplay( - any(), anyInt(), anyBoolean()); - - final Pair resolvedInfo = mRootActivityContainer - .resolveSecondaryHomeActivity(0 /* userId */, 1 /* displayId */); - - assertEquals(secondaryComp.getClassName(), resolvedInfo.first.name); - assertEquals(secondaryComp.getPackageName(), - resolvedInfo.first.applicationInfo.packageName); - assertEquals(aInfoSecondary.name, resolvedInfo.first.name); - } - /** * Tests that secondary home should be selected if default home not support secondary displays * or there is no matched activity in the same package as selected default home.