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

Commit 0dbcaedd authored by Jack Yu's avatar Jack Yu
Browse files

Grant AppOp fine location to data service dynamically

Fix: 169253540
Test: Manual
Change-Id: I418649c6f21fd930846e5ab6612b720306073614
parent 6eaa9f8d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -149,6 +149,8 @@ public class DataServiceManager extends Handler {
            TelephonyUtils.waitUntilReady(latch, CHANGE_PERMISSION_TIMEOUT_MS);
            mAppOps.setMode(AppOpsManager.OPSTR_MANAGE_IPSEC_TUNNELS,
                    UserHandle.myUserId(), pkgToGrant[0], AppOpsManager.MODE_ALLOWED);
            mAppOps.setMode(AppOpsManager.OPSTR_FINE_LOCATION,
                    UserHandle.myUserId(), pkgToGrant[0], AppOpsManager.MODE_ALLOWED);
        } catch (RuntimeException e) {
            loge("Binder to package manager died, permission grant for DataService failed.");
            throw e;
@@ -183,6 +185,8 @@ public class DataServiceManager extends Handler {
            for (String pkg : dataServices) {
                mAppOps.setMode(AppOpsManager.OPSTR_MANAGE_IPSEC_TUNNELS, UserHandle.myUserId(),
                        pkg, AppOpsManager.MODE_ERRORED);
                mAppOps.setMode(AppOpsManager.OPSTR_FINE_LOCATION, UserHandle.myUserId(),
                        pkg, AppOpsManager.MODE_ERRORED);
            }
        } catch (RuntimeException e) {
            loge("Binder to package manager died; failed to revoke DataService permissions.");