Moving processing data received from Wellbeing to a supress-all block

Bug: 144927220
Change-Id: I25f02d5844b32abb73c2b4b6fcdaa68f438e6aa4
This commit is contained in:
vadimt
2019-12-06 11:08:56 -08:00
parent 39a7760ec9
commit c55f89c630
@@ -229,6 +229,31 @@ public final class WellbeingModel {
params.putInt(EXTRA_MAX_NUM_ACTIONS_SHOWN, 1);
// Perform wellbeing call .
remoteActionBundle = client.call(METHOD_GET_ACTIONS, null, params);
synchronized (mModelLock) {
// Remove the entries for requested packages, and then update the fist with what we
// got from service
Arrays.stream(packageNames).forEach(mPackageToActionId::remove);
// The result consists of sub-bundles, each one is per a remote action. Each
// sub-bundle has a RemoteAction and a list of packages to which the action applies.
for (String actionId :
remoteActionBundle.getStringArray(EXTRA_ACTIONS)) {
final Bundle actionBundle = remoteActionBundle.getBundle(actionId);
mActionIdMap.put(actionId,
actionBundle.getParcelable(EXTRA_ACTION));
final String[] packagesForAction =
actionBundle.getStringArray(EXTRA_PACKAGES);
if (DEBUG || mIsInTest) {
Log.d(TAG, "....actionId: " + actionId + ", packages: " + String.join(", ",
packagesForAction));
}
for (String packageName : packagesForAction) {
mPackageToActionId.put(packageName, actionId);
}
}
}
} catch (DeadObjectException e) {
Log.i(TAG, "retrieveActions(): DeadObjectException");
return false;
@@ -237,31 +262,6 @@ public final class WellbeingModel {
if (mIsInTest) throw new RuntimeException(e);
return true;
}
synchronized (mModelLock) {
// Remove the entries for requested packages, and then update the fist with what we
// got from service
Arrays.stream(packageNames).forEach(mPackageToActionId::remove);
// The result consists of sub-bundles, each one is per a remote action. Each sub-bundle
// has a RemoteAction and a list of packages to which the action applies.
for (String actionId :
remoteActionBundle.getStringArray(EXTRA_ACTIONS)) {
final Bundle actionBundle = remoteActionBundle.getBundle(actionId);
mActionIdMap.put(actionId,
actionBundle.getParcelable(EXTRA_ACTION));
final String[] packagesForAction =
actionBundle.getStringArray(EXTRA_PACKAGES);
if (DEBUG || mIsInTest) {
Log.d(TAG, "....actionId: " + actionId + ", packages: " + String.join(", ",
packagesForAction));
}
for (String packageName : packagesForAction) {
mPackageToActionId.put(packageName, actionId);
}
}
}
if (DEBUG || mIsInTest) Log.i(TAG, "retrieveActions(): finished");
return true;
}