Merge "Disallow direct-boot aware activities to bypass work lock" into oc-dev
am: 9f074e2224
Change-Id: Ie57c07ed9caee3ee66847cbedc4b10b79bcd9abe
This commit is contained in:
@@ -576,17 +576,6 @@ interface IActivityManager {
|
|||||||
* @param hasTopUi Whether the calling process has "top-level" UI.
|
* @param hasTopUi Whether the calling process has "top-level" UI.
|
||||||
*/
|
*/
|
||||||
void setHasTopUi(boolean hasTopUi);
|
void setHasTopUi(boolean hasTopUi);
|
||||||
/**
|
|
||||||
* Returns if the target of the PendingIntent can be fired directly, without triggering
|
|
||||||
* a work profile challenge. This can happen if the PendingIntent is to start direct-boot
|
|
||||||
* aware activities, and the target user is in RUNNING_LOCKED state, i.e. we should allow
|
|
||||||
* direct-boot aware activity to bypass work challenge when the user hasn't unlocked yet.
|
|
||||||
* @param intent the {@link PendingIntent} to be tested.
|
|
||||||
* @return {@code true} if the intent should not trigger a work challenge, {@code false}
|
|
||||||
* otherwise.
|
|
||||||
* @throws RemoteException
|
|
||||||
*/
|
|
||||||
boolean canBypassWorkChallenge(in PendingIntent intent);
|
|
||||||
|
|
||||||
// Start of O transactions
|
// Start of O transactions
|
||||||
void requestActivityRelaunch(in IBinder token);
|
void requestActivityRelaunch(in IBinder token);
|
||||||
|
|||||||
@@ -6369,17 +6369,10 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
.getIdentifier();
|
.getIdentifier();
|
||||||
if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)
|
if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)
|
||||||
&& mKeyguardManager.isDeviceLocked(userId)) {
|
&& mKeyguardManager.isDeviceLocked(userId)) {
|
||||||
boolean canBypass = false;
|
// TODO(b/28935539): should allow certain activities to
|
||||||
try {
|
// bypass work challenge
|
||||||
canBypass = ActivityManager.getService()
|
if (startWorkChallengeIfNecessary(userId,
|
||||||
.canBypassWorkChallenge(intent);
|
intent.getIntentSender(), notificationKey)) {
|
||||||
} catch (RemoteException e) {
|
|
||||||
}
|
|
||||||
// For direct-boot aware activities, they can be shown when
|
|
||||||
// the device is still locked without triggering the work
|
|
||||||
// challenge.
|
|
||||||
if ((!canBypass) && startWorkChallengeIfNecessary(userId,
|
|
||||||
intent.getIntentSender(), notificationKey)) {
|
|
||||||
// Show work challenge, do not run PendingIntent and
|
// Show work challenge, do not run PendingIntent and
|
||||||
// remove notification
|
// remove notification
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -23760,24 +23760,6 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canBypassWorkChallenge(PendingIntent intent) throws RemoteException {
|
|
||||||
final int userId = intent.getCreatorUserHandle().getIdentifier();
|
|
||||||
if (!mUserController.isUserRunningLocked(userId, ActivityManager.FLAG_AND_LOCKED)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
IIntentSender target = intent.getTarget();
|
|
||||||
if (!(target instanceof PendingIntentRecord)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final PendingIntentRecord record = (PendingIntentRecord) target;
|
|
||||||
final ResolveInfo rInfo = mStackSupervisor.resolveIntent(record.key.requestIntent,
|
|
||||||
record.key.requestResolvedType, userId, PackageManager.MATCH_DIRECT_BOOT_AWARE);
|
|
||||||
// For direct boot aware activities, they can be shown without triggering a work challenge
|
|
||||||
// before the profile user is unlocked.
|
|
||||||
return rInfo != null && rInfo.activityInfo != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dismissKeyguard(IBinder token, IKeyguardDismissCallback callback)
|
public void dismissKeyguard(IBinder token, IKeyguardDismissCallback callback)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
|
|||||||
@@ -210,11 +210,7 @@ class ActivityStartInterceptor {
|
|||||||
if (!mService.mUserController.shouldConfirmCredentials(userId)) {
|
if (!mService.mUserController.shouldConfirmCredentials(userId)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Allow direct boot aware activity to be displayed before the user is unlocked.
|
// TODO(b/28935539): should allow certain activities to bypass work challenge
|
||||||
if (aInfo.directBootAware && mService.mUserController.isUserRunningLocked(userId,
|
|
||||||
ActivityManager.FLAG_AND_LOCKED)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final IIntentSender target = mService.getIntentSenderLocked(
|
final IIntentSender target = mService.getIntentSenderLocked(
|
||||||
INTENT_SENDER_ACTIVITY, callingPackage,
|
INTENT_SENDER_ACTIVITY, callingPackage,
|
||||||
Binder.getCallingUid(), userId, null, null, 0, new Intent[]{ intent },
|
Binder.getCallingUid(), userId, null, null, 0, new Intent[]{ intent },
|
||||||
|
|||||||
Reference in New Issue
Block a user