From 077dd9b07f7cb6835f1717ea2f2700f2d13b37bb Mon Sep 17 00:00:00 2001 From: Mill Chen Date: Wed, 26 Feb 2020 18:41:56 +0800 Subject: [PATCH 1/2] RESTRICT AUTOMERGE Allow LockScreenPattern to be launched in the pinning screen If work profile lock is enabled and work app is pinned, users will get a black/white screen on the phone. That's because Settings is prevented from other apps launch any pages of Settings in the pinning mode. In order to launch some pages of Settings from other apps, we add a condition to the preventive mechanism and allow the activity inherited from SettingsBaseActivity to override the condition to have the activity to be launched from other apps in the pinning mode. Bug: 137015265 Bug: 135604684 Test: manual test Change-Id: I8070de79a83350d1658efcb19e983669dad0e673 --- src/com/android/settings/core/SettingsBaseActivity.java | 9 ++++++++- .../password/ConfirmDeviceCredentialBaseActivity.java | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/core/SettingsBaseActivity.java b/src/com/android/settings/core/SettingsBaseActivity.java index 6e37b161924..993c9b03545 100644 --- a/src/com/android/settings/core/SettingsBaseActivity.java +++ b/src/com/android/settings/core/SettingsBaseActivity.java @@ -63,7 +63,7 @@ public class SettingsBaseActivity extends FragmentActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (isLockTaskModePinned() && !isSettingsRunOnTop()) { + if (isLockTaskModePinned() && !isSettingsRunOnTop() && !isLaunchableInTaskModePinned()) { Log.w(TAG, "Devices lock task mode pinned."); finish(); } @@ -147,6 +147,13 @@ public class SettingsBaseActivity extends FragmentActivity { ((ViewGroup) findViewById(R.id.content_frame)).addView(view, params); } + /** + * @return whether or not the activity can be launched from other apps in the pinning screen. + */ + public boolean isLaunchableInTaskModePinned() { + return false; + } + private void onCategoriesChanged() { final int N = mCategoryListeners.size(); for (int i = 0; i < N; i++) { diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java index 998b3fcdd18..2540b1a4f28 100644 --- a/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java +++ b/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java @@ -184,6 +184,11 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi } } + @Override + public boolean isLaunchableInTaskModePinned() { + return true; + } + public void prepareEnterAnimation() { getFragment().prepareEnterAnimation(); } From 36f182159ffae1f14a1733a3bb1334cdd9d44742 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Tue, 10 Mar 2020 15:52:05 -0700 Subject: [PATCH 2/2] DO NOT MERGE - Track framework changes to crashApplication Bug: 128649910 Test: manual Test: atest OsHostTests#testForegroundServiceBadNotification Merged-In: Ia613372360f8b32f6ad3b7d2092e7cb27f067fbc Change-Id: I6894e3df309669ba98ad23432aa18d6043739aad --- src/com/android/settings/password/PasswordUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/password/PasswordUtils.java b/src/com/android/settings/password/PasswordUtils.java index 1ead492788c..5b75033f0f2 100644 --- a/src/com/android/settings/password/PasswordUtils.java +++ b/src/com/android/settings/password/PasswordUtils.java @@ -89,7 +89,8 @@ public final class PasswordUtils extends com.android.settingslib.Utils { /* initialPid= */ -1, getCallingAppPackageName(activityToken), userId, - message); + message, + false); } catch (RemoteException e) { Log.v(TAG, "Could not talk to activity manager.", e); }