* commit 'b685faa2cee2f8d74c82547fa7585027cbcfba5f': Implement #8323587, #8323342, #8323590: new features.
This commit is contained in:
@@ -6726,6 +6726,7 @@ package android.content.pm {
|
||||
field public static final int DONT_KILL_APP = 1; // 0x1
|
||||
field public static final java.lang.String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
|
||||
field public static final java.lang.String EXTRA_VERIFICATION_RESULT = "android.content.pm.extra.VERIFICATION_RESULT";
|
||||
field public static final java.lang.String FEATURE_APP_WIDGETS = "android.software.app_widgets";
|
||||
field public static final java.lang.String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
|
||||
field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
|
||||
field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera";
|
||||
@@ -6736,6 +6737,8 @@ package android.content.pm {
|
||||
field public static final java.lang.String FEATURE_FAKETOUCH = "android.hardware.faketouch";
|
||||
field public static final java.lang.String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
|
||||
field public static final java.lang.String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
|
||||
field public static final java.lang.String FEATURE_HOME_SCREEN = "android.software.home_screen";
|
||||
field public static final java.lang.String FEATURE_INPUT_METHODS = "android.software.input_methods";
|
||||
field public static final java.lang.String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
|
||||
field public static final java.lang.String FEATURE_LOCATION = "android.hardware.location";
|
||||
field public static final java.lang.String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
|
||||
|
||||
@@ -1143,6 +1143,29 @@ public abstract class PackageManager {
|
||||
@SdkConstant(SdkConstantType.FEATURE)
|
||||
public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
|
||||
|
||||
/**
|
||||
* Feature for {@link #getSystemAvailableFeatures} and
|
||||
* {@link #hasSystemFeature}: The device supports app widgets.
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.FEATURE)
|
||||
public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
|
||||
|
||||
/**
|
||||
* Feature for {@link #getSystemAvailableFeatures} and
|
||||
* {@link #hasSystemFeature}: The device supports a home screen that is replaceable
|
||||
* by third party applications.
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.FEATURE)
|
||||
public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
|
||||
|
||||
/**
|
||||
* Feature for {@link #getSystemAvailableFeatures} and
|
||||
* {@link #hasSystemFeature}: The device supports adding new input methods implemented
|
||||
* with the {@link android.inputmethodservice.InputMethodService} API.
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.FEATURE)
|
||||
public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
|
||||
|
||||
/**
|
||||
* Feature for {@link #getSystemAvailableFeatures} and
|
||||
* {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
|
||||
|
||||
@@ -177,18 +177,20 @@ class AppWidgetServiceImpl {
|
||||
// Manages persistent references to RemoteViewsServices from different App Widgets
|
||||
private final HashMap<FilterComparison, HashSet<Integer>> mRemoteViewsServicesAppWidgets = new HashMap<FilterComparison, HashSet<Integer>>();
|
||||
|
||||
Context mContext;
|
||||
final Context mContext;
|
||||
final IPackageManager mPm;
|
||||
final AlarmManager mAlarmManager;
|
||||
final ArrayList<Provider> mInstalledProviders = new ArrayList<Provider>();
|
||||
final int mUserId;
|
||||
final boolean mHasFeature;
|
||||
|
||||
Locale mLocale;
|
||||
IPackageManager mPm;
|
||||
AlarmManager mAlarmManager;
|
||||
ArrayList<Provider> mInstalledProviders = new ArrayList<Provider>();
|
||||
int mNextAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID + 1;
|
||||
final ArrayList<AppWidgetId> mAppWidgetIds = new ArrayList<AppWidgetId>();
|
||||
ArrayList<Host> mHosts = new ArrayList<Host>();
|
||||
final ArrayList<Host> mHosts = new ArrayList<Host>();
|
||||
// set of package names
|
||||
HashSet<String> mPackagesWithBindWidgetPermission = new HashSet<String>();
|
||||
final HashSet<String> mPackagesWithBindWidgetPermission = new HashSet<String>();
|
||||
boolean mSafeMode;
|
||||
int mUserId;
|
||||
boolean mStateLoaded;
|
||||
int mMaxWidgetBitmapMemory;
|
||||
|
||||
@@ -204,6 +206,8 @@ class AppWidgetServiceImpl {
|
||||
mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
|
||||
mUserId = userId;
|
||||
mSaveStateHandler = saveStateHandler;
|
||||
mHasFeature = context.getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_APP_WIDGETS);
|
||||
computeMaximumWidgetBitmapMemory();
|
||||
}
|
||||
|
||||
@@ -426,6 +430,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
private void ensureStateLoadedLocked() {
|
||||
if (!mStateLoaded) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
loadAppWidgetListLocked();
|
||||
loadStateLocked();
|
||||
mStateLoaded = true;
|
||||
@@ -435,6 +442,9 @@ class AppWidgetServiceImpl {
|
||||
public int allocateAppWidgetId(String packageName, int hostId) {
|
||||
int callingUid = enforceSystemOrCallingUid(packageName);
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return -1;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
int appWidgetId = mNextAppWidgetId++;
|
||||
|
||||
@@ -456,6 +466,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public void deleteAppWidgetId(int appWidgetId) {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
|
||||
if (id != null) {
|
||||
@@ -467,6 +480,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public void deleteHost(int hostId) {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
int callingUid = Binder.getCallingUid();
|
||||
Host host = lookupHostLocked(callingUid, hostId);
|
||||
@@ -479,6 +495,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public void deleteAllHosts() {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
int callingUid = Binder.getCallingUid();
|
||||
final int N = mHosts.size();
|
||||
@@ -561,6 +580,9 @@ class AppWidgetServiceImpl {
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
options = cloneIfLocalBinder(options);
|
||||
ensureStateLoadedLocked();
|
||||
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
|
||||
@@ -622,6 +644,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public boolean bindAppWidgetIdIfAllowed(
|
||||
String packageName, int appWidgetId, ComponentName provider, Bundle options) {
|
||||
if (!mHasFeature) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BIND_APPWIDGET, null);
|
||||
} catch (SecurityException se) {
|
||||
@@ -649,6 +674,9 @@ class AppWidgetServiceImpl {
|
||||
}
|
||||
|
||||
public boolean hasBindAppWidgetPermission(String packageName) {
|
||||
if (!mHasFeature) {
|
||||
return false;
|
||||
}
|
||||
mContext.enforceCallingPermission(
|
||||
android.Manifest.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS,
|
||||
"hasBindAppWidgetPermission packageName=" + packageName);
|
||||
@@ -660,6 +688,9 @@ class AppWidgetServiceImpl {
|
||||
}
|
||||
|
||||
public void setBindAppWidgetPermission(String packageName, boolean permission) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
mContext.enforceCallingPermission(
|
||||
android.Manifest.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS,
|
||||
"setBindAppWidgetPermission packageName=" + packageName);
|
||||
@@ -678,6 +709,9 @@ class AppWidgetServiceImpl {
|
||||
// Binds to a specific RemoteViewsService
|
||||
public void bindRemoteViewsService(int appWidgetId, Intent intent, IBinder connection) {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
|
||||
if (id == null) {
|
||||
@@ -735,6 +769,9 @@ class AppWidgetServiceImpl {
|
||||
// Unbinds from a specific RemoteViewsService
|
||||
public void unbindRemoteViewsService(int appWidgetId, Intent intent) {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
// Unbind from the RemoteViewsService (which will trigger a callback to the bound
|
||||
// RemoteViewsAdapter)
|
||||
@@ -846,6 +883,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId) {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return null;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
|
||||
if (id != null && id.provider != null && !id.provider.zombie) {
|
||||
@@ -858,6 +898,9 @@ class AppWidgetServiceImpl {
|
||||
public RemoteViews getAppWidgetViews(int appWidgetId) {
|
||||
if (DBG) log("getAppWidgetViews id=" + appWidgetId);
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return null;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
|
||||
if (id != null) {
|
||||
@@ -870,6 +913,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public List<AppWidgetProviderInfo> getInstalledProviders(int categoryFilter) {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return new ArrayList<AppWidgetProviderInfo>(0);
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
final int N = mInstalledProviders.size();
|
||||
ArrayList<AppWidgetProviderInfo> result = new ArrayList<AppWidgetProviderInfo>(N);
|
||||
@@ -884,6 +930,9 @@ class AppWidgetServiceImpl {
|
||||
}
|
||||
|
||||
public void updateAppWidgetIds(int[] appWidgetIds, RemoteViews views) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
if (appWidgetIds == null) {
|
||||
return;
|
||||
}
|
||||
@@ -929,6 +978,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public void updateAppWidgetOptions(int appWidgetId, Bundle options) {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
options = cloneIfLocalBinder(options);
|
||||
ensureStateLoadedLocked();
|
||||
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
|
||||
@@ -953,6 +1005,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public Bundle getAppWidgetOptions(int appWidgetId) {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return Bundle.EMPTY;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
|
||||
if (id != null && id.options != null) {
|
||||
@@ -964,6 +1019,9 @@ class AppWidgetServiceImpl {
|
||||
}
|
||||
|
||||
public void partiallyUpdateAppWidgetIds(int[] appWidgetIds, RemoteViews views) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
if (appWidgetIds == null) {
|
||||
return;
|
||||
}
|
||||
@@ -987,6 +1045,9 @@ class AppWidgetServiceImpl {
|
||||
}
|
||||
|
||||
public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, int viewId) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
if (appWidgetIds == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1005,6 +1066,9 @@ class AppWidgetServiceImpl {
|
||||
}
|
||||
|
||||
public void updateAppWidgetProvider(ComponentName provider, RemoteViews views) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
synchronized (mAppWidgetIds) {
|
||||
ensureStateLoadedLocked();
|
||||
Provider p = lookupProviderLocked(provider);
|
||||
@@ -1147,6 +1211,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public int[] startListening(IAppWidgetHost callbacks, String packageName, int hostId,
|
||||
List<RemoteViews> updatedViews) {
|
||||
if (!mHasFeature) {
|
||||
return new int[0];
|
||||
}
|
||||
int callingUid = enforceCallingUid(packageName);
|
||||
synchronized (mAppWidgetIds) {
|
||||
ensureStateLoadedLocked();
|
||||
@@ -1169,6 +1236,9 @@ class AppWidgetServiceImpl {
|
||||
|
||||
public void stopListening(int hostId) {
|
||||
synchronized (mAppWidgetIds) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
ensureStateLoadedLocked();
|
||||
Host host = lookupHostLocked(Binder.getCallingUid(), hostId);
|
||||
if (host != null) {
|
||||
@@ -1558,6 +1628,9 @@ class AppWidgetServiceImpl {
|
||||
}
|
||||
|
||||
void saveStateLocked() {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
AtomicFile file = savedStateFile();
|
||||
FileOutputStream stream;
|
||||
try {
|
||||
|
||||
@@ -164,6 +164,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
final SettingsObserver mSettingsObserver;
|
||||
final IWindowManager mIWindowManager;
|
||||
final HandlerCaller mCaller;
|
||||
final boolean mHasFeature;
|
||||
private InputMethodFileManager mFileManager;
|
||||
private InputMethodAndSubtypeListManager mImListManager;
|
||||
private final HardKeyboardListener mHardKeyboardListener;
|
||||
@@ -608,6 +609,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
}, true /*asyncHandler*/);
|
||||
mWindowManagerService = windowManager;
|
||||
mHardKeyboardListener = new HardKeyboardListener();
|
||||
mHasFeature = context.getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_INPUT_METHODS);
|
||||
|
||||
mImeSwitcherNotification = new Notification();
|
||||
mImeSwitcherNotification.icon = com.android.internal.R.drawable.ic_notification_ime_default;
|
||||
|
||||
Reference in New Issue
Block a user