Merge "Show lockscreen widgets for the current user." into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
77e95d3d71
@@ -993,8 +993,8 @@ public class LockPatternUtils {
|
|||||||
* or null if there is no next alarm.
|
* or null if there is no next alarm.
|
||||||
*/
|
*/
|
||||||
public String getNextAlarm() {
|
public String getNextAlarm() {
|
||||||
String nextAlarm = Settings.System.getString(mContentResolver,
|
String nextAlarm = Settings.System.getStringForUser(mContentResolver,
|
||||||
Settings.System.NEXT_ALARM_FORMATTED);
|
Settings.System.NEXT_ALARM_FORMATTED, UserHandle.USER_CURRENT);
|
||||||
if (nextAlarm == null || TextUtils.isEmpty(nextAlarm)) {
|
if (nextAlarm == null || TextUtils.isEmpty(nextAlarm)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1021,8 +1021,9 @@ public class LockPatternUtils {
|
|||||||
|
|
||||||
public int[] getUserDefinedWidgets() {
|
public int[] getUserDefinedWidgets() {
|
||||||
int appWidgetId = -1;
|
int appWidgetId = -1;
|
||||||
String appWidgetIdString = Settings.Secure.getString(
|
String appWidgetIdString = Settings.Secure.getStringForUser(
|
||||||
mContentResolver, Settings.Secure.LOCK_SCREEN_USER_SELECTED_APPWIDGET_ID);
|
mContentResolver, Settings.Secure.LOCK_SCREEN_USER_SELECTED_APPWIDGET_ID,
|
||||||
|
UserHandle.USER_CURRENT);
|
||||||
if (appWidgetIdString != null) {
|
if (appWidgetIdString != null) {
|
||||||
appWidgetId = (int) Integer.decode(appWidgetIdString);
|
appWidgetId = (int) Integer.decode(appWidgetIdString);
|
||||||
}
|
}
|
||||||
@@ -1032,8 +1033,9 @@ public class LockPatternUtils {
|
|||||||
|
|
||||||
public int getStatusWidget() {
|
public int getStatusWidget() {
|
||||||
int appWidgetId = -1;
|
int appWidgetId = -1;
|
||||||
String appWidgetIdString = Settings.Secure.getString(
|
String appWidgetIdString = Settings.Secure.getStringForUser(
|
||||||
mContentResolver, Settings.Secure.LOCK_SCREEN_STATUS_APPWIDGET_ID);
|
mContentResolver, Settings.Secure.LOCK_SCREEN_STATUS_APPWIDGET_ID,
|
||||||
|
UserHandle.USER_CURRENT);
|
||||||
if (appWidgetIdString != null) {
|
if (appWidgetIdString != null) {
|
||||||
appWidgetId = (int) Integer.decode(appWidgetIdString);
|
appWidgetId = (int) Integer.decode(appWidgetIdString);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import libcore.util.MutableInt;
|
|||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
@@ -178,9 +179,10 @@ class KeyguardStatusViewManager {
|
|||||||
|
|
||||||
private void updateOwnerInfo() {
|
private void updateOwnerInfo() {
|
||||||
final ContentResolver res = getContext().getContentResolver();
|
final ContentResolver res = getContext().getContentResolver();
|
||||||
final boolean ownerInfoEnabled = Settings.Secure.getInt(res,
|
final boolean ownerInfoEnabled = Settings.Secure.getIntForUser(res,
|
||||||
Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED, 1) != 0;
|
Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED, 1, UserHandle.USER_CURRENT) != 0;
|
||||||
String text = Settings.Secure.getString(res, Settings.Secure.LOCK_SCREEN_OWNER_INFO);
|
String text = Settings.Secure.getStringForUser(res, Settings.Secure.LOCK_SCREEN_OWNER_INFO,
|
||||||
|
UserHandle.USER_CURRENT);
|
||||||
if (ownerInfoEnabled && !TextUtils.isEmpty(text)) {
|
if (ownerInfoEnabled && !TextUtils.isEmpty(text)) {
|
||||||
maybeSetUpperCaseText(mOwnerInfoView, text);
|
maybeSetUpperCaseText(mOwnerInfoView, text);
|
||||||
mOwnerInfoView.setVisibility(View.VISIBLE);
|
mOwnerInfoView.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.server;
|
package com.android.server;
|
||||||
|
|
||||||
|
import android.app.ActivityManagerNative;
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.appwidget.AppWidgetManager;
|
import android.appwidget.AppWidgetManager;
|
||||||
@@ -27,6 +28,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Binder;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
@@ -193,31 +195,44 @@ class AppWidgetService extends IAppWidgetService.Stub
|
|||||||
}, UserHandle.ALL, userFilter, null, null);
|
}, UserHandle.ALL, userFilter, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getCallingOrCurrentUserId() {
|
||||||
|
int callingUid = Binder.getCallingUid();
|
||||||
|
if (callingUid == android.os.Process.myUid()) {
|
||||||
|
try {
|
||||||
|
return ActivityManagerNative.getDefault().getCurrentUser().id;
|
||||||
|
} catch (RemoteException re) {
|
||||||
|
return UserHandle.getUserId(callingUid);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return UserHandle.getUserId(callingUid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int allocateAppWidgetId(String packageName, int hostId) throws RemoteException {
|
public int allocateAppWidgetId(String packageName, int hostId) throws RemoteException {
|
||||||
return getImplForUser(UserHandle.getCallingUserId()).allocateAppWidgetId(
|
return getImplForUser(getCallingOrCurrentUserId()).allocateAppWidgetId(
|
||||||
packageName, hostId);
|
packageName, hostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAppWidgetId(int appWidgetId) throws RemoteException {
|
public void deleteAppWidgetId(int appWidgetId) throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).deleteAppWidgetId(appWidgetId);
|
getImplForUser(getCallingOrCurrentUserId()).deleteAppWidgetId(appWidgetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteHost(int hostId) throws RemoteException {
|
public void deleteHost(int hostId) throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).deleteHost(hostId);
|
getImplForUser(getCallingOrCurrentUserId()).deleteHost(hostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAllHosts() throws RemoteException {
|
public void deleteAllHosts() throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).deleteAllHosts();
|
getImplForUser(getCallingOrCurrentUserId()).deleteAllHosts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindAppWidgetId(int appWidgetId, ComponentName provider, Bundle options)
|
public void bindAppWidgetId(int appWidgetId, ComponentName provider, Bundle options)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).bindAppWidgetId(appWidgetId, provider,
|
getImplForUser(getCallingOrCurrentUserId()).bindAppWidgetId(appWidgetId, provider,
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,34 +240,34 @@ class AppWidgetService extends IAppWidgetService.Stub
|
|||||||
public boolean bindAppWidgetIdIfAllowed(
|
public boolean bindAppWidgetIdIfAllowed(
|
||||||
String packageName, int appWidgetId, ComponentName provider, Bundle options)
|
String packageName, int appWidgetId, ComponentName provider, Bundle options)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
return getImplForUser(UserHandle.getCallingUserId()).bindAppWidgetIdIfAllowed(
|
return getImplForUser(getCallingOrCurrentUserId()).bindAppWidgetIdIfAllowed(
|
||||||
packageName, appWidgetId, provider, options);
|
packageName, appWidgetId, provider, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasBindAppWidgetPermission(String packageName) throws RemoteException {
|
public boolean hasBindAppWidgetPermission(String packageName) throws RemoteException {
|
||||||
return getImplForUser(UserHandle.getCallingUserId()).hasBindAppWidgetPermission(
|
return getImplForUser(getCallingOrCurrentUserId()).hasBindAppWidgetPermission(
|
||||||
packageName);
|
packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBindAppWidgetPermission(String packageName, boolean permission)
|
public void setBindAppWidgetPermission(String packageName, boolean permission)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).setBindAppWidgetPermission(
|
getImplForUser(getCallingOrCurrentUserId()).setBindAppWidgetPermission(
|
||||||
packageName, permission);
|
packageName, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindRemoteViewsService(int appWidgetId, Intent intent, IBinder connection)
|
public void bindRemoteViewsService(int appWidgetId, Intent intent, IBinder connection)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).bindRemoteViewsService(
|
getImplForUser(getCallingOrCurrentUserId()).bindRemoteViewsService(
|
||||||
appWidgetId, intent, connection);
|
appWidgetId, intent, connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] startListening(IAppWidgetHost host, String packageName, int hostId,
|
public int[] startListening(IAppWidgetHost host, String packageName, int hostId,
|
||||||
List<RemoteViews> updatedViews) throws RemoteException {
|
List<RemoteViews> updatedViews) throws RemoteException {
|
||||||
return getImplForUser(UserHandle.getCallingUserId()).startListening(host,
|
return getImplForUser(getCallingOrCurrentUserId()).startListening(host,
|
||||||
packageName, hostId, updatedViews);
|
packageName, hostId, updatedViews);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,27 +302,27 @@ class AppWidgetService extends IAppWidgetService.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getAppWidgetIds(ComponentName provider) throws RemoteException {
|
public int[] getAppWidgetIds(ComponentName provider) throws RemoteException {
|
||||||
return getImplForUser(UserHandle.getCallingUserId()).getAppWidgetIds(provider);
|
return getImplForUser(getCallingOrCurrentUserId()).getAppWidgetIds(provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId) throws RemoteException {
|
public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId) throws RemoteException {
|
||||||
return getImplForUser(UserHandle.getCallingUserId()).getAppWidgetInfo(appWidgetId);
|
return getImplForUser(getCallingOrCurrentUserId()).getAppWidgetInfo(appWidgetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RemoteViews getAppWidgetViews(int appWidgetId) throws RemoteException {
|
public RemoteViews getAppWidgetViews(int appWidgetId) throws RemoteException {
|
||||||
return getImplForUser(UserHandle.getCallingUserId()).getAppWidgetViews(appWidgetId);
|
return getImplForUser(getCallingOrCurrentUserId()).getAppWidgetViews(appWidgetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateAppWidgetOptions(int appWidgetId, Bundle options) {
|
public void updateAppWidgetOptions(int appWidgetId, Bundle options) {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).updateAppWidgetOptions(appWidgetId, options);
|
getImplForUser(getCallingOrCurrentUserId()).updateAppWidgetOptions(appWidgetId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bundle getAppWidgetOptions(int appWidgetId) {
|
public Bundle getAppWidgetOptions(int appWidgetId) {
|
||||||
return getImplForUser(UserHandle.getCallingUserId()).getAppWidgetOptions(appWidgetId);
|
return getImplForUser(getCallingOrCurrentUserId()).getAppWidgetOptions(appWidgetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int[] getAppWidgetIds(Provider p) {
|
static int[] getAppWidgetIds(Provider p) {
|
||||||
@@ -321,43 +336,43 @@ class AppWidgetService extends IAppWidgetService.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AppWidgetProviderInfo> getInstalledProviders() throws RemoteException {
|
public List<AppWidgetProviderInfo> getInstalledProviders() throws RemoteException {
|
||||||
return getImplForUser(UserHandle.getCallingUserId()).getInstalledProviders();
|
return getImplForUser(getCallingOrCurrentUserId()).getInstalledProviders();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, int viewId)
|
public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, int viewId)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).notifyAppWidgetViewDataChanged(
|
getImplForUser(getCallingOrCurrentUserId()).notifyAppWidgetViewDataChanged(
|
||||||
appWidgetIds, viewId);
|
appWidgetIds, viewId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void partiallyUpdateAppWidgetIds(int[] appWidgetIds, RemoteViews views)
|
public void partiallyUpdateAppWidgetIds(int[] appWidgetIds, RemoteViews views)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).partiallyUpdateAppWidgetIds(
|
getImplForUser(getCallingOrCurrentUserId()).partiallyUpdateAppWidgetIds(
|
||||||
appWidgetIds, views);
|
appWidgetIds, views);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopListening(int hostId) throws RemoteException {
|
public void stopListening(int hostId) throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).stopListening(hostId);
|
getImplForUser(getCallingOrCurrentUserId()).stopListening(hostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unbindRemoteViewsService(int appWidgetId, Intent intent) throws RemoteException {
|
public void unbindRemoteViewsService(int appWidgetId, Intent intent) throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).unbindRemoteViewsService(
|
getImplForUser(getCallingOrCurrentUserId()).unbindRemoteViewsService(
|
||||||
appWidgetId, intent);
|
appWidgetId, intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateAppWidgetIds(int[] appWidgetIds, RemoteViews views) throws RemoteException {
|
public void updateAppWidgetIds(int[] appWidgetIds, RemoteViews views) throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).updateAppWidgetIds(appWidgetIds, views);
|
getImplForUser(getCallingOrCurrentUserId()).updateAppWidgetIds(appWidgetIds, views);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateAppWidgetProvider(ComponentName provider, RemoteViews views)
|
public void updateAppWidgetProvider(ComponentName provider, RemoteViews views)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
getImplForUser(UserHandle.getCallingUserId()).updateAppWidgetProvider(provider, views);
|
getImplForUser(getCallingOrCurrentUserId()).updateAppWidgetProvider(provider, views);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user