From 8d47205577cb1f37c8db2b7a27cd71190e20a6a1 Mon Sep 17 00:00:00 2001 From: Mill Chen Date: Wed, 26 Feb 2020 18:41:56 +0800 Subject: [PATCH 1/3] 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 Merged-In: I8070de79a83350d1658efcb19e983669dad0e673 --- src/com/android/settings/SettingsActivity.java | 9 ++++++++- .../password/ConfirmDeviceCredentialBaseActivity.java | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index 3bfafbb19ae..00cf069ace6 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -235,7 +235,7 @@ public class SettingsActivity extends SettingsDrawerActivity super.onCreate(savedState); Log.d(LOG_TAG, "Starting onCreate"); - if (isLockTaskModePinned() && !isSettingsRunOnTop()) { + if (isLockTaskModePinned() && !isSettingsRunOnTop() && !isLaunchableInTaskModePinned()) { Log.w(LOG_TAG, "Devices lock task mode pinned."); finish(); } @@ -804,6 +804,13 @@ public class SettingsActivity extends SettingsDrawerActivity return mNextButton; } + /** + * @return whether or not the activity can be launched from other apps in the pinning screen. + */ + public boolean isLaunchableInTaskModePinned() { + return false; + } + @VisibleForTesting Bitmap getBitmapFromXmlResource(int drawableRes) { Drawable drawable = getResources().getDrawable(drawableRes, getTheme()); diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java index 1775394a944..2290fc0558d 100644 --- a/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java +++ b/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java @@ -139,6 +139,11 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi } } + @Override + public boolean isLaunchableInTaskModePinned() { + return true; + } + public void prepareEnterAnimation() { getFragment().prepareEnterAnimation(); } From 101c9be6c1f7f89cb1b8a788b8e6e62358684d94 Mon Sep 17 00:00:00 2001 From: Mill Chen Date: Wed, 26 Feb 2020 18:41:56 +0800 Subject: [PATCH 2/3] 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 Merged-In: I8070de79a83350d1658efcb19e983669dad0e673 --- src/com/android/settings/SettingsActivity.java | 9 ++++++++- .../password/ConfirmDeviceCredentialBaseActivity.java | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index c0ffc19df52..11654ae6700 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -255,7 +255,7 @@ public class SettingsActivity extends SettingsDrawerActivity protected void onCreate(Bundle savedState) { super.onCreate(savedState); - if (isLockTaskModePinned() && !isSettingsRunOnTop()) { + if (isLockTaskModePinned() && !isSettingsRunOnTop() && !isLaunchableInTaskModePinned()) { Log.w(LOG_TAG, "Devices lock task mode pinned."); finish(); } @@ -964,6 +964,13 @@ public class SettingsActivity extends SettingsDrawerActivity startActivity(intent); } + /** + * @return whether or not the activity can be launched from other apps in the pinning screen. + */ + public boolean isLaunchableInTaskModePinned() { + return false; + } + private boolean isLockTaskModePinned() { final ActivityManager activityManager = getApplicationContext().getSystemService(ActivityManager.class); diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java index d2bd934b7c1..6d48a953a7e 100644 --- a/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java +++ b/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java @@ -134,6 +134,11 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi } } + @Override + public boolean isLaunchableInTaskModePinned() { + return true; + } + public void prepareEnterAnimation() { getFragment().prepareEnterAnimation(); } From 37295f86bf0c8cce688399db4875e88f8df974ca Mon Sep 17 00:00:00 2001 From: Kenny Guy Date: Wed, 22 Jan 2020 18:27:08 +0000 Subject: [PATCH 3/3] DO NOT MERGE Update battery manager toggle to support on / off summary. Screenshots attached to the bug. Bug: 148847755 Test: Visual - on blueline aosp build / boot / check settings pages Test: Visual - on blueline eng build / boot / check settings pages Change-Id: I44b1c74baf4bafa549519d4f20fa470389cd5e0b (cherry picked from commit 1a289bdeba3f762e5e93f059018246b0e8d81deb) --- res/values/strings.xml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index f8f696f91e8..deea388506e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5558,13 +5558,9 @@ Manage apps automatically - Limit battery for apps that you don\u2019t use often + Limit battery for apps that you don\u2019t use often - When Battery Manager detects that apps are draining battery, you\u2019ll have the option to restrict these apps. Restricted apps may not work properly and notifications may be delayed. - - When Battery Manager detects that apps are draining battery, you\u2019ll have the option to restrict these apps. Restricted apps may not work properly and notifications may be delayed. - - When Battery Manager detects that apps are draining battery, you\u2019ll have the option to restrict these apps. Restricted apps may not work properly and notifications may be delayed. + When Battery Manager detects that apps are draining battery, you\u2019ll have the option to restrict these apps. Restricted apps may not work properly and notifications may be delayed. Restricted apps @@ -5585,7 +5581,8 @@ Detect when apps drain battery - On / Detecting when apps drain battery + On / Detecting when apps drain battery + Off