diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/backup/BackupManager.java | 22 | ||||
| -rw-r--r-- | core/java/android/appwidget/AppWidgetProviderInfo.java | 15 | ||||
| -rw-r--r-- | core/java/android/os/UserManager.java | 22 | ||||
| -rw-r--r-- | core/java/android/provider/Settings.java | 30 |
4 files changed, 81 insertions, 8 deletions
diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java index e9297b9..1bb4eba 100644 --- a/core/java/android/app/backup/BackupManager.java +++ b/core/java/android/app/backup/BackupManager.java @@ -229,6 +229,28 @@ public class BackupManager { } /** + * Enable/disable data restore at application install time. When enabled, app + * installation will include an attempt to fetch the app's historical data from + * the archival restore dataset (if any). When disabled, no such attempt will + * be made. + * + * <p>Callers must hold the android.permission.BACKUP permission to use this method. + * + * @hide + */ + @SystemApi + public void setAutoRestore(boolean isEnabled) { + checkServiceBinder(); + if (sService != null) { + try { + sService.setAutoRestore(isEnabled); + } catch (RemoteException e) { + Log.e(TAG, "setAutoRestore() couldn't connect"); + } + } + } + + /** * Identify the currently selected transport. Callers must hold the * android.permission.BACKUP permission to use this method. * @return The name of the currently active backup transport. In case of diff --git a/core/java/android/appwidget/AppWidgetProviderInfo.java b/core/java/android/appwidget/AppWidgetProviderInfo.java index a767246..0b40e35 100644 --- a/core/java/android/appwidget/AppWidgetProviderInfo.java +++ b/core/java/android/appwidget/AppWidgetProviderInfo.java @@ -271,13 +271,13 @@ public class AppWidgetProviderInfo implements Parcelable { * @return The provider icon. */ public final Drawable loadIcon(@NonNull Context context, int density) { - return loadDrawable(context, density, providerInfo.getIconResource()); + return loadDrawable(context, density, providerInfo.getIconResource(), true); } /** * Loads a preview of what the AppWidget will look like after it's configured. - * If not supplied, the AppWidget's icon will be used. A client can optionally - * provide a desired deinsity such as {@link android.util.DisplayMetrics#DENSITY_LOW} + * A client can optionally provide a desired density such as + * {@link android.util.DisplayMetrics#DENSITY_LOW} * {@link android.util.DisplayMetrics#DENSITY_MEDIUM}, etc. If no density is * provided, the density of the current display will be used. * <p> @@ -288,10 +288,10 @@ public class AppWidgetProviderInfo implements Parcelable { * @param context Context for accessing resources. * @param density The optional desired density as per * {@link android.util.DisplayMetrics#densityDpi}. - * @return The widget preview image. + * @return The widget preview image or {@null} if preview image is not available. */ public final Drawable loadPreviewImage(@NonNull Context context, int density) { - return loadDrawable(context, density, previewImage); + return loadDrawable(context, density, previewImage, false); } /** @@ -361,7 +361,8 @@ public class AppWidgetProviderInfo implements Parcelable { return 0; } - private Drawable loadDrawable(Context context, int density, int resourceId) { + private Drawable loadDrawable(Context context, int density, int resourceId, + boolean loadDefaultIcon) { try { Resources resources = context.getPackageManager().getResourcesForApplication( providerInfo.applicationInfo); @@ -374,7 +375,7 @@ public class AppWidgetProviderInfo implements Parcelable { } catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) { /* ignore */ } - return providerInfo.loadIcon(context.getPackageManager()); + return loadDefaultIcon ? providerInfo.loadIcon(context.getPackageManager()) : null; } /** diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index f9e7b78..9d1a7bc 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -499,7 +499,12 @@ public class UserManager { * Sets all the user-wide restrictions for this user. * Requires the MANAGE_USERS permission. * @param restrictions the Bundle containing all the restrictions. + * @deprecated use {@link android.app.admin.DevicePolicyManager#addUserRestriction( + * android.content.ComponentName, String)} or + * {@link android.app.admin.DevicePolicyManager#clearUserRestriction( + * android.content.ComponentName, String)} instead. */ + @Deprecated public void setUserRestrictions(Bundle restrictions) { setUserRestrictions(restrictions, Process.myUserHandle()); } @@ -509,7 +514,12 @@ public class UserManager { * Requires the MANAGE_USERS permission. * @param restrictions the Bundle containing all the restrictions. * @param userHandle the UserHandle of the user for whom to set the restrictions. + * @deprecated use {@link android.app.admin.DevicePolicyManager#addUserRestriction( + * android.content.ComponentName, String)} or + * {@link android.app.admin.DevicePolicyManager#clearUserRestriction( + * android.content.ComponentName, String)} instead. */ + @Deprecated public void setUserRestrictions(Bundle restrictions, UserHandle userHandle) { try { mService.setUserRestrictions(restrictions, userHandle.getIdentifier()); @@ -523,7 +533,12 @@ public class UserManager { * Requires the MANAGE_USERS permission. * @param key the key of the restriction * @param value the value for the restriction + * @deprecated use {@link android.app.admin.DevicePolicyManager#addUserRestriction( + * android.content.ComponentName, String)} or + * {@link android.app.admin.DevicePolicyManager#clearUserRestriction( + * android.content.ComponentName, String)} instead. */ + @Deprecated public void setUserRestriction(String key, boolean value) { Bundle bundle = getUserRestrictions(); bundle.putBoolean(key, value); @@ -537,7 +552,12 @@ public class UserManager { * @param key the key of the restriction * @param value the value for the restriction * @param userHandle the user whose restriction is to be changed. + * @deprecated use {@link android.app.admin.DevicePolicyManager#addUserRestriction( + * android.content.ComponentName, String)} or + * {@link android.app.admin.DevicePolicyManager#clearUserRestriction( + * android.content.ComponentName, String)} instead. */ + @Deprecated public void setUserRestriction(String key, boolean value, UserHandle userHandle) { Bundle bundle = getUserRestrictions(userHandle); bundle.putBoolean(key, value); @@ -718,7 +738,7 @@ public class UserManager { /** * Returns list of the profiles of userHandle including * userHandle itself. - * Note that it this returns both enabled and not enabled profiles. See + * Note that this returns both enabled and not enabled profiles. See * {@link #getUserProfiles()} if you need only the enabled ones. * * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 8886559..c2a3012 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2667,6 +2667,16 @@ public final class Settings { }; /** + * These entries are considered common between the personal and the managed profile, + * since the managed profile doesn't get to change them. + * @hide + */ + public static final String[] CLONE_TO_MANAGED_PROFILE = { + DATE_FORMAT, + TIME_12_24 + }; + + /** * When to use Wi-Fi calling * * @see android.telephony.TelephonyManager.WifiCallingChoices @@ -4797,6 +4807,26 @@ public final class Settings { }; /** + * These entries are considered common between the personal and the managed profile, + * since the managed profile doesn't get to change them. + * @hide + */ + public static final String[] CLONE_TO_MANAGED_PROFILE = { + ACCESSIBILITY_ENABLED, + ALLOW_MOCK_LOCATION, + ALLOWED_GEOLOCATION_ORIGINS, + DEFAULT_INPUT_METHOD, + ENABLED_ACCESSIBILITY_SERVICES, + ENABLED_INPUT_METHODS, + LOCATION_MODE, + LOCATION_PROVIDERS_ALLOWED, + LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, + SELECTED_INPUT_METHOD_SUBTYPE, + SELECTED_SPELL_CHECKER, + SELECTED_SPELL_CHECKER_SUBTYPE + }; + + /** * Helper method for determining if a location provider is enabled. * * @param cr the content resolver to use |
