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

Commit 8abba3a6 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Don't include Bitmaps in activity intents

Bug: 35515740
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases

Change-Id: Ibb94728eb03997bb850b08c61c756f283bd90a08
parent cbf78f80
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@
package android.content.pm;
package android.content.pm;


import android.os.Bundle;
import android.os.Bundle;
import android.appwidget.AppWidgetProviderInfo;
import android.content.pm.ShortcutInfo;


/**
/**
 * {@hide}
 * {@hide}
@@ -23,4 +25,6 @@ import android.os.Bundle;
interface IPinItemRequest {
interface IPinItemRequest {
    boolean isValid();
    boolean isValid();
    boolean accept(in Bundle options);
    boolean accept(in Bundle options);
    ShortcutInfo getShortcutInfo();
    AppWidgetProviderInfo getAppWidgetProviderInfo();
}
}
+14 −30
Original line number Original line Diff line number Diff line
@@ -1291,28 +1291,14 @@ public class LauncherApps {
        public @interface RequestType {}
        public @interface RequestType {}


        private final int mRequestType;
        private final int mRequestType;
        private final ShortcutInfo mShortcutInfo;
        private final AppWidgetProviderInfo mAppWidgetInfo;
        private final IPinItemRequest mInner;
        private final IPinItemRequest mInner;


        /**
        /**
         * @hide
         * @hide
         */
         */
        public PinItemRequest(ShortcutInfo shortcutInfo, IPinItemRequest inner) {
        public PinItemRequest(IPinItemRequest inner, int type) {
            mRequestType = REQUEST_TYPE_SHORTCUT;
            mShortcutInfo = shortcutInfo;
            mAppWidgetInfo = null;
            mInner = inner;
        }

        /**
         * @hide
         */
        public PinItemRequest(AppWidgetProviderInfo appWidgetInfo, IPinItemRequest inner) {
            mRequestType = REQUEST_TYPE_APPWIDGET;
            mShortcutInfo = null;
            mAppWidgetInfo = appWidgetInfo;
            mInner = inner;
            mInner = inner;
            mRequestType = type;
        }
        }


        /**
        /**
@@ -1330,7 +1316,11 @@ public class LauncherApps {
         */
         */
        @Nullable
        @Nullable
        public ShortcutInfo getShortcutInfo() {
        public ShortcutInfo getShortcutInfo() {
            return mShortcutInfo;
            try {
                return mInner.getShortcutInfo();
            } catch (RemoteException e) {
                throw e.rethrowAsRuntimeException();
            }
        }
        }


        /**
        /**
@@ -1339,12 +1329,16 @@ public class LauncherApps {
         */
         */
        @Nullable
        @Nullable
        public AppWidgetProviderInfo getAppWidgetProviderInfo(Context context) {
        public AppWidgetProviderInfo getAppWidgetProviderInfo(Context context) {
            if (mAppWidgetInfo != null) {
            try {
                AppWidgetProviderInfo info = mAppWidgetInfo.clone();
                final AppWidgetProviderInfo info = mInner.getAppWidgetProviderInfo();
                if (info == null) {
                    return null;
                }
                info.updateDimensions(context.getResources().getDisplayMetrics());
                info.updateDimensions(context.getResources().getDisplayMetrics());
                return info;
                return info;
            } catch (RemoteException e) {
                throw e.rethrowAsRuntimeException();
            }
            }
            return null;
        }
        }


        /**
        /**
@@ -1381,22 +1375,12 @@ public class LauncherApps {
            final ClassLoader cl = getClass().getClassLoader();
            final ClassLoader cl = getClass().getClassLoader();


            mRequestType = source.readInt();
            mRequestType = source.readInt();
            mShortcutInfo = mRequestType == REQUEST_TYPE_SHORTCUT ?
                (ShortcutInfo) source.readParcelable(cl) : null;
            mAppWidgetInfo = mRequestType == REQUEST_TYPE_APPWIDGET ?
                (AppWidgetProviderInfo) source.readParcelable(cl) : null;
            mInner = IPinItemRequest.Stub.asInterface(source.readStrongBinder());
            mInner = IPinItemRequest.Stub.asInterface(source.readStrongBinder());
        }
        }


        @Override
        @Override
        public void writeToParcel(Parcel dest, int flags) {
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(mRequestType);
            dest.writeInt(mRequestType);
            if (mRequestType == REQUEST_TYPE_SHORTCUT) {
                dest.writeParcelable(mShortcutInfo, flags);
            }
            if (mRequestType == REQUEST_TYPE_APPWIDGET) {
                dest.writeParcelable(mAppWidgetInfo, flags);
            }
            dest.writeStrongBinder(mInner.asBinder());
            dest.writeStrongBinder(mInner.asBinder());
        }
        }


+38 −4
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ class ShortcutRequestPinProcessor {
    /**
    /**
     * Internal for {@link android.content.pm.LauncherApps.PinItemRequest} which receives callbacks.
     * Internal for {@link android.content.pm.LauncherApps.PinItemRequest} which receives callbacks.
     */
     */
    private static class PinItemRequestInner extends IPinItemRequest.Stub {
    private abstract static class PinItemRequestInner extends IPinItemRequest.Stub {
        protected final ShortcutRequestPinProcessor mProcessor;
        protected final ShortcutRequestPinProcessor mProcessor;
        private final IntentSender mResultIntent;
        private final IntentSender mResultIntent;
        private final int mLauncherUid;
        private final int mLauncherUid;
@@ -63,6 +63,14 @@ class ShortcutRequestPinProcessor {
            mLauncherUid = launcherUid;
            mLauncherUid = launcherUid;
        }
        }


        public ShortcutInfo getShortcutInfo() {
            return null;
        }

        public AppWidgetProviderInfo getAppWidgetProviderInfo() {
            return null;
        }

        /**
        /**
         * Returns true if the caller is same as the default launcher app when this request
         * Returns true if the caller is same as the default launcher app when this request
         * object was created.
         * object was created.
@@ -123,6 +131,26 @@ class ShortcutRequestPinProcessor {
        }
        }
    }
    }


    /**
     * Internal for {@link android.content.pm.LauncherApps.PinItemRequest} which receives callbacks.
     */
    private static class PinAppWidgetRequestInner extends PinItemRequestInner {
        final AppWidgetProviderInfo mAppWidgetProviderInfo;

        private PinAppWidgetRequestInner(ShortcutRequestPinProcessor processor,
                IntentSender resultIntent, int launcherUid,
                AppWidgetProviderInfo appWidgetProviderInfo) {
            super(processor, resultIntent, launcherUid);

            mAppWidgetProviderInfo = appWidgetProviderInfo;
        }

        @Override
        public AppWidgetProviderInfo getAppWidgetProviderInfo() {
            return mAppWidgetProviderInfo;
        }
    }

    /**
    /**
     * Internal for {@link android.content.pm.LauncherApps.PinItemRequest} which receives callbacks.
     * Internal for {@link android.content.pm.LauncherApps.PinItemRequest} which receives callbacks.
     */
     */
@@ -152,6 +180,11 @@ class ShortcutRequestPinProcessor {
            this.preExisting = preExisting;
            this.preExisting = preExisting;
        }
        }


        @Override
        public ShortcutInfo getShortcutInfo() {
            return shortcutForLauncher;
        }

        @Override
        @Override
        protected boolean tryAccept() {
        protected boolean tryAccept() {
            if (DEBUG) {
            if (DEBUG) {
@@ -208,8 +241,9 @@ class ShortcutRequestPinProcessor {
        } else {
        } else {
            int launcherUid = mService.injectGetPackageUid(
            int launcherUid = mService.injectGetPackageUid(
                    confirmActivity.first.getPackageName(), launcherUserId);
                    confirmActivity.first.getPackageName(), launcherUserId);
            request = new PinItemRequest(inAppWidget,
            request = new PinItemRequest(
                    new PinItemRequestInner(this, resultIntent, launcherUid));
                    new PinAppWidgetRequestInner(this, resultIntent, launcherUid, inAppWidget),
                    PinItemRequest.REQUEST_TYPE_APPWIDGET);
        }
        }
        return startRequestConfirmActivity(confirmActivity.first, launcherUserId, request,
        return startRequestConfirmActivity(confirmActivity.first, launcherUserId, request,
                requestType);
                requestType);
@@ -319,7 +353,7 @@ class ShortcutRequestPinProcessor {
                        mService.injectGetPackageUid(launcherPackage, launcherUserId),
                        mService.injectGetPackageUid(launcherPackage, launcherUserId),
                        existsAlready);
                        existsAlready);


        return new PinItemRequest(shortcutForLauncher, inner);
        return new PinItemRequest(inner, PinItemRequest.REQUEST_TYPE_SHORTCUT);
    }
    }


    private void validateExistingShortcut(ShortcutInfo shortcutInfo) {
    private void validateExistingShortcut(ShortcutInfo shortcutInfo) {