From 73fd86eada856f29f1d262c54be5b0fcef8f8f42 Mon Sep 17 00:00:00 2001 From: Svet Ganov Date: Thu, 9 Jan 2020 20:26:14 -0800 Subject: [PATCH] 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 --- .../java/com/android/server/appop/AppOpsService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java index a7593c7a43ec6..e3b761e0773d4 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -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