Fixes multiuser GNSS Bug.

Allows different users to use GNSS according to their permissions.

Change-Id: Id68537771f3f23111f2890e910c4e47386effe37
Fix: 131774255
Test: Built and flashed on device. Tested using GPS Test app.
This commit is contained in:
Tyler Trephan
2019-05-17 13:41:18 -07:00
parent e6ffb72e55
commit 037ef9d58a

View File

@@ -966,8 +966,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
}
private void updateEnabled() {
// Generally follow location setting
boolean enabled = mContext.getSystemService(LocationManager.class).isLocationEnabled();
// Generally follow location setting for current user
boolean enabled = mContext.getSystemService(LocationManager.class)
.isLocationEnabledForUser(UserHandle.CURRENT);
// ... but disable if PowerManager overrides
enabled &= !mDisableGpsForPowerManager;