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
This commit is contained in:
Mill Chen
2020-02-26 18:41:56 +08:00
parent 3c6a3011fa
commit 101c9be6c1
2 changed files with 13 additions and 1 deletions

View File

@@ -255,7 +255,7 @@ public class SettingsActivity extends SettingsDrawerActivity
protected void onCreate(Bundle savedState) { protected void onCreate(Bundle savedState) {
super.onCreate(savedState); super.onCreate(savedState);
if (isLockTaskModePinned() && !isSettingsRunOnTop()) { if (isLockTaskModePinned() && !isSettingsRunOnTop() && !isLaunchableInTaskModePinned()) {
Log.w(LOG_TAG, "Devices lock task mode pinned."); Log.w(LOG_TAG, "Devices lock task mode pinned.");
finish(); finish();
} }
@@ -964,6 +964,13 @@ public class SettingsActivity extends SettingsDrawerActivity
startActivity(intent); 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() { private boolean isLockTaskModePinned() {
final ActivityManager activityManager = final ActivityManager activityManager =
getApplicationContext().getSystemService(ActivityManager.class); getApplicationContext().getSystemService(ActivityManager.class);

View File

@@ -134,6 +134,11 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi
} }
} }
@Override
public boolean isLaunchableInTaskModePinned() {
return true;
}
public void prepareEnterAnimation() { public void prepareEnterAnimation() {
getFragment().prepareEnterAnimation(); getFragment().prepareEnterAnimation();
} }