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

Commit 4bbb741c authored by Shashank Mittal's avatar Shashank Mittal Committed by Steve Kondik
Browse files

LocationServiceManager: Handle MODE_ASK in location service.

AppOps CheckOp can return MODE_ASK.
Fix location manager service to handle this new mode.

Change-Id: I085f01e992f60456ad24921bf4ce508ece54e8a6
parent 1d2f5e2d
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -773,8 +776,11 @@ public class LocationManagerService extends ILocationManager.Stub {
                            == AppOpsManager.MODE_ALLOWED;
                }
            } else {
                if (!allowMonitoring || mAppOps.checkOpNoThrow(op, mUid, mPackageName)
                        != AppOpsManager.MODE_ALLOWED) {
                int mode =  mAppOps.checkOpNoThrow(op, mUid, mPackageName);
                if (allowMonitoring && mode == AppOpsManager.MODE_ASK) {
                    return true;
                }
                if (!allowMonitoring || mode != AppOpsManager.MODE_ALLOWED) {
                    mAppOps.finishOp(op, mUid, mPackageName);
                    return false;
                }
@@ -1176,7 +1182,8 @@ public class LocationManagerService extends ILocationManager.Stub {
    boolean checkLocationAccess(int uid, String packageName, int allowedResolutionLevel) {
        int op = resolutionLevelToOp(allowedResolutionLevel);
        if (op >= 0) {
            if (mAppOps.checkOp(op, uid, packageName) != AppOpsManager.MODE_ALLOWED) {
            int mode = mAppOps.checkOp(op, uid, packageName);
            if (mode != AppOpsManager.MODE_ALLOWED && mode != AppOpsManager.MODE_ASK) {
                return false;
            }
        }