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

Commit 2d0d6340 authored by Manjeet Rulhania's avatar Manjeet Rulhania
Browse files

Revert all runtime ops being recorded in discrete ops db

No approval from product to enable runtime ops in
discrete ops db.

Bug: 377584611
Test: presubmit
Flag: EXEMPT bugfix
Change-Id: I9779755cb296e25ddf5c480f726970bd07edace2
parent f2e69bdf
Loading
Loading
Loading
Loading
+5 −28
Original line number Diff line number Diff line
@@ -107,16 +107,6 @@ abstract class DiscreteOpsRegistry {
            OP_MONITOR_LOCATION
    };

    // These are additional ops, which are not backed by runtime permissions, but are recorded.
    static final int[] ADDITIONAL_DISCRETE_OPS = new int[] {
            OP_PHONE_CALL_MICROPHONE,
            OP_RECEIVE_AMBIENT_TRIGGER_AUDIO,
            OP_RECEIVE_SANDBOX_TRIGGER_AUDIO,
            OP_PHONE_CALL_CAMERA,
            OP_EMERGENCY_LOCATION,
            OP_RESERVED_FOR_TESTING
    };

    // Legacy ops captured in discrete database.
    private static final String LEGACY_OPS = OP_FINE_LOCATION + "," + OP_COARSE_LOCATION
            + "," + OP_EMERGENCY_LOCATION + "," + OP_CAMERA + "," + OP_RECORD_AUDIO + ","
@@ -241,29 +231,16 @@ abstract class DiscreteOpsRegistry {
        Arrays.sort(sDiscreteOps);
    }

    // App ops backed by runtime/dangerous permissions.
    private static IntArray getRuntimePermissionOps() {
        IntArray runtimeOps = new IntArray();
        for (int op = 0; op < AppOpsManager._NUM_OP; op++) {
            if (AppOpsManager.opIsRuntimePermission(op)) {
                runtimeOps.add(op);
            }
        }
        return runtimeOps;
    }

    /**
     * @return an array of app ops captured into discrete database.
     */
    private static int[] getDefaultOpsList() {
        if (!(Flags.recordAllRuntimeAppopsSqlite() && Flags.enableSqliteAppopsAccesses())) {
            return getDefaultLegacyOps();
        }
        IntArray discreteOpsArray = new IntArray();
        discreteOpsArray.addAll(getDefaultLegacyOps());

        IntArray discreteOpsArray = getRuntimePermissionOps();
        if (Flags.enableSqliteAppopsAccesses()) {
            discreteOpsArray.addAll(IMPORTANT_OPS_FOR_SECURITY);
        discreteOpsArray.addAll(ADDITIONAL_DISCRETE_OPS);

        }
        return discreteOpsArray.toArray();
    }