diff options
| author | Jim Miller <jaggies@google.com> | 2012-10-01 16:26:18 -0700 |
|---|---|---|
| committer | Jim Miller <jaggies@google.com> | 2012-10-01 18:08:23 -0700 |
| commit | ee82f8fa2d47fc1dbfc29582ae348b3c45ff8fe0 (patch) | |
| tree | 3e2462280e3562d4081a8154bc3a154042d20359 /policy | |
| parent | 1f7a09b5df9f859781d9cfa0053fad44c72c2168 (diff) | |
| download | frameworks_base-ee82f8fa2d47fc1dbfc29582ae348b3c45ff8fe0.zip frameworks_base-ee82f8fa2d47fc1dbfc29582ae348b3c45ff8fe0.tar.gz frameworks_base-ee82f8fa2d47fc1dbfc29582ae348b3c45ff8fe0.tar.bz2 | |
Fix camera disambiguation in secure keyguard
When there are multiple activities that respond to MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE
we need to show the disambiguation dialog to the user. However the disambiguation "dialog"
is actully an activity themed as a dialog. Hence, we can't show it in the secure keyguard.
This works around the issue by prompting the user for their credentials directly when the
intent needs disambiguation. This will take them out of keyguard and prompt them for
which activity they want to use.
We'll provide a more robust solution in a future release.
Fixes bug 7109816
Change-Id: I94e643d3cb503e1ce6de24c82400b4d5fcbb9d95
Diffstat (limited to 'policy')
3 files changed, 37 insertions, 3 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardFaceUnlockView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardFaceUnlockView.java index 5922810..8776a80 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardFaceUnlockView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardFaceUnlockView.java @@ -153,7 +153,8 @@ public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecu if (mBiometricUnlock != null) { mBiometricUnlock.stop(); } - mLockPatternUtils.setCurrentUser(userId); + // No longer required; static value set by KeyguardViewMediator + // mLockPatternUtils.setCurrentUser(userId); } }; diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java index 8714276..6de65b0 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java @@ -23,6 +23,8 @@ import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.os.RemoteException; import android.os.UserHandle; import android.provider.MediaStore; @@ -38,6 +40,8 @@ import com.android.internal.widget.multiwaveview.GlowPadView; import com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener; import com.android.internal.R; +import java.util.List; + public class KeyguardSelectorView extends LinearLayout implements KeyguardSecurityView { private static final boolean DEBUG = KeyguardHostView.DEBUG; private static final String TAG = "SecuritySelectorView"; @@ -116,12 +120,39 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri this(context, null); } + private boolean wouldLaunchResolverActivity(Intent intent) { + PackageManager packageManager = mContext.getPackageManager(); + ResolveInfo resolved = packageManager.resolveActivityAsUser(intent, + PackageManager.MATCH_DEFAULT_ONLY, mLockPatternUtils.getCurrentUser()); + final List<ResolveInfo> appList = packageManager.queryIntentActivitiesAsUser( + intent, PackageManager.MATCH_DEFAULT_ONLY, mLockPatternUtils.getCurrentUser()); + // If the list contains the above resolved activity, then it can't be + // ResolverActivity itself. + for (int i = 0; i < appList.size(); i++) { + ResolveInfo tmp = appList.get(i); + if (tmp.activityInfo.name.equals(resolved.activityInfo.name) + && tmp.activityInfo.packageName.equals(resolved.activityInfo.packageName)) { + return false; + } + } + return true; + } + protected void launchCamera() { if (mLockPatternUtils.isSecure()) { // Launch the secure version of the camera - Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE); + final Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE); intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); - launchActivity(intent, true); + + if (wouldLaunchResolverActivity(intent)) { + // TODO: Show disambiguation dialog instead. + // For now, we'll treat this like launching any other app from secure keyguard. + // When they do, user sees the system's ResolverActivity which lets them choose + // which secure camera to use. + launchActivity(intent, false); + } else { + launchActivity(intent, true); + } } else { // Launch the normal camera launchActivity(new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA), false); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java index 212a6bb..e4c1214 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java @@ -907,6 +907,8 @@ public class KeyguardViewMediator { /** * Update the newUserId. Call while holding WindowManagerService lock. + * NOTE: Should only be called by KeyguardViewMediator in response to the user id changing. + * * @param newUserId The id of the incoming user. */ public void setCurrentUser(int newUserId) { |
