diff options
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 12 | ||||
-rw-r--r-- | core/java/android/app/assist/AssistStructure.java | 4 | ||||
-rw-r--r-- | core/java/android/content/pm/PackageManagerInternal.java | 14 | ||||
-rw-r--r-- | core/java/android/content/pm/ParceledListSlice.java | 5 | ||||
-rw-r--r-- | core/java/android/net/NetworkAgent.java | 21 | ||||
-rw-r--r-- | core/java/android/os/Environment.java | 3 | ||||
-rw-r--r-- | core/java/android/os/IBinder.java | 9 | ||||
-rw-r--r-- | core/java/android/os/storage/IMountService.java | 8 | ||||
-rw-r--r-- | core/java/android/os/storage/StorageManager.java | 11 | ||||
-rw-r--r-- | core/java/android/os/storage/VolumeInfo.java | 35 |
10 files changed, 104 insertions, 18 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 33cbc9d..b2b1727 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -690,7 +690,7 @@ public class DevicePolicyManager { = "android.app.extra.PROFILE_OWNER_NAME"; /** - * Activity action: send when any policy admin changes a policy. + * Broadcast action: send when any policy admin changes a policy. * This is generally used to find out when a new policy is in effect. * * @hide @@ -699,6 +699,16 @@ public class DevicePolicyManager { = "android.app.action.DEVICE_POLICY_MANAGER_STATE_CHANGED"; /** + * Broadcast action: sent when the device owner is set or changed. + * + * This broadcast is sent only to the primary user. + * @see #ACTION_PROVISION_MANAGED_DEVICE + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_DEVICE_OWNER_CHANGED + = "android.app.action.DEVICE_OWNER_CHANGED"; + + /** * The ComponentName of the administrator component. * * @see #ACTION_ADD_DEVICE_ADMIN diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java index ee0fc91..e08686c 100644 --- a/core/java/android/app/assist/AssistStructure.java +++ b/core/java/android/app/assist/AssistStructure.java @@ -141,10 +141,10 @@ public class AssistStructure implements Parcelable { if (DEBUG_PARCEL) Log.d(TAG, "Creating PooledStringWriter @ " + out.dataPosition()); PooledStringWriter pwriter = new PooledStringWriter(out); while (writeNextEntryToParcel(as, out, pwriter)) { - // If the parcel contains more than 100K of data, then we are getting too + // If the parcel is above the IPC limit, then we are getting too // large for a single IPC so stop here and let the caller come back when it // is ready for more. - if (out.dataSize() > 1024*1024) { + if (out.dataSize() > IBinder.MAX_IPC_SIZE) { if (DEBUG_PARCEL) Log.d(TAG, "Assist data size is " + out.dataSize() + " @ pos " + out.dataPosition() + "; returning partial result"); out.writeInt(0); diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java index ea08956..bf70d6c 100644 --- a/core/java/android/content/pm/PackageManagerInternal.java +++ b/core/java/android/content/pm/PackageManagerInternal.java @@ -83,6 +83,12 @@ public abstract class PackageManagerInternal { public abstract void setDialerAppPackagesProvider(PackagesProvider provider); /** + * Sets the sim call manager packages provider. + * @param provider The packages provider. + */ + public abstract void setSimCallManagerPackagesProvider(PackagesProvider provider); + + /** * Sets the sync adapter packages provider. * @param provider The provider. */ @@ -101,4 +107,12 @@ public abstract class PackageManagerInternal { * @param userId The user for which to grant the permissions. */ public abstract void grantDefaultPermissionsToDefaultDialerApp(String packageName, int userId); + + /** + * Requests granting of the default permissions to the current default sim call manager. + * @param packageName The default sim call manager package name. + * @param userId The user for which to grant the permissions. + */ + public abstract void grantDefaultPermissionsToDefaultSimCallManager(String packageName, + int userId); } diff --git a/core/java/android/content/pm/ParceledListSlice.java b/core/java/android/content/pm/ParceledListSlice.java index e5c2203..cfb4473 100644 --- a/core/java/android/content/pm/ParceledListSlice.java +++ b/core/java/android/content/pm/ParceledListSlice.java @@ -46,8 +46,7 @@ public class ParceledListSlice<T extends Parcelable> implements Parcelable { * TODO get this number from somewhere else. For now set it to a quarter of * the 1MB limit. */ - private static final int MAX_IPC_SIZE = 256 * 1024; - private static final int MAX_FIRST_IPC_SIZE = MAX_IPC_SIZE / 2; + private static final int MAX_IPC_SIZE = IBinder.MAX_IPC_SIZE; private final List<T> mList; @@ -150,7 +149,7 @@ public class ParceledListSlice<T extends Parcelable> implements Parcelable { final Class<?> listElementClass = mList.get(0).getClass(); dest.writeParcelableCreator(mList.get(0)); int i = 0; - while (i < N && dest.dataSize() < MAX_FIRST_IPC_SIZE) { + while (i < N && dest.dataSize() < MAX_IPC_SIZE) { dest.writeInt(1); final T parcelable = mList.get(i); diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java index e6fc1ea..808a882 100644 --- a/core/java/android/net/NetworkAgent.java +++ b/core/java/android/net/NetworkAgent.java @@ -148,6 +148,13 @@ public abstract class NetworkAgent extends Handler { */ public static final int CMD_REQUEST_BANDWIDTH_UPDATE = BASE + 10; + /** + * Sent by ConnectivityService to the NeworkAgent to inform the agent to avoid + * automatically reconnecting to this network (e.g. via autojoin). Happens + * when user selects "No" option on the "Stay connected?" dialog box. + */ + public static final int CMD_PREVENT_AUTOMATIC_RECONNECT = BASE + 11; + public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni, NetworkCapabilities nc, LinkProperties lp, int score) { this(looper, context, logTag, ni, nc, lp, score, null); @@ -240,6 +247,11 @@ public abstract class NetworkAgent extends Handler { } case CMD_SAVE_ACCEPT_UNVALIDATED: { saveAcceptUnvalidated(msg.arg1 != 0); + break; + } + case CMD_PREVENT_AUTOMATIC_RECONNECT: { + preventAutomaticReconnect(); + break; } } } @@ -365,6 +377,15 @@ public abstract class NetworkAgent extends Handler { protected void saveAcceptUnvalidated(boolean accept) { } + /** + * Called when the user asks to not stay connected to this network because it was found to not + * provide Internet access. Usually followed by call to {@code unwanted}. The transport is + * responsible for making sure the device does not automatically reconnect to the same network + * after the {@code unwanted} call. + */ + protected void preventAutomaticReconnect() { + } + protected void log(String s) { Log.d(LOG_TAG, "NetworkAgent: " + s); } diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java index 2080856..64d6da5 100644 --- a/core/java/android/os/Environment.java +++ b/core/java/android/os/Environment.java @@ -80,7 +80,8 @@ public class Environment { } public File[] getExternalDirs() { - final StorageVolume[] volumes = StorageManager.getVolumeList(mUserId); + final StorageVolume[] volumes = StorageManager.getVolumeList(mUserId, + StorageManager.FLAG_FOR_WRITE); final File[] files = new File[volumes.length]; for (int i = 0; i < volumes.length; i++) { files[i] = volumes[i].getPathFile(); diff --git a/core/java/android/os/IBinder.java b/core/java/android/os/IBinder.java index 73a0f65..2c21d13 100644 --- a/core/java/android/os/IBinder.java +++ b/core/java/android/os/IBinder.java @@ -149,7 +149,14 @@ public interface IBinder { * processes. */ int FLAG_ONEWAY = 0x00000001; - + + /** + * Limit that should be placed on IPC sizes to keep them safely under the + * transaction buffer limit. + * @hide + */ + public static final int MAX_IPC_SIZE = 64 * 1024; + /** * Get the canonical name of the interface supported by this binder. */ diff --git a/core/java/android/os/storage/IMountService.java b/core/java/android/os/storage/IMountService.java index c3b098b..fce09dd 100644 --- a/core/java/android/os/storage/IMountService.java +++ b/core/java/android/os/storage/IMountService.java @@ -758,7 +758,7 @@ public interface IMountService extends IInterface { return _result; } - public StorageVolume[] getVolumeList(int uid, String packageName) + public StorageVolume[] getVolumeList(int uid, String packageName, int flags) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); @@ -767,6 +767,7 @@ public interface IMountService extends IInterface { _data.writeInterfaceToken(DESCRIPTOR); _data.writeInt(uid); _data.writeString(packageName); + _data.writeInt(flags); mRemote.transact(Stub.TRANSACTION_getVolumeList, _data, _reply, 0); _reply.readException(); _result = _reply.createTypedArray(StorageVolume.CREATOR); @@ -1609,7 +1610,8 @@ public interface IMountService extends IInterface { data.enforceInterface(DESCRIPTOR); int uid = data.readInt(); String packageName = data.readString(); - StorageVolume[] result = getVolumeList(uid, packageName); + int _flags = data.readInt(); + StorageVolume[] result = getVolumeList(uid, packageName, _flags); reply.writeNoException(); reply.writeTypedArray(result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE); return true; @@ -2059,7 +2061,7 @@ public interface IMountService extends IInterface { /** * Returns list of all mountable volumes. */ - public StorageVolume[] getVolumeList(int uid, String packageName) throws RemoteException; + public StorageVolume[] getVolumeList(int uid, String packageName, int flags) throws RemoteException; /** * Gets the path on the filesystem for the ASEC container itself. diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index b2cec60..d1f3743 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -86,6 +86,9 @@ public class StorageManager { /** {@hide} */ public static final int DEBUG_FORCE_ADOPTABLE = 1 << 0; + /** {@hide} */ + public static final int FLAG_FOR_WRITE = 1 << 0; + private final Context mContext; private final ContentResolver mResolver; @@ -812,7 +815,7 @@ public class StorageManager { /** {@hide} */ public static @Nullable StorageVolume getStorageVolume(File file, int userId) { - return getStorageVolume(getVolumeList(userId), file); + return getStorageVolume(getVolumeList(userId, 0), file); } /** {@hide} */ @@ -852,11 +855,11 @@ public class StorageManager { /** {@hide} */ public @NonNull StorageVolume[] getVolumeList() { - return getVolumeList(mContext.getUserId()); + return getVolumeList(mContext.getUserId(), 0); } /** {@hide} */ - public static @NonNull StorageVolume[] getVolumeList(int userId) { + public static @NonNull StorageVolume[] getVolumeList(int userId, int flags) { final IMountService mountService = IMountService.Stub.asInterface( ServiceManager.getService("mount")); try { @@ -877,7 +880,7 @@ public class StorageManager { if (uid <= 0) { return new StorageVolume[0]; } - return mountService.getVolumeList(uid, packageName); + return mountService.getVolumeList(uid, packageName, flags); } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } diff --git a/core/java/android/os/storage/VolumeInfo.java b/core/java/android/os/storage/VolumeInfo.java index 8d603a1..ef54d84 100644 --- a/core/java/android/os/storage/VolumeInfo.java +++ b/core/java/android/os/storage/VolumeInfo.java @@ -46,6 +46,19 @@ import java.util.Objects; * Information about a storage volume that may be mounted. A volume may be a * partition on a physical {@link DiskInfo}, an emulated volume above some other * storage medium, or a standalone container like an ASEC or OBB. + * <p> + * Volumes may be mounted with various flags: + * <ul> + * <li>{@link #MOUNT_FLAG_PRIMARY} means the volume provides primary external + * storage, historically found at {@code /sdcard}. + * <li>{@link #MOUNT_FLAG_VISIBLE} means the volume is visible to third-party + * apps for direct filesystem access. The system should send out relevant + * storage broadcasts and index any media on visible volumes. Visible volumes + * are considered a more stable part of the device, which is why we take the + * time to index them. In particular, transient volumes like USB OTG devices + * <em>should not</em> be marked as visible; their contents should be surfaced + * to apps through the Storage Access Framework. + * </ul> * * @hide */ @@ -255,8 +268,23 @@ public class VolumeInfo implements Parcelable { return (mountFlags & MOUNT_FLAG_VISIBLE) != 0; } - public boolean isVisibleToUser(int userId) { - if (type == TYPE_PUBLIC && userId == this.mountUserId) { + public boolean isVisibleForRead(int userId) { + if (type == TYPE_PUBLIC) { + if (isPrimary() && mountUserId != userId) { + // Primary physical is only visible to single user + return false; + } else { + return isVisible(); + } + } else if (type == TYPE_EMULATED) { + return isVisible(); + } else { + return false; + } + } + + public boolean isVisibleForWrite(int userId) { + if (type == TYPE_PUBLIC && mountUserId == userId) { return isVisible(); } else if (type == TYPE_EMULATED) { return isVisible(); @@ -276,7 +304,7 @@ public class VolumeInfo implements Parcelable { public File getPathForUser(int userId) { if (path == null) { return null; - } else if (type == TYPE_PUBLIC && userId == this.mountUserId) { + } else if (type == TYPE_PUBLIC) { return new File(path); } else if (type == TYPE_EMULATED) { return new File(path, Integer.toString(userId)); @@ -306,6 +334,7 @@ public class VolumeInfo implements Parcelable { final boolean allowMassStorage = false; final String envState = reportUnmounted ? Environment.MEDIA_UNMOUNTED : getEnvironmentForState(state); + File userPath = getPathForUser(userId); if (userPath == null) { userPath = new File("/dev/null"); |