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 /core | |
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 'core')
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 17 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 3 | ||||
-rw-r--r-- | core/java/android/content/Intent.java | 38 | ||||
-rw-r--r-- | core/java/android/net/Uri.java | 42 | ||||
-rw-r--r-- | core/java/android/view/IWindowManager.aidl | 1 | ||||
-rw-r--r-- | core/java/android/view/WindowManagerPolicy.java | 5 |
6 files changed, 87 insertions, 19 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 7799779..b4471f0 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -1550,6 +1550,13 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + dismissKeyguardOnNextActivity(); + reply.writeNoException(); + return true; + } + } return super.onTransact(code, data, reply, flags); @@ -3504,5 +3511,15 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } + public void dismissKeyguardOnNextActivity() throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0); + reply.readException(); + data.recycle(); + reply.recycle(); + } + private IBinder mRemote; } diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 27dd691..26813bf 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -372,6 +372,8 @@ public interface IActivityManager extends IInterface { public void showBootMessage(CharSequence msg, boolean always) throws RemoteException; + public void dismissKeyguardOnNextActivity() throws RemoteException; + /* * Private non-Binder interfaces */ @@ -602,4 +604,5 @@ public interface IActivityManager extends IInterface { int UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+135; int GET_PROCESS_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+136; int SHOW_BOOT_MESSAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+137; + int DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+138; } diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 72cf26a..f44d038 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -5577,24 +5577,35 @@ public class Intent implements Parcelable, Cloneable { @Override public String toString() { - StringBuilder b = new StringBuilder(128); + StringBuilder b = new StringBuilder(128); b.append("Intent { "); - toShortString(b, true, true); + toShortString(b, true, true, true); b.append(" }"); return b.toString(); } /** @hide */ - public String toShortString(boolean comp, boolean extras) { - StringBuilder b = new StringBuilder(128); - toShortString(b, comp, extras); + public String toInsecureString() { + StringBuilder b = new StringBuilder(128); + + b.append("Intent { "); + toShortString(b, false, true, true); + b.append(" }"); + return b.toString(); } /** @hide */ - public void toShortString(StringBuilder b, boolean comp, boolean extras) { + public String toShortString(boolean secure, boolean comp, boolean extras) { + StringBuilder b = new StringBuilder(128); + toShortString(b, secure, comp, extras); + return b.toString(); + } + + /** @hide */ + public void toShortString(StringBuilder b, boolean secure, boolean comp, boolean extras) { boolean first = true; if (mAction != null) { b.append("act=").append(mAction); @@ -5621,19 +5632,8 @@ public class Intent implements Parcelable, Cloneable { } first = false; b.append("dat="); - String scheme = mData.getScheme(); - if (scheme != null) { - if (scheme.equalsIgnoreCase("tel")) { - b.append("tel:xxx-xxx-xxxx"); - } else if (scheme.equalsIgnoreCase("sip")) { - b.append("sip:xxxxxxxxxx"); - } else if (scheme.equalsIgnoreCase("sms")) { - b.append("sms:xxx-xxx-xxxx"); - } else if (scheme.equalsIgnoreCase("smsto")) { - b.append("smsto:xxx-xxx-xxxx"); - } else { - b.append(mData); - } + if (secure) { + b.append(mData.toSafeString()); } else { b.append(mData); } diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java index 2c875c8..9d28eff 100644 --- a/core/java/android/net/Uri.java +++ b/core/java/android/net/Uri.java @@ -353,6 +353,48 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { public abstract String toString(); /** + * Return a string representation of the URI that is safe to print + * to logs and other places where PII should be avoided. + * @hide + */ + public String toSafeString() { + String scheme = getScheme(); + String ssp = getSchemeSpecificPart(); + if (scheme != null) { + if (scheme.equalsIgnoreCase("tel") || scheme.equalsIgnoreCase("sip") + || scheme.equalsIgnoreCase("sms") || scheme.equalsIgnoreCase("smsto") + || scheme.equalsIgnoreCase("mailto")) { + StringBuilder builder = new StringBuilder(64); + builder.append(scheme); + builder.append(':'); + if (ssp != null) { + for (int i=0; i<ssp.length(); i++) { + char c = ssp.charAt(i); + if (c == '-' || c == '@' || c == '.') { + builder.append(c); + } else { + builder.append('x'); + } + } + } + return builder.toString(); + } + } + // Not a sensitive scheme, but let's still be conservative about + // the data we include -- only the ssp, not the query params or + // fragment, because those can often have sensitive info. + StringBuilder builder = new StringBuilder(64); + if (scheme != null) { + builder.append(scheme); + builder.append(':'); + } + if (ssp != null) { + builder.append(ssp); + } + return builder.toString(); + } + + /** * Constructs a new builder, copying the attributes from this Uri. */ public abstract Builder buildUpon(); diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 55c821d..45f9da2 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -116,6 +116,7 @@ interface IWindowManager boolean isKeyguardLocked(); boolean isKeyguardSecure(); boolean inKeyguardRestrictedInputMode(); + void dismissKeyguard(); void closeSystemDialogs(String reason); diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 1dbb083..9c7b2a9 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -850,6 +850,11 @@ public interface WindowManagerPolicy { public boolean inKeyguardRestrictedKeyInputMode(); /** + * Ask the policy to dismiss the keyguard, if it is currently shown. + */ + public void dismissKeyguardLw(); + + /** * Given an orientation constant, returns the appropriate surface rotation, * taking into account sensors, docking mode, rotation lock, and other factors. * |