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

Commit d6bad3e1 authored by Yuting's avatar Yuting
Browse files

[BugFix] Always include default device id when getting all device ids

mVirtualDeviceManagerInternal.getAllPersistentDeviceIds() only returns
external device ids which doesn't include the default device id.
Wherever we need all device ids we should not leave out the default
device id.

Bug: 339310095
Test: presubmit
Change-Id: Ib9df5c98634e9f06f0cd34c5b91afcf9171a5043
parent d10af358
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -1110,12 +1110,12 @@ public class AppOpsService extends IAppOpsService.Stub {
                        final String changedPkg = changedPkgs[i];
                        // We trust packagemanager to insert matching uid and packageNames in the
                        // extras
                        Set<String> devices;
                        if (mVirtualDeviceManagerInternal != null) {
                            devices = mVirtualDeviceManagerInternal.getAllPersistentDeviceIds();
                        } else {
                            devices = new ArraySet<>();
                        Set<String> devices = new ArraySet<>();
                        devices.add(PERSISTENT_DEVICE_ID_DEFAULT);

                        if (mVirtualDeviceManagerInternal != null) {
                            devices.addAll(
                                    mVirtualDeviceManagerInternal.getAllPersistentDeviceIds());
                        }
                        for (String device: devices) {
                            notifyOpChanged(onModeChangedListeners, code, changedUid, changedPkg,
@@ -2609,12 +2609,10 @@ public class AppOpsService extends IAppOpsService.Stub {
                ArrayList<ChangeRec> reports = ent.getValue();
                for (int i=0; i<reports.size(); i++) {
                    ChangeRec rep = reports.get(i);
                    Set<String> devices;
                    if (mVirtualDeviceManagerInternal != null) {
                        devices = mVirtualDeviceManagerInternal.getAllPersistentDeviceIds();
                    } else {
                        devices = new ArraySet<>();
                    Set<String> devices = new ArraySet<>();
                    devices.add(PERSISTENT_DEVICE_ID_DEFAULT);
                    if (mVirtualDeviceManagerInternal != null) {
                        devices.addAll(mVirtualDeviceManagerInternal.getAllPersistentDeviceIds());
                    }
                    for (String device: devices) {
                        mHandler.sendMessage(PooledLambda.obtainMessage(