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

Commit 61162522 authored by Nextbit's avatar Nextbit Committed by Steve Kondik
Browse files

PackageManager: Add and protect configuration APIs for pre-launch checks

This change defines an optional pre-launch check.  Trusted applications
must be granted the INTERCEPT_PACKAGE_LAUNCH permission, defined in this
CR, and are allowed to bootstrap themselves using the protected set, add, remove, and clear APIs.

Additionally, checks have been added to ensure that the custom prelaunch
check activity always resolves to a valid target.

This is a roll-up CR from cm-11.0 and also contains the following Change-Ids:
- I0c80bd9ec6bda3d21557aaa9503f05ff86adf434
- Ib62e25b780df39c4a7d9d1e4eaf3fc98ffa4089c

Change-Id: I7f6be647fde3ce4ed699e6abfbe0392176ec96d3
parent 42864c3b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -466,4 +466,10 @@ interface IPackageManager {
    void updateIconMapping(String pkgName);
    ComposedIconInfo getComposedIconInfo();
    int processThemeResources(String themePkgName);

    /** Package interception */
    void setPreLaunchCheckActivity(in ComponentName componentName);
    void addPreLaunchCheckPackage(String packageName);
    void removePreLaunchCheckPackage(String packageName);
    void clearPreLaunchCheckPackages();
}
+7 −0
Original line number Diff line number Diff line
@@ -204,6 +204,13 @@ public abstract class PackageManager {
     */
    public static final int MATCH_DEFAULT_ONLY   = 0x00010000;

    /**
     * Resolution flag: If there is only 1 activity that the intent resolves too and if this
     * flag  is set perform pre launch check for the resolved activity.
     * @hide
     */
    public static final int PERFORM_PRE_LAUNCH_CHECK   = 0x00100000;

    /**
     * Flag for {@link addCrossProfileIntentFilter}: if this flag is set:
     * when resolving an intent that matches the {@link CrossProfileIntentFilter}, the current
+8 −0
Original line number Diff line number Diff line
@@ -127,6 +127,14 @@ public class ResolveInfo implements Parcelable {
     */
    public String resolvePackageName;

    /**
     * Optional -- if non-null, the component name of the target of the original
     * intent. The ResolveInfo can change the component so this field stores
     * the origial target. This can be used for retargetting by the receiver.
     * @hide
     */
    public ComponentName targetComponentName;

    /**
     * If not equal to UserHandle.USER_CURRENT, then the intent will be forwarded to this user.
     * @hide
+8 −0
Original line number Diff line number Diff line
@@ -1981,6 +1981,14 @@
        android:description="@string/permdesc_bindJobService" />
    <uses-permission android:name="android.permission.BIND_JOB_SERVICE"/>

    <!-- Allows an application to intercept package launch actions.
         <p> Not for use by third-party applications.
         @hide -->
    <permission android:name="android.permission.INTERCEPT_PACKAGE_LAUNCH"
        android:label="@string/permlab_interceptPackageLaunch"
        android:description="@string/permdesc_interceptPackageLaunch"
        android:protectionLevel="system|signature" />

    <!-- ========================================= -->
    <!-- Permissions for special development tools -->
    <!-- ========================================= -->
+5 −0
Original line number Diff line number Diff line
@@ -144,6 +144,11 @@
    <!-- USB_PREFERENCES: Notification for when no USB options chosen.  This is the title -->
    <string name="usb_choose_notification_title">Touch to choose USB options.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want the application to do this. -->
    <string name="permlab_interceptPackageLaunch">Intercept application launch</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_interceptPackageLaunch">Allows an app to intercept launch of other applications</string>

    <!-- App ops requests -->
    <string name="app_ops_access_camera">access the camera</string>
    <string name="app_ops_access_location">access your location</string>
Loading