Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90c52de2 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

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
parent 67c5b125
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -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;
}
+3 −0
Original line number Diff line number Diff line
@@ -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;
}
+19 −19
Original line number Diff line number Diff line
@@ -5580,21 +5580,32 @@ public class Intent implements Parcelable, Cloneable {
        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) {
    public String toInsecureString() {
        StringBuilder b = new StringBuilder(128);
        toShortString(b, comp, extras);

        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);
            }
+42 −0
Original line number Diff line number Diff line
@@ -352,6 +352,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.
     */
+1 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ interface IWindowManager
    boolean isKeyguardLocked();
    boolean isKeyguardSecure();
    boolean inKeyguardRestrictedInputMode();
    void dismissKeyguard();

    void closeSystemDialogs(String reason);
    
Loading