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

Commit 4052d36f authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Fix dumpsys for appops proxy field

- Make flags is the last parameters in access decipher methods.
  All calling code assumes this.
- Get proxyUid info from the appropriate field
- Don't create proxy entries if uid is invalid
- Fixed some incorrect docs

Test: adb shell dumpsys appops now shows proxy information
Fixes: 141328071
Change-Id: I2f94e9b171133141643e628c9224d8d74ec5ad87
parent b2125a71
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -2587,7 +2587,7 @@ public class AppOpsManager {
         * @return The proxy UID.
         */
        public int getProxyUid() {
            return (int) findFirstNonNegativeForFlagsInStates(mDurations,
            return (int) findFirstNonNegativeForFlagsInStates(mProxyUids,
                    MAX_PRIORITY_UID_STATE, MIN_PRIORITY_UID_STATE, OP_FLAGS_ALL);
        }

@@ -2609,7 +2609,7 @@ public class AppOpsManager {
         * @return The proxy UID.
         */
        public int getProxyUid(@UidState int uidState, @OpFlags int flags) {
            return (int) findFirstNonNegativeForFlagsInStates(mDurations,
            return (int) findFirstNonNegativeForFlagsInStates(mProxyUids,
                    uidState, uidState, flags);
        }

@@ -4169,8 +4169,8 @@ public class AppOpsManager {
     * end UID states.
     *
     * @param counts The data array.
     * @param beginUidState The beginning UID state (exclusive).
     * @param endUidState The end UID state.
     * @param beginUidState The beginning UID state (inclusive).
     * @param endUidState The end UID state (inclusive).
     * @param flags The UID flags.
     * @return The sum.
     */
@@ -4199,13 +4199,13 @@ public class AppOpsManager {
     * end UID states.
     *
     * @param counts The data array.
     * @param beginUidState The beginning UID state (inclusive).
     * @param endUidState The end UID state (inclusive).
     * @param flags The UID flags.
     * @param beginUidState The beginning UID state (exclusive).
     * @param endUidState The end UID state.
     * @return The non-negative value or -1.
     */
    private static long findFirstNonNegativeForFlagsInStates(@Nullable LongSparseLongArray counts,
            @OpFlags int flags, @UidState int beginUidState, @UidState int endUidState) {
            @UidState int beginUidState, @UidState int endUidState, @OpFlags int flags) {
        if (counts == null) {
            return -1;
        }
@@ -4231,14 +4231,14 @@ public class AppOpsManager {
     * end UID states.
     *
     * @param counts The data array.
     * @param beginUidState The beginning UID state (inclusive).
     * @param endUidState The end UID state (inclusive).
     * @param flags The UID flags.
     * @param beginUidState The beginning UID state (exclusive).
     * @param endUidState The end UID state.
     * @return The non-negative value or -1.
     */
    private static @Nullable String findFirstNonNullForFlagsInStates(
            @Nullable LongSparseArray<String> counts, @OpFlags int flags,
            @UidState int beginUidState, @UidState int endUidState) {
            @Nullable LongSparseArray<String> counts, @UidState int beginUidState,
            @UidState int endUidState, @OpFlags int flags) {
        if (counts == null) {
            return null;
        }
+4 −0
Original line number Diff line number Diff line
@@ -510,6 +510,10 @@ public class AppOpsService extends IAppOpsService.Stub {

        private void updateProxyState(long key, int proxyUid,
            @Nullable String proxyPackageName) {
            if (proxyUid == Process.INVALID_UID) {
                return;
            }

            if (mProxyUids == null) {
                mProxyUids = new LongSparseLongArray();
            }