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

Commit 95235f7b authored by Eun Jeong Shin's avatar Eun Jeong Shin
Browse files

Add new AppOp for cell identity and information access

This change introduces new App Ops for tracking applications' access to cell identity and cell information. (Enhanced control over these accesses will be facilitated by UICC in a future update.) Currently, access to this data is implicitly tied to location permissions (e.g., ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION), making it difficult for users and the system to distinguish between GPS-based location access and cellular network-based information access.

The new App Ops, OP_READ_CELL_IDENTITY and OP_READ_CELL_INFO, will specifically track the usage of APIs that retrieve cell identity (e.g., cell ID, MNC, MCC) and other related cell information (e.g., signal strength, registered PLMN).

Bug: 391621017
Change-Id: I768fabf3f4f1832318d6129387fcd1ac24af388f
Flag: EXEMPT AppOpsManager only update
parent 45d6e93f
Loading
Loading
Loading
Loading
+33 −2
Original line number Diff line number Diff line
@@ -1718,9 +1718,24 @@ public class AppOpsManager {
    public static final int OP_SYSTEM_APPLICATION_OVERLAY =
            AppOpEnums.APP_OP_SYSTEM_APPLICATION_OVERLAY;

    /**
     * Access cell identity data.
     *
     * @hide
     */
    public static final int OP_READ_CELL_IDENTITY = AppOpEnums.APP_OP_READ_CELL_IDENTITY;

    /**
     * Access cell info data such as connection status or registered to a
     * mobile network.
     *
     * @hide
     */
    public static final int OP_READ_CELL_INFO = AppOpEnums.APP_OP_READ_CELL_INFO;

    /** @hide */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int _NUM_OP = 165;
    public static final int _NUM_OP = 167;

    /**
     * All app ops represented as strings.
@@ -1888,7 +1903,9 @@ public class AppOpsManager {
            OPSTR_SCENE_UNDERSTANDING_COARSE,
            OPSTR_SCENE_UNDERSTANDING_FINE,
            OPSTR_POST_PROMOTED_NOTIFICATIONS,
            OPSTR_SYSTEM_APPLICATION_OVERLAY
            OPSTR_SYSTEM_APPLICATION_OVERLAY,
            OPSTR_READ_CELL_IDENTITY,
            OPSTR_READ_CELL_INFO
    })
    public @interface AppOpString {}

@@ -2695,6 +2712,12 @@ public class AppOpsManager {
    public static final String OPSTR_SYSTEM_APPLICATION_OVERLAY =
            "android:system_application_overlay";

    /** @hide Read telephony cell identity. */
    public static final String OPSTR_READ_CELL_IDENTITY = "android:read_cell_identity";

    /** @hide Read telephony cell information. */
    public static final String OPSTR_READ_CELL_INFO = "android:read_cell_info";

    /** {@link #sAppOpsToNote} not initialized yet for this op */
    private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
    /** Should not collect noting of this app-op in {@link #sAppOpsToNote} */
@@ -3365,6 +3388,14 @@ public class AppOpsManager {
                .setPermission(com.android.media.projection.flags.Flags.recordingOverlay()
                        ? Manifest.permission.SYSTEM_APPLICATION_OVERLAY : null)
                .build(),
        new AppOpInfo.Builder(OP_READ_CELL_IDENTITY, OPSTR_READ_CELL_IDENTITY,
                "READ_CELL_IDENTITY")
                .setDefaultMode(AppOpsManager.MODE_ALLOWED)
                .build(),
        new AppOpInfo.Builder(OP_READ_CELL_INFO, OPSTR_READ_CELL_INFO,
                "READ_CELL_INFO")
                .setDefaultMode(AppOpsManager.MODE_ALLOWED)
                .build(),
    };

    // The number of longs needed to form a full bitmask of app ops