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

Commit 871fa734 authored by Zoltan Szatmary-Ban's avatar Zoltan Szatmary-Ban
Browse files

Ensure notifications are sent when locking/unlocking location share

When the restriction 'DISALLOW_SHARE_LOCATION' is applied or removed on a user
it is important to send out notifications to content observers of
LOCATION_PROVIDERS_ALLOWED.

Bug: 18995405
Change-Id: I8b3910a423a012ea9d15470eec101723c9f0eaf7
parent 3379c1cb
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -4872,6 +4872,19 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    }
                }
                mUserManager.setUserRestriction(key, enabled, user);
                if (enabled != alreadyRestricted) {
                    if (UserManager.DISALLOW_SHARE_LOCATION.equals(key)) {
                        // Send out notifications however as some clients may want to reread the
                        // value which actually changed due to a restriction having been applied.
                        final String property = Settings.Secure.SYS_PROP_SETTING_VERSION;
                        long version = SystemProperties.getLong(property, 0) + 1;
                        SystemProperties.set(property, Long.toString(version));

                        final String name = Settings.Secure.LOCATION_PROVIDERS_ALLOWED;
                        Uri url = Uri.withAppendedPath(Settings.Secure.CONTENT_URI, name);
                        mContext.getContentResolver().notifyChange(url, null, true, userHandle);
                    }
                }
            } finally {
                restoreCallingIdentity(id);
            }