Loading core/java/android/app/ContextImpl.java +13 −0 Original line number Diff line number Diff line Loading @@ -911,6 +911,19 @@ class ContextImpl extends Context { } } /** @hide */ @Override public void sendBroadcast(Intent intent, int userId) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.setAllowFds(false); ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, false, false, userId); } catch (RemoteException e) { } } @Override public void sendBroadcast(Intent intent, String receiverPermission) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); Loading core/java/android/content/Context.java +10 −0 Original line number Diff line number Diff line Loading @@ -904,6 +904,16 @@ public abstract class Context { */ public abstract void sendBroadcast(Intent intent); /** * Same as #sendBroadcast(Intent intent), but for a specific user. Used by the system only. * @param intent the intent to broadcast * @param userId user to send the intent to * @hide */ public void sendBroadcast(Intent intent, int userId) { throw new RuntimeException("Not implemented. Must override in a subclass."); } /** * Broadcast the given intent to all interested BroadcastReceivers, allowing * an optional required permission to be enforced. This Loading core/java/android/content/ContextWrapper.java +6 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,12 @@ public class ContextWrapper extends Context { mBase.sendBroadcast(intent); } /** @hide */ @Override public void sendBroadcast(Intent intent, int userId) { mBase.sendBroadcast(intent, userId); } @Override public void sendBroadcast(Intent intent, String receiverPermission) { mBase.sendBroadcast(intent, receiverPermission); Loading services/java/com/android/server/AppWidgetServiceImpl.java +6 −9 Original line number Diff line number Diff line Loading @@ -463,7 +463,7 @@ class AppWidgetServiceImpl { Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_DELETED); intent.setComponent(p.info.provider); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, id.appWidgetId); mContext.sendBroadcast(intent); mContext.sendBroadcast(intent, mUserId); if (p.instances.size() == 0) { // cancel the future updates cancelBroadcasts(p); Loading @@ -471,7 +471,7 @@ class AppWidgetServiceImpl { // send the broacast saying that the provider is not in use any more intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_DISABLED); intent.setComponent(p.info.provider); mContext.sendBroadcast(intent); mContext.sendBroadcast(intent, mUserId); } } } Loading Loading @@ -515,8 +515,6 @@ class AppWidgetServiceImpl { + " safe mode: " + provider); } Binder.restoreCallingIdentity(ident); id.provider = p; p.instances.add(id); int instancesSize = p.instances.size(); Loading Loading @@ -1066,7 +1064,7 @@ class AppWidgetServiceImpl { void sendEnableIntentLocked(Provider p) { Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_ENABLED); intent.setComponent(p.info.provider); mContext.sendBroadcast(intent); mContext.sendBroadcast(intent, mUserId); } void sendUpdateIntentLocked(Provider p, int[] appWidgetIds) { Loading @@ -1074,7 +1072,7 @@ class AppWidgetServiceImpl { Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds); intent.setComponent(p.info.provider); mContext.sendBroadcast(intent); mContext.sendBroadcast(intent, mUserId); } } Loading Loading @@ -1477,12 +1475,11 @@ class AppWidgetServiceImpl { } AtomicFile savedStateFile() { int userId = UserId.getCallingUserId(); File dir = new File("/data/system/users/" + userId); File dir = new File("/data/system/users/" + mUserId); File settingsFile = new File(dir, SETTINGS_FILENAME); if (!dir.exists()) { dir.mkdirs(); if (userId == 0) { if (mUserId == 0) { // Migrate old data File oldFile = new File("/data/system/" + SETTINGS_FILENAME); // Method doesn't throw an exception on failure. Ignore any errors Loading test-runner/src/android/test/mock/MockContext.java +6 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,12 @@ public class MockContext extends Context { throw new UnsupportedOperationException(); } /** @hide */ @Override public void sendBroadcast(Intent intent, int userId) { throw new UnsupportedOperationException(); } @Override public void sendBroadcast(Intent intent, String receiverPermission) { throw new UnsupportedOperationException(); Loading Loading
core/java/android/app/ContextImpl.java +13 −0 Original line number Diff line number Diff line Loading @@ -911,6 +911,19 @@ class ContextImpl extends Context { } } /** @hide */ @Override public void sendBroadcast(Intent intent, int userId) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); try { intent.setAllowFds(false); ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(), intent, resolvedType, null, Activity.RESULT_OK, null, null, null, false, false, userId); } catch (RemoteException e) { } } @Override public void sendBroadcast(Intent intent, String receiverPermission) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); Loading
core/java/android/content/Context.java +10 −0 Original line number Diff line number Diff line Loading @@ -904,6 +904,16 @@ public abstract class Context { */ public abstract void sendBroadcast(Intent intent); /** * Same as #sendBroadcast(Intent intent), but for a specific user. Used by the system only. * @param intent the intent to broadcast * @param userId user to send the intent to * @hide */ public void sendBroadcast(Intent intent, int userId) { throw new RuntimeException("Not implemented. Must override in a subclass."); } /** * Broadcast the given intent to all interested BroadcastReceivers, allowing * an optional required permission to be enforced. This Loading
core/java/android/content/ContextWrapper.java +6 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,12 @@ public class ContextWrapper extends Context { mBase.sendBroadcast(intent); } /** @hide */ @Override public void sendBroadcast(Intent intent, int userId) { mBase.sendBroadcast(intent, userId); } @Override public void sendBroadcast(Intent intent, String receiverPermission) { mBase.sendBroadcast(intent, receiverPermission); Loading
services/java/com/android/server/AppWidgetServiceImpl.java +6 −9 Original line number Diff line number Diff line Loading @@ -463,7 +463,7 @@ class AppWidgetServiceImpl { Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_DELETED); intent.setComponent(p.info.provider); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, id.appWidgetId); mContext.sendBroadcast(intent); mContext.sendBroadcast(intent, mUserId); if (p.instances.size() == 0) { // cancel the future updates cancelBroadcasts(p); Loading @@ -471,7 +471,7 @@ class AppWidgetServiceImpl { // send the broacast saying that the provider is not in use any more intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_DISABLED); intent.setComponent(p.info.provider); mContext.sendBroadcast(intent); mContext.sendBroadcast(intent, mUserId); } } } Loading Loading @@ -515,8 +515,6 @@ class AppWidgetServiceImpl { + " safe mode: " + provider); } Binder.restoreCallingIdentity(ident); id.provider = p; p.instances.add(id); int instancesSize = p.instances.size(); Loading Loading @@ -1066,7 +1064,7 @@ class AppWidgetServiceImpl { void sendEnableIntentLocked(Provider p) { Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_ENABLED); intent.setComponent(p.info.provider); mContext.sendBroadcast(intent); mContext.sendBroadcast(intent, mUserId); } void sendUpdateIntentLocked(Provider p, int[] appWidgetIds) { Loading @@ -1074,7 +1072,7 @@ class AppWidgetServiceImpl { Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds); intent.setComponent(p.info.provider); mContext.sendBroadcast(intent); mContext.sendBroadcast(intent, mUserId); } } Loading Loading @@ -1477,12 +1475,11 @@ class AppWidgetServiceImpl { } AtomicFile savedStateFile() { int userId = UserId.getCallingUserId(); File dir = new File("/data/system/users/" + userId); File dir = new File("/data/system/users/" + mUserId); File settingsFile = new File(dir, SETTINGS_FILENAME); if (!dir.exists()) { dir.mkdirs(); if (userId == 0) { if (mUserId == 0) { // Migrate old data File oldFile = new File("/data/system/" + SETTINGS_FILENAME); // Method doesn't throw an exception on failure. Ignore any errors Loading
test-runner/src/android/test/mock/MockContext.java +6 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,12 @@ public class MockContext extends Context { throw new UnsupportedOperationException(); } /** @hide */ @Override public void sendBroadcast(Intent intent, int userId) { throw new UnsupportedOperationException(); } @Override public void sendBroadcast(Intent intent, String receiverPermission) { throw new UnsupportedOperationException(); Loading