diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-09-23 12:57:44 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-09-23 13:39:33 -0700 |
commit | 90c52de28691ca0bbbf7c039ef20f85ce46882cc (patch) | |
tree | 3a6dcf93f186f44561a312927d7fe2e97e45f6d4 /services | |
parent | 67c5b1251178532726964c2e0f4229d079ff0a3e (diff) | |
download | frameworks_base-90c52de28691ca0bbbf7c039ef20f85ce46882cc.zip frameworks_base-90c52de28691ca0bbbf7c039ef20f85ce46882cc.tar.gz frameworks_base-90c52de28691ca0bbbf7c039ef20f85ce46882cc.tar.bz2 |
Fix issue #5173952: Opening a Notification From Lock Screen...
...Should Skip Unsecure Lockscreen (ICS)
Also while I am in there, clean up logging of intent objects to include
even less sensitive information, while showing the true Intent in dump
output (since apps can't get to that).
Change-Id: I35fed714645b21e4304ba38a11ebb9c4c963538e
Diffstat (limited to 'services')
9 files changed, 62 insertions, 15 deletions
diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java index 5ffcdc5..b8c44d9 100644 --- a/services/java/com/android/server/AlarmManagerService.java +++ b/services/java/com/android/server/AlarmManagerService.java @@ -477,7 +477,7 @@ class AlarmManagerService extends IAlarmManager.Stub { : bs.filterStats.entrySet()) { pw.print(" "); pw.print(fe.getValue().count); pw.print(" alarms: "); - pw.println(fe.getKey().getIntent().toShortString(true, false)); + pw.println(fe.getKey().getIntent().toShortString(false, true, false)); } } } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 59ed80f..2942c28 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -3784,6 +3784,12 @@ public final class ActivityManagerService extends ActivityManagerNative mWindowManager.showBootMessage(msg, always); } + public void dismissKeyguardOnNextActivity() { + synchronized (this) { + mMainStack.dismissKeyguardOnNextActivityLocked(); + } + } + final void finishBooting() { IntentFilter pkgFilter = new IntentFilter(); pkgFilter.addAction(Intent.ACTION_QUERY_PACKAGE_RESTART); @@ -7907,6 +7913,8 @@ public final class ActivityManagerService extends ActivityManagerNative if (dumpAll) { pw.println(" mLastPausedActivity: " + mMainStack.mLastPausedActivity); pw.println(" mSleepTimeout: " + mMainStack.mSleepTimeout); + pw.println(" mDismissKeyguardOnNextActivity: " + + mMainStack.mDismissKeyguardOnNextActivity); } if (mRecentTasks.size() > 0) { @@ -8547,7 +8555,7 @@ public final class ActivityManagerService extends ActivityManagerNative for (int i=0; i<N; i++) { sb.setLength(0); sb.append(" Intent: "); - intents.get(i).toShortString(sb, true, false); + intents.get(i).toShortString(sb, false, true, false); pw.println(sb.toString()); Bundle bundle = intents.get(i).getExtras(); if (bundle != null) { @@ -8840,7 +8848,8 @@ public final class ActivityManagerService extends ActivityManagerNative } else if (complete) { // Complete + brief == give a summary. Isn't that obvious?!? if (lastTask.intent != null) { - pw.print(prefix); pw.print(" "); pw.println(lastTask.intent); + pw.print(prefix); pw.print(" "); + pw.println(lastTask.intent.toInsecureString()); } } } @@ -8851,7 +8860,7 @@ public final class ActivityManagerService extends ActivityManagerNative r.dump(pw, innerPrefix); } else if (complete) { // Complete + brief == give a summary. Isn't that obvious?!? - pw.print(innerPrefix); pw.println(r.intent); + pw.print(innerPrefix); pw.println(r.intent.toInsecureString()); if (r.app != null) { pw.print(innerPrefix); pw.println(r.app); } @@ -10053,7 +10062,7 @@ public final class ActivityManagerService extends ActivityManagerNative boolean created = false; try { mStringBuilder.setLength(0); - r.intent.getIntent().toShortString(mStringBuilder, false, true); + r.intent.getIntent().toShortString(mStringBuilder, true, false, true); EventLog.writeEvent(EventLogTags.AM_CREATE_SERVICE, System.identityHashCode(r), r.shortName, mStringBuilder.toString(), r.app.pid); diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java index 73ffafb..ce45bfb 100644 --- a/services/java/com/android/server/am/ActivityRecord.java +++ b/services/java/com/android/server/am/ActivityRecord.java @@ -122,7 +122,7 @@ final class ActivityRecord extends IApplicationToken.Stub { pw.print(" processName="); pw.println(processName); pw.print(prefix); pw.print("launchedFromUid="); pw.print(launchedFromUid); pw.print(" app="); pw.println(app); - pw.print(prefix); pw.println(intent); + pw.print(prefix); pw.println(intent.toInsecureString()); pw.print(prefix); pw.print("frontOfTask="); pw.print(frontOfTask); pw.print(" task="); pw.println(task); pw.print(prefix); pw.print("taskAffinity="); pw.println(taskAffinity); diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 35dee3c..7bc19ab 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -259,6 +259,11 @@ final class ActivityStack { */ boolean mSleepTimeout = false; + /** + * Dismiss the keyguard after the next activity is displayed? + */ + boolean mDismissKeyguardOnNextActivity = false; + int mThumbnailWidth = -1; int mThumbnailHeight = -1; @@ -2169,7 +2174,7 @@ final class ActivityStack { } if (err == START_SUCCESS) { - Slog.i(TAG, "Starting: " + intent + " from pid " + Slog.i(TAG, "START {" + intent.toShortString(true, true, true) + "} from pid " + (callerApp != null ? callerApp.pid : callingPid)); } @@ -2224,6 +2229,7 @@ final class ActivityStack { resultRecord, resultWho, requestCode, Activity.RESULT_CANCELED, null); } + mDismissKeyguardOnNextActivity = false; return err; } @@ -2235,6 +2241,7 @@ final class ActivityStack { resultRecord, resultWho, requestCode, Activity.RESULT_CANCELED, null); } + mDismissKeyguardOnNextActivity = false; String msg; if (!aInfo.exported) { msg = "Permission Denial: starting " + intent.toString() @@ -2272,6 +2279,7 @@ final class ActivityStack { } // We pretend to the caller that it was really started, but // they will just get a cancel result. + mDismissKeyguardOnNextActivity = false; return START_SUCCESS; } } @@ -2295,6 +2303,7 @@ final class ActivityStack { pal.grantedMode = grantedMode; pal.onlyIfNeeded = onlyIfNeeded; mService.mPendingActivityLaunches.add(pal); + mDismissKeyguardOnNextActivity = false; return START_SWITCHES_CANCELED; } } @@ -2313,8 +2322,17 @@ final class ActivityStack { mService.doPendingActivityLaunchesLocked(false); } - return startActivityUncheckedLocked(r, sourceRecord, + err = startActivityUncheckedLocked(r, sourceRecord, grantedUriPermissions, grantedMode, onlyIfNeeded, true); + if (mDismissKeyguardOnNextActivity && mPausingActivity == null) { + // Someone asked to have the keyguard dismissed on the next + // activity start, but we are not actually doing an activity + // switch... just dismiss the keyguard now, because we + // probably want to see whatever is behind it. + mDismissKeyguardOnNextActivity = false; + mService.mWindowManager.dismissKeyguard(); + } + return err; } final void moveHomeToFrontFromLaunchLocked(int launchFlags) { @@ -2983,6 +3001,11 @@ final class ActivityStack { w.thisTime = w.totalTime; } mService.notifyAll(); + + if (mDismissKeyguardOnNextActivity) { + mDismissKeyguardOnNextActivity = false; + mService.mWindowManager.dismissKeyguard(); + } } void sendActivityResultLocked(int callingUid, ActivityRecord r, @@ -4126,4 +4149,8 @@ final class ActivityStack { return true; } + + public void dismissKeyguardOnNextActivityLocked() { + mDismissKeyguardOnNextActivity = true; + } } diff --git a/services/java/com/android/server/am/IntentBindRecord.java b/services/java/com/android/server/am/IntentBindRecord.java index 3a5ca66..2618c77 100644 --- a/services/java/com/android/server/am/IntentBindRecord.java +++ b/services/java/com/android/server/am/IntentBindRecord.java @@ -54,7 +54,7 @@ class IntentBindRecord { void dumpInService(PrintWriter pw, String prefix) { pw.print(prefix); pw.print("intent={"); - pw.print(intent.getIntent().toShortString(true, false)); + pw.print(intent.getIntent().toShortString(false, true, false)); pw.println('}'); pw.print(prefix); pw.print("binder="); pw.println(binder); pw.print(prefix); pw.print("requested="); pw.print(requested); @@ -89,7 +89,7 @@ class IntentBindRecord { sb.append(service.shortName); sb.append(':'); if (intent != null) { - intent.getIntent().toShortString(sb, false, false); + intent.getIntent().toShortString(sb, false, false, false); } sb.append('}'); return stringName = sb.toString(); diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java index 8ed0cc1..abd2a1f 100644 --- a/services/java/com/android/server/am/PendingIntentRecord.java +++ b/services/java/com/android/server/am/PendingIntentRecord.java @@ -150,7 +150,8 @@ class PendingIntentRecord extends IIntentSender.Stub { public String toString() { return "Key{" + typeName() + " pkg=" + packageName + " intent=" - + (requestIntent != null ? requestIntent.toShortString(true, false) : "<null>") + + (requestIntent != null + ? requestIntent.toShortString(false, true, false) : "<null>") + " flags=0x" + Integer.toHexString(flags) + "}"; } @@ -317,7 +318,7 @@ class PendingIntentRecord extends IIntentSender.Stub { } if (key.requestIntent != null) { pw.print(prefix); pw.print("requestIntent="); - pw.println(key.requestIntent.toShortString(true, true)); + pw.println(key.requestIntent.toShortString(false, true, true)); } if (sent || canceled) { pw.print(prefix); pw.print("sent="); pw.print(sent); diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java index 004e963..257113b 100644 --- a/services/java/com/android/server/am/ServiceRecord.java +++ b/services/java/com/android/server/am/ServiceRecord.java @@ -192,7 +192,7 @@ class ServiceRecord extends Binder { void dump(PrintWriter pw, String prefix) { pw.print(prefix); pw.print("intent={"); - pw.print(intent.getIntent().toShortString(true, false)); + pw.print(intent.getIntent().toShortString(false, true, false)); pw.println('}'); pw.print(prefix); pw.print("packageName="); pw.println(packageName); pw.print(prefix); pw.print("processName="); pw.println(processName); diff --git a/services/java/com/android/server/am/TaskRecord.java b/services/java/com/android/server/am/TaskRecord.java index 87129ea..a860763 100644 --- a/services/java/com/android/server/am/TaskRecord.java +++ b/services/java/com/android/server/am/TaskRecord.java @@ -94,14 +94,14 @@ class TaskRecord extends ThumbnailHolder { if (intent != null) { StringBuilder sb = new StringBuilder(128); sb.append(prefix); sb.append("intent={"); - intent.toShortString(sb, true, false); + intent.toShortString(sb, false, true, false); sb.append('}'); pw.println(sb.toString()); } if (affinityIntent != null) { StringBuilder sb = new StringBuilder(128); sb.append(prefix); sb.append("affinityIntent={"); - affinityIntent.toShortString(sb, true, false); + affinityIntent.toShortString(sb, false, true, false); sb.append('}'); pw.println(sb.toString()); } diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 02b246a..a9ca304 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -4525,6 +4525,16 @@ public class WindowManagerService extends IWindowManager.Stub return mPolicy.isKeyguardSecure(); } + public void dismissKeyguard() { + if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DISABLE_KEYGUARD) + != PackageManager.PERMISSION_GRANTED) { + throw new SecurityException("Requires DISABLE_KEYGUARD permission"); + } + synchronized(mWindowMap) { + mPolicy.dismissKeyguardLw(); + } + } + public void closeSystemDialogs(String reason) { synchronized(mWindowMap) { for (int i=mWindows.size()-1; i>=0; i--) { |