Make historical op getters async for real

The system server side was doing the work async and the binder call
was not oneway resulting in sync behavior for APIs desinged to be
async.

bug:147435904

Test: atest android.app.appops.cts.HistoricalAppopsTest

Change-Id: Ib184302798b58934ba9a0617a6a407f3aaa469af
This commit is contained in:
Svet Ganov
2020-01-09 20:26:14 -08:00
parent cb1aa8d29c
commit 73fd86eada

View File

@@ -1759,8 +1759,9 @@ public class AppOpsService extends IAppOpsService.Stub {
? opNames.toArray(new String[opNames.size()]) : null;
// Must not hold the appops lock
mHistoricalRegistry.getHistoricalOps(uid, packageName, featureId, opNamesArray, filter,
beginTimeMillis, endTimeMillis, flags, callback);
mHandler.post(PooledLambda.obtainRunnable(HistoricalRegistry::getHistoricalOps,
mHistoricalRegistry, uid, packageName, featureId, opNamesArray, filter,
beginTimeMillis, endTimeMillis, flags, callback).recycleOnUse());
}
@Override
@@ -1778,8 +1779,9 @@ public class AppOpsService extends IAppOpsService.Stub {
? opNames.toArray(new String[opNames.size()]) : null;
// Must not hold the appops lock
mHistoricalRegistry.getHistoricalOpsFromDiskRaw(uid, packageName, featureId, opNamesArray,
filter, beginTimeMillis, endTimeMillis, flags, callback);
mHandler.post(PooledLambda.obtainRunnable(HistoricalRegistry::getHistoricalOpsFromDiskRaw,
mHistoricalRegistry, uid, packageName, featureId, opNamesArray,
filter, beginTimeMillis, endTimeMillis, flags, callback).recycleOnUse());
}
@Override