Merge "Process user events from service lifecycle callbacks." into nyc-dev
This commit is contained in:
@@ -44,4 +44,19 @@ public class AppWidgetService extends SystemService {
|
|||||||
mImpl.setSafeMode(isSafeMode());
|
mImpl.setSafeMode(isSafeMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUnlockUser(int userHandle) {
|
||||||
|
mImpl.onUserUnlocked(userHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopUser(int userHandle) {
|
||||||
|
mImpl.onUserStopped(userHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSwitchUser(int userHandle) {
|
||||||
|
mImpl.reloadWidgetsMaskedStateForGroup(userHandle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,12 +158,6 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
|||||||
|
|
||||||
if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
|
if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
|
||||||
onConfigurationChanged();
|
onConfigurationChanged();
|
||||||
} else if (Intent.ACTION_USER_UNLOCKED.equals(action)) {
|
|
||||||
onUserUnlocked(userId);
|
|
||||||
} else if (Intent.ACTION_USER_STOPPED.equals(action)) {
|
|
||||||
onUserStopped(userId);
|
|
||||||
} else if (Intent.ACTION_USER_SWITCHED.equals(action)) {
|
|
||||||
reloadWidgetsMaskedStateForGroup(userId);
|
|
||||||
} else if (Intent.ACTION_MANAGED_PROFILE_AVAILABLE.equals(action)
|
} else if (Intent.ACTION_MANAGED_PROFILE_AVAILABLE.equals(action)
|
||||||
|| Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action)) {
|
|| Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action)) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
@@ -281,13 +275,6 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
|||||||
mContext.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL,
|
mContext.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL,
|
||||||
sdFilter, null, null);
|
sdFilter, null, null);
|
||||||
|
|
||||||
IntentFilter userFilter = new IntentFilter();
|
|
||||||
userFilter.addAction(Intent.ACTION_USER_UNLOCKED);
|
|
||||||
userFilter.addAction(Intent.ACTION_USER_STOPPED);
|
|
||||||
userFilter.addAction(Intent.ACTION_USER_SWITCHED);
|
|
||||||
mContext.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL,
|
|
||||||
userFilter, null, null);
|
|
||||||
|
|
||||||
IntentFilter offModeFilter = new IntentFilter();
|
IntentFilter offModeFilter = new IntentFilter();
|
||||||
offModeFilter.addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABLE);
|
offModeFilter.addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABLE);
|
||||||
offModeFilter.addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE);
|
offModeFilter.addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE);
|
||||||
@@ -454,7 +441,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
|||||||
* due to user not being available and package suspension.
|
* due to user not being available and package suspension.
|
||||||
* userId must be the group parent.
|
* userId must be the group parent.
|
||||||
*/
|
*/
|
||||||
private void reloadWidgetsMaskedStateForGroup(int userId) {
|
void reloadWidgetsMaskedStateForGroup(int userId) {
|
||||||
if (!mUserManager.isUserUnlockingOrUnlocked(userId)) {
|
if (!mUserManager.isUserUnlockingOrUnlocked(userId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2525,7 +2512,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onUserUnlocked(int userId) {
|
void onUserUnlocked(int userId) {
|
||||||
if (isProfileWithLockedParent(userId)) {
|
if (isProfileWithLockedParent(userId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3072,7 +3059,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
|||||||
return new AtomicFile(settingsFile);
|
return new AtomicFile(settingsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onUserStopped(int userId) {
|
void onUserStopped(int userId) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
boolean crossProfileWidgetsChanged = false;
|
boolean crossProfileWidgetsChanged = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user