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

Commit 0d9499c4 authored by Stanislav Zholnin's avatar Stanislav Zholnin
Browse files

Prevent Historical AppOps from returning empty data.

At every filtering level (uid -> packageName -> featureId -> op)  it is possible that lower level filter would filter out all available data. In such case higher level entity should also be removed.

Test: manual verification
Change-Id: Ibd1b08da5b501c1ecabac7158d70414d955203d7
parent ae6c8788
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4342,6 +4342,9 @@ public class AppOpsManager {
                    mHistoricalUidOps.removeAt(i);
                } else {
                    uidOp.filter(packageName, featureId, opNames, filter, scaleFactor);
                    if (uidOp.getPackageCount() == 0) {
                        mHistoricalUidOps.removeAt(i);
                    }
                }
            }
        }
@@ -4681,6 +4684,9 @@ public class AppOpsManager {
                    mHistoricalPackageOps.removeAt(i);
                } else {
                    packageOps.filter(featureId, opNames, filter, fractionToRemove);
                    if (packageOps.getFeatureCount() == 0) {
                        mHistoricalPackageOps.removeAt(i);
                    }
                }
            }
        }
@@ -4930,6 +4936,9 @@ public class AppOpsManager {
                    mHistoricalFeatureOps.removeAt(i);
                } else {
                    featureOps.filter(opNames, filter, fractionToRemove);
                    if (featureOps.getOpCount() == 0) {
                        mHistoricalFeatureOps.removeAt(i);
                    }
                }
            }
        }