Merge "Import translations. DO NOT MERGE"
diff --git a/Android.mk b/Android.mk
index cd738e7..552103d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -245,9 +245,9 @@
core/java/android/os/IUpdateLock.aidl \
core/java/android/os/IUserManager.aidl \
core/java/android/os/IVibratorService.aidl \
- core/java/android/os/storage/IMountService.aidl \
- core/java/android/os/storage/IMountServiceListener.aidl \
- core/java/android/os/storage/IMountShutdownObserver.aidl \
+ core/java/android/os/storage/IStorageManager.aidl \
+ core/java/android/os/storage/IStorageEventListener.aidl \
+ core/java/android/os/storage/IStorageShutdownObserver.aidl \
core/java/android/os/storage/IObbActionListener.aidl \
core/java/android/security/IKeystoreService.aidl \
core/java/android/security/keymaster/IKeyAttestationApplicationIdProvider.aidl \
diff --git a/CleanSpec.mk b/CleanSpec.mk
index cee8fdb..71e6af7 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -241,6 +241,7 @@
$(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/APPS/FeatureSplit1_intermediates/src/com/android/test/split/feature/R.java)
$(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/APPS/FeatureSplit2_intermediates/src/com/android/test/split/feature/R.java)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/hardware)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/core/java/android/os/storage/*)
# ******************************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
diff --git a/api/current.txt b/api/current.txt
index 2989145..f585901 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3892,6 +3892,7 @@
public class ActivityOptions {
method public android.graphics.Rect getLaunchBounds();
+ method public int getLaunchDisplayId();
method public static android.app.ActivityOptions makeBasic();
method public static android.app.ActivityOptions makeClipRevealAnimation(android.view.View, int, int, int, int);
method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int);
@@ -3902,6 +3903,7 @@
method public static android.app.ActivityOptions makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int);
method public void requestUsageTimeReport(android.app.PendingIntent);
method public android.app.ActivityOptions setLaunchBounds(android.graphics.Rect);
+ method public android.app.ActivityOptions setLaunchDisplayId(int);
method public android.os.Bundle toBundle();
method public void update(android.app.ActivityOptions);
field public static final java.lang.String EXTRA_USAGE_TIME_REPORT = "android.activity.usage_time";
@@ -7906,6 +7908,7 @@
method public android.content.res.AssetFileDescriptor openTypedAssetFile(android.net.Uri, java.lang.String, android.os.Bundle, android.os.CancellationSignal) throws java.io.FileNotFoundException;
method public abstract android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal);
+ method public boolean refresh(android.net.Uri, android.os.Bundle, android.os.CancellationSignal);
method protected final void setPathPermissions(android.content.pm.PathPermission[]);
method protected final void setReadPermission(java.lang.String);
method protected final void setWritePermission(java.lang.String);
@@ -8039,6 +8042,7 @@
method public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(android.net.Uri, java.lang.String, android.os.Bundle, android.os.CancellationSignal) throws java.io.FileNotFoundException;
method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal);
+ method public final boolean refresh(android.net.Uri, android.os.Bundle, android.os.CancellationSignal);
method public final void registerContentObserver(android.net.Uri, boolean, android.database.ContentObserver);
method public void releasePersistableUriPermission(android.net.Uri, int);
method public static void removePeriodicSync(android.accounts.Account, java.lang.String, android.os.Bundle);
diff --git a/api/system-current.txt b/api/system-current.txt
index ab5acf5..0314b54 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4024,6 +4024,7 @@
public class ActivityOptions {
method public android.graphics.Rect getLaunchBounds();
+ method public int getLaunchDisplayId();
method public static android.app.ActivityOptions makeBasic();
method public static android.app.ActivityOptions makeClipRevealAnimation(android.view.View, int, int, int, int);
method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int);
@@ -4034,6 +4035,7 @@
method public static android.app.ActivityOptions makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int);
method public void requestUsageTimeReport(android.app.PendingIntent);
method public android.app.ActivityOptions setLaunchBounds(android.graphics.Rect);
+ method public android.app.ActivityOptions setLaunchDisplayId(int);
method public android.os.Bundle toBundle();
method public void update(android.app.ActivityOptions);
field public static final java.lang.String EXTRA_USAGE_TIME_REPORT = "android.activity.usage_time";
@@ -8238,6 +8240,7 @@
method public android.content.res.AssetFileDescriptor openTypedAssetFile(android.net.Uri, java.lang.String, android.os.Bundle, android.os.CancellationSignal) throws java.io.FileNotFoundException;
method public abstract android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal);
+ method public boolean refresh(android.net.Uri, android.os.Bundle, android.os.CancellationSignal);
method protected final void setPathPermissions(android.content.pm.PathPermission[]);
method protected final void setReadPermission(java.lang.String);
method protected final void setWritePermission(java.lang.String);
@@ -8371,6 +8374,7 @@
method public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(android.net.Uri, java.lang.String, android.os.Bundle, android.os.CancellationSignal) throws java.io.FileNotFoundException;
method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal);
+ method public final boolean refresh(android.net.Uri, android.os.Bundle, android.os.CancellationSignal);
method public final void registerContentObserver(android.net.Uri, boolean, android.database.ContentObserver);
method public void releasePersistableUriPermission(android.net.Uri, int);
method public static void removePeriodicSync(android.accounts.Account, java.lang.String, android.os.Bundle);
diff --git a/api/test-current.txt b/api/test-current.txt
index 76af8c5..092affc 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -3901,6 +3901,7 @@
public class ActivityOptions {
method public android.graphics.Rect getLaunchBounds();
+ method public int getLaunchDisplayId();
method public static android.app.ActivityOptions makeBasic();
method public static android.app.ActivityOptions makeClipRevealAnimation(android.view.View, int, int, int, int);
method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int);
@@ -3911,6 +3912,7 @@
method public static android.app.ActivityOptions makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int);
method public void requestUsageTimeReport(android.app.PendingIntent);
method public android.app.ActivityOptions setLaunchBounds(android.graphics.Rect);
+ method public android.app.ActivityOptions setLaunchDisplayId(int);
method public void setLaunchStackId(int);
method public android.os.Bundle toBundle();
method public void update(android.app.ActivityOptions);
@@ -7922,6 +7924,7 @@
method public android.content.res.AssetFileDescriptor openTypedAssetFile(android.net.Uri, java.lang.String, android.os.Bundle, android.os.CancellationSignal) throws java.io.FileNotFoundException;
method public abstract android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal);
+ method public boolean refresh(android.net.Uri, android.os.Bundle, android.os.CancellationSignal);
method protected final void setPathPermissions(android.content.pm.PathPermission[]);
method protected final void setReadPermission(java.lang.String);
method protected final void setWritePermission(java.lang.String);
@@ -8056,6 +8059,7 @@
method public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(android.net.Uri, java.lang.String, android.os.Bundle, android.os.CancellationSignal) throws java.io.FileNotFoundException;
method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal);
+ method public final boolean refresh(android.net.Uri, android.os.Bundle, android.os.CancellationSignal);
method public final void registerContentObserver(android.net.Uri, boolean, android.database.ContentObserver);
method public void releasePersistableUriPermission(android.net.Uri, int);
method public static void removePeriodicSync(android.accounts.Account, java.lang.String, android.os.Bundle);
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java
index d527ad7..4291c77 100644
--- a/cmds/sm/src/com/android/commands/sm/Sm.java
+++ b/cmds/sm/src/com/android/commands/sm/Sm.java
@@ -20,7 +20,7 @@
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.storage.DiskInfo;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.util.Log;
@@ -28,7 +28,7 @@
public final class Sm {
private static final String TAG = "Sm";
- IMountService mSm;
+ IStorageManager mSm;
private String[] mArgs;
private int mNextArg;
@@ -55,7 +55,7 @@
throw new IllegalArgumentException();
}
- mSm = IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ mSm = IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
if (mSm == null) {
throw new RemoteException("Failed to find running mount service");
}
diff --git a/compiled-classes-phone b/compiled-classes-phone
index 03b5684..f09bad9 100644
--- a/compiled-classes-phone
+++ b/compiled-classes-phone
@@ -3223,17 +3223,17 @@
android.os.health.SystemHealthManager
android.os.storage.DiskInfo
android.os.storage.DiskInfo$1
-android.os.storage.IMountService
-android.os.storage.IMountService$Stub
-android.os.storage.IMountService$Stub$Proxy
-android.os.storage.IMountServiceListener
-android.os.storage.IMountServiceListener$Stub
-android.os.storage.IMountServiceListener$Stub$Proxy
-android.os.storage.IMountShutdownObserver
+android.os.storage.IStorageManager
+android.os.storage.IStorageManager$Stub
+android.os.storage.IStorageManager$Stub$Proxy
+android.os.storage.IStorageEventListener
+android.os.storage.IStorageEventListener$Stub
+android.os.storage.IStorageEventListener$Stub$Proxy
+android.os.storage.IStorageShutdownObserver
android.os.storage.IObbActionListener
android.os.storage.IObbActionListener$Stub
-android.os.storage.MountServiceInternal
-android.os.storage.MountServiceInternal$ExternalStorageMountPolicy
+android.os.storage.StorageManagerInternal
+android.os.storage.StorageManagerInternal$ExternalStorageMountPolicy
android.os.storage.StorageEventListener
android.os.storage.StorageManager
android.os.storage.StorageManager$ObbActionListener
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index d9a4690..1e7f4f0 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -18,6 +18,7 @@
import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
+import static android.view.Display.INVALID_DISPLAY;
import android.annotation.Nullable;
import android.annotation.TestApi;
@@ -152,6 +153,12 @@
private static final String KEY_ANIM_SPECS = "android:activity.animSpecs";
/**
+ * The display id the activity should be launched into.
+ * @hide
+ */
+ private static final String KEY_LAUNCH_DISPLAY_ID = "android.activity.launchDisplayId";
+
+ /**
* The stack id the activity should be launched into.
* @hide
*/
@@ -240,6 +247,7 @@
private int mResultCode;
private int mExitCoordinatorIndex;
private PendingIntent mUsageTimeReport;
+ private int mLaunchDisplayId = INVALID_DISPLAY;
private int mLaunchStackId = INVALID_STACK_ID;
private int mLaunchTaskId = -1;
private int mDockCreateMode = DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
@@ -850,6 +858,7 @@
mExitCoordinatorIndex = opts.getInt(KEY_EXIT_COORDINATOR_INDEX);
break;
}
+ mLaunchDisplayId = opts.getInt(KEY_LAUNCH_DISPLAY_ID, INVALID_DISPLAY);
mLaunchStackId = opts.getInt(KEY_LAUNCH_STACK_ID, INVALID_STACK_ID);
mLaunchTaskId = opts.getInt(KEY_LAUNCH_TASK_ID, -1);
mTaskOverlay = opts.getBoolean(KEY_TASK_OVERLAY, false);
@@ -1015,6 +1024,25 @@
}
}
+ /**
+ * Gets the id of the display where activity should be launched.
+ * @return The id of the display where activity should be launched,
+ * {@link android.view.Display#INVALID_DISPLAY} if not set.
+ */
+ public int getLaunchDisplayId() {
+ return mLaunchDisplayId;
+ }
+
+ /**
+ * Sets the id of the display where activity should be launched.
+ * @param launchDisplayId The id of the display where the activity should be launched.
+ * @return {@code this} {@link ActivityOptions} instance.
+ */
+ public ActivityOptions setLaunchDisplayId(int launchDisplayId) {
+ mLaunchDisplayId = launchDisplayId;
+ return this;
+ }
+
/** @hide */
public int getLaunchStackId() {
return mLaunchStackId;
@@ -1209,6 +1237,7 @@
b.putInt(KEY_EXIT_COORDINATOR_INDEX, mExitCoordinatorIndex);
break;
}
+ b.putInt(KEY_LAUNCH_DISPLAY_ID, mLaunchDisplayId);
b.putInt(KEY_LAUNCH_STACK_ID, mLaunchStackId);
b.putInt(KEY_LAUNCH_TASK_ID, mLaunchTaskId);
b.putBoolean(KEY_TASK_OVERLAY, mTaskOverlay);
diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java
index 6b16e8f..e222fee 100644
--- a/core/java/android/app/BackStackRecord.java
+++ b/core/java/android/app/BackStackRecord.java
@@ -764,7 +764,7 @@
}
if (!mAllowOptimization) {
// Added fragments are added at the end to comply with prior behavior.
- mManager.moveToState(mManager.mCurState);
+ mManager.moveToState(mManager.mCurState, true);
}
}
@@ -810,7 +810,7 @@
}
}
if (!mAllowOptimization) {
- mManager.moveToState(mManager.mCurState);
+ mManager.moveToState(mManager.mCurState, true);
}
}
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 970e9ac..827e026 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -61,7 +61,7 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
@@ -2213,10 +2213,11 @@
if (!dir.exists()) {
// Failing to mkdir() may be okay, since we might not have
// enough permissions; ask vold to create on our behalf.
- final IMountService mount = IMountService.Stub.asInterface(
+ final IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
try {
- final int res = mount.mkdirs(getPackageName(), dir.getAbsolutePath());
+ final int res = storageManager.mkdirs(
+ getPackageName(), dir.getAbsolutePath());
if (res != 0) {
Log.w(TAG, "Failed to ensure " + dir + ": " + res);
dir = null;
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index 5a2c5e7..07ef136 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -1445,11 +1445,24 @@
}
}
- void moveToState(int newState) {
+ /**
+ * Changes the state of the fragment manager to {@code newState}. If the fragment manager
+ * changes state or {@code always} is {@code true}, any fragments within it have their
+ * states updated as well.
+ *
+ * @param newState The new state for the fragment manager
+ * @param always If {@code true}, all fragments update their state, even
+ * if {@code newState} matches the current fragment manager's state.
+ */
+ void moveToState(int newState, boolean always) {
if (mHost == null && newState != Fragment.INITIALIZING) {
throw new IllegalStateException("No activity");
}
+ if (!always && mCurState == newState) {
+ return;
+ }
+
mCurState = newState;
if (mActive != null) {
@@ -2024,7 +2037,7 @@
// need to run something now
FragmentTransition.startTransitions(this, records, isRecordPop, startIndex,
postponeIndex, true);
- moveToState(mCurState);
+ moveToState(mCurState, true);
}
for (int recordNum = startIndex; recordNum < endIndex; recordNum++) {
@@ -2117,7 +2130,7 @@
FragmentTransition.startTransitions(this, records, isRecordPop, 0, 1, true);
}
if (moveToState) {
- moveToState(mCurState);
+ moveToState(mCurState, true);
} else if (mActive != null) {
final int numActive = mActive.size();
for (int i = 0; i < numActive; i++) {
@@ -2691,40 +2704,40 @@
public void dispatchCreate() {
mStateSaved = false;
- moveToState(Fragment.CREATED);
+ moveToState(Fragment.CREATED, false);
}
public void dispatchActivityCreated() {
mStateSaved = false;
- moveToState(Fragment.ACTIVITY_CREATED);
+ moveToState(Fragment.ACTIVITY_CREATED, false);
}
public void dispatchStart() {
mStateSaved = false;
- moveToState(Fragment.STARTED);
+ moveToState(Fragment.STARTED, false);
}
public void dispatchResume() {
mStateSaved = false;
- moveToState(Fragment.RESUMED);
+ moveToState(Fragment.RESUMED, false);
}
public void dispatchPause() {
- moveToState(Fragment.STARTED);
+ moveToState(Fragment.STARTED, false);
}
public void dispatchStop() {
- moveToState(Fragment.STOPPED);
+ moveToState(Fragment.STOPPED, false);
}
public void dispatchDestroyView() {
- moveToState(Fragment.CREATED);
+ moveToState(Fragment.CREATED, false);
}
public void dispatchDestroy() {
mDestroyed = true;
execPendingActions();
- moveToState(Fragment.INITIALIZING);
+ moveToState(Fragment.INITIALIZING, false);
mHost = null;
mContainer = null;
mParent = null;
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index 49b5853..f369409 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -1131,7 +1131,6 @@
* {@link CancellationSignal#throwIfCanceled()} to check whether the client has
* canceled the refresh request.
* @return true if the provider actually tried refreshing.
- * @hide
*/
public boolean refresh(Uri uri, @Nullable Bundle args,
@Nullable CancellationSignal cancellationSignal) {
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index d7f6833..54dcd0a 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -673,19 +673,13 @@
}
/**
- * Implement this to support refresh of content identified by {@code uri}. By default, this
- * method returns false; providers who wish to implement this should return true to signal the
- * client that the provider has tried refreshing with its own implementation.
- * <p>
* This allows clients to request an explicit refresh of content identified by {@code uri}.
* <p>
* Client code should only invoke this method when there is a strong indication (such as a user
* initiated pull to refresh gesture) that the content is stale.
* <p>
- * Remember to send {@link ContentResolver#notifyChange(Uri, android.database.ContentObserver)}
- * notifications when content changes.
*
- * @param uri The Uri identifying the data to refresh.
+ * @param url The Uri identifying the data to refresh.
* @param args Additional options from the client. The definitions of these are specific to the
* content provider being called.
* @param cancellationSignal A signal to cancel the operation in progress, or {@code null} if
@@ -693,7 +687,6 @@
* {@link CancellationSignal#throwIfCanceled()} to check whether the client has
* canceled the refresh request.
* @return true if the provider actually tried refreshing.
- * @hide
*/
public final boolean refresh(@NonNull Uri url, @Nullable Bundle args,
@Nullable CancellationSignal cancellationSignal) {
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 74ec8e4..0e2b396 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -1219,5 +1219,5 @@
/** {@hide} */ public String[] getSplitCodePaths() { return splitSourceDirs; }
/** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; }
/** {@hide} */ public String getBaseResourcePath() { return publicSourceDir; }
- /** {@hide} */ public String[] getSplitResourcePaths() { return splitSourceDirs; }
+ /** {@hide} */ public String[] getSplitResourcePaths() { return splitPublicSourceDirs; }
}
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 11f0eb6..d753a6e 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -492,7 +492,7 @@
/**
* Update status of external media on the package manager to scan and
* install packages installed on the external media. Like say the
- * MountService uses this to call into the package manager to update
+ * StorageManagerService uses this to call into the package manager to update
* status of sdcard.
*/
void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
diff --git a/core/java/android/os/storage/IObbActionListener.aidl b/core/java/android/os/storage/IObbActionListener.aidl
index 61ba4d5..a86ba59 100644
--- a/core/java/android/os/storage/IObbActionListener.aidl
+++ b/core/java/android/os/storage/IObbActionListener.aidl
@@ -17,7 +17,7 @@
package android.os.storage;
/**
- * Callback class for receiving events from MountService about Opaque Binary
+ * Callback class for receiving events from StorageManagerService about Opaque Binary
* Blobs (OBBs).
*
* Don't change the existing transaction Ids as they could be used in the native code.
diff --git a/core/java/android/os/storage/IMountServiceListener.aidl b/core/java/android/os/storage/IStorageEventListener.aidl
similarity index 89%
rename from core/java/android/os/storage/IMountServiceListener.aidl
rename to core/java/android/os/storage/IStorageEventListener.aidl
index 0e20cd3..4ba1dbe 100644
--- a/core/java/android/os/storage/IMountServiceListener.aidl
+++ b/core/java/android/os/storage/IStorageEventListener.aidl
@@ -21,15 +21,15 @@
import android.os.storage.VolumeRecord;
/**
- * Callback class for receiving events from MountService.
+ * Callback class for receiving events from StorageManagerService.
*
* Don't change the existing transaction Ids as they could be used in the native code.
* When adding a new method, assign the next available transaction id.
*
- * @hide - Applications should use IStorageEventListener for storage event
- * callbacks.
+ * @hide - Applications should use {@link android.os.storage.StorageEventListener} class for
+ * storage event callbacks.
*/
-oneway interface IMountServiceListener {
+oneway interface IStorageEventListener {
/**
* Detection state of USB Mass Storage has changed
*
diff --git a/core/java/android/os/storage/IMountService.aidl b/core/java/android/os/storage/IStorageManager.aidl
similarity index 90%
rename from core/java/android/os/storage/IMountService.aidl
rename to core/java/android/os/storage/IStorageManager.aidl
index 390df99..98cbce6 100644
--- a/core/java/android/os/storage/IMountService.aidl
+++ b/core/java/android/os/storage/IStorageManager.aidl
@@ -19,8 +19,8 @@
import android.content.pm.IPackageMoveObserver;
import android.os.ParcelFileDescriptor;
import android.os.storage.DiskInfo;
-import android.os.storage.IMountServiceListener;
-import android.os.storage.IMountShutdownObserver;
+import android.os.storage.IStorageEventListener;
+import android.os.storage.IStorageShutdownObserver;
import android.os.storage.IObbActionListener;
import android.os.storage.StorageVolume;
import android.os.storage.VolumeInfo;
@@ -34,15 +34,15 @@
* @hide - Applications should use android.os.storage.StorageManager to access
* storage functions.
*/
-interface IMountService {
+interface IStorageManager {
/**
- * Registers an IMountServiceListener for receiving async notifications.
+ * Registers an IStorageEventListener for receiving async notifications.
*/
- void registerListener(IMountServiceListener listener) = 0;
+ void registerListener(IStorageEventListener listener) = 0;
/**
- * Unregisters an IMountServiceListener
+ * Unregisters an IStorageEventListener
*/
- void unregisterListener(IMountServiceListener listener) = 1;
+ void unregisterListener(IStorageEventListener listener) = 1;
/**
* Returns true if a USB mass storage host is connected
*/
@@ -58,7 +58,7 @@
boolean isUsbMassStorageEnabled() = 4;
/**
* Mount external storage at given mount point. Returns an int consistent
- * with MountServiceResultCode
+ * with StorageResultCode
*/
int mountVolume(in String mountPoint) = 5;
/**
@@ -74,7 +74,7 @@
void unmountVolume(in String mountPoint, boolean force, boolean removeEncryption) = 6;
/**
* Format external storage given a mount point. Returns an int consistent
- * with MountServiceResultCode
+ * with StorageResultCode
*/
int formatVolume(in String mountPoint) = 7;
/**
@@ -87,30 +87,30 @@
String getVolumeState(in String mountPoint) = 9;
/*
* Creates a secure container with the specified parameters. Returns an int
- * consistent with MountServiceResultCode
+ * consistent with StorageResultCode
*/
int createSecureContainer(in String id, int sizeMb, in String fstype, in String key,
int ownerUid, boolean external) = 10;
/*
* Finalize a container which has just been created and populated. After
* finalization, the container is immutable. Returns an int consistent with
- * MountServiceResultCode
+ * StorageResultCode
*/
int finalizeSecureContainer(in String id) = 11;
/*
* Destroy a secure container, and free up all resources associated with it.
* NOTE: Ensure all references are released prior to deleting. Returns an
- * int consistent with MountServiceResultCode
+ * int consistent with StorageResultCode
*/
int destroySecureContainer(in String id, boolean force) = 12;
/*
* Mount a secure container with the specified key and owner UID. Returns an
- * int consistent with MountServiceResultCode
+ * int consistent with StorageResultCode
*/
int mountSecureContainer(in String id, in String key, int ownerUid, boolean readOnly) = 13;
/*
* Unount a secure container. Returns an int consistent with
- * MountServiceResultCode
+ * StorageResultCode
*/
int unmountSecureContainer(in String id, boolean force) = 14;
/*
@@ -119,7 +119,7 @@
boolean isSecureContainerMounted(in String id) = 15;
/*
* Rename an unmounted secure container. Returns an int consistent with
- * MountServiceResultCode
+ * StorageResultCode
*/
int renameSecureContainer(in String oldId, in String newId) = 16;
/*
@@ -131,19 +131,19 @@
*/
String[] getSecureContainerList() = 18;
/**
- * Shuts down the MountService and gracefully unmounts all external media.
+ * Shuts down the StorageManagerService and gracefully unmounts all external media.
* Invokes call back once the shutdown is complete.
*/
- void shutdown(IMountShutdownObserver observer) = 19;
+ void shutdown(IStorageShutdownObserver observer) = 19;
/**
- * Call into MountService by PackageManager to notify that its done
+ * Call into StorageManagerService by PackageManager to notify that its done
* processing the media status update request.
*/
void finishMediaUpdate() = 20;
/**
* Mounts an Opaque Binary Blob (OBB) with the specified decryption key and
* only allows the calling process's UID access to the contents.
- * MountService will call back to the supplied IObbActionListener to inform
+ * StorageManagerService will call back to the supplied IObbActionListener to inform
* it of the terminal state of the call.
*/
void mountObb(in String rawPath, in String canonicalPath, in String key,
@@ -151,7 +151,7 @@
/**
* Unmounts an Opaque Binary Blob (OBB). When the force flag is specified,
* any program using it will be forcibly killed to unmount the image.
- * MountService will call back to the supplied IObbActionListener to inform
+ * StorageManagerService will call back to the supplied IObbActionListener to inform
* it of the terminal state of the call.
*/
void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22;
@@ -209,7 +209,7 @@
int verifyEncryptionPassword(in String password) = 32;
/*
* Fix permissions in a container which has just been created and populated.
- * Returns an int consistent with MountServiceResultCode
+ * Returns an int consistent with StorageResultCode
*/
int fixPermissionsSecureContainer(in String id, int gid, in String filename) = 33;
/**
diff --git a/core/java/android/os/storage/IMountShutdownObserver.aidl b/core/java/android/os/storage/IStorageShutdownObserver.aidl
similarity index 91%
rename from core/java/android/os/storage/IMountShutdownObserver.aidl
rename to core/java/android/os/storage/IStorageShutdownObserver.aidl
index f3e1654..b284217 100644
--- a/core/java/android/os/storage/IMountShutdownObserver.aidl
+++ b/core/java/android/os/storage/IStorageShutdownObserver.aidl
@@ -24,9 +24,9 @@
*
* @hide - For internal consumption only.
*/
-interface IMountShutdownObserver {
+interface IStorageShutdownObserver {
/**
- * This method is called when the shutdown of MountService completed.
+ * This method is called when the shutdown of StorageManagerService completed.
*
* @param statusCode indicates success or failure of the shutdown.
*/
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 1942fde..0472e02 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -152,7 +152,7 @@
/** @hide Underlying data is corrupt */
public static final int ENCRYPTION_STATE_ERROR_CORRUPT = -4;
- private static volatile IMountService sMountService = null;
+ private static volatile IStorageManager sStorageManager = null;
// TODO: the location of the primary storage block varies from device to device, so we need to
// try the most likely candidates - a long-term solution would be a device-specific vold
@@ -166,13 +166,13 @@
private final Context mContext;
private final ContentResolver mResolver;
- private final IMountService mMountService;
+ private final IStorageManager mStorageManager;
private final Looper mLooper;
private final AtomicInteger mNextNonce = new AtomicInteger(0);
private final ArrayList<StorageEventListenerDelegate> mDelegates = new ArrayList<>();
- private static class StorageEventListenerDelegate extends IMountServiceListener.Stub implements
+ private static class StorageEventListenerDelegate extends IStorageEventListener.Stub implements
Handler.Callback {
private static final int MSG_STORAGE_STATE_CHANGED = 1;
private static final int MSG_VOLUME_STATE_CHANGED = 2;
@@ -374,7 +374,7 @@
mContext = context;
mResolver = context.getContentResolver();
mLooper = looper;
- mMountService = IMountService.Stub.asInterface(ServiceManager.getServiceOrThrow("mount"));
+ mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getServiceOrThrow("mount"));
}
/**
@@ -389,7 +389,7 @@
final StorageEventListenerDelegate delegate = new StorageEventListenerDelegate(listener,
mLooper);
try {
- mMountService.registerListener(delegate);
+ mStorageManager.registerListener(delegate);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -410,7 +410,7 @@
final StorageEventListenerDelegate delegate = i.next();
if (delegate.mCallback == listener) {
try {
- mMountService.unregisterListener(delegate);
+ mStorageManager.unregisterListener(delegate);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -488,7 +488,7 @@
try {
final String canonicalPath = new File(rawPath).getCanonicalPath();
final int nonce = mObbActionListener.addListener(listener);
- mMountService.mountObb(rawPath, canonicalPath, key, mObbActionListener, nonce);
+ mStorageManager.mountObb(rawPath, canonicalPath, key, mObbActionListener, nonce);
return true;
} catch (IOException e) {
throw new IllegalArgumentException("Failed to resolve path: " + rawPath, e);
@@ -523,7 +523,7 @@
try {
final int nonce = mObbActionListener.addListener(listener);
- mMountService.unmountObb(rawPath, force, mObbActionListener, nonce);
+ mStorageManager.unmountObb(rawPath, force, mObbActionListener, nonce);
return true;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -540,7 +540,7 @@
Preconditions.checkNotNull(rawPath, "rawPath cannot be null");
try {
- return mMountService.isObbMounted(rawPath);
+ return mStorageManager.isObbMounted(rawPath);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -559,7 +559,7 @@
Preconditions.checkNotNull(rawPath, "rawPath cannot be null");
try {
- return mMountService.getMountedObbPath(rawPath);
+ return mStorageManager.getMountedObbPath(rawPath);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -568,7 +568,7 @@
/** {@hide} */
public @NonNull List<DiskInfo> getDisks() {
try {
- return Arrays.asList(mMountService.getDisks());
+ return Arrays.asList(mStorageManager.getDisks());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -654,7 +654,7 @@
/** {@hide} */
public @NonNull List<VolumeInfo> getVolumes() {
try {
- return Arrays.asList(mMountService.getVolumes(0));
+ return Arrays.asList(mStorageManager.getVolumes(0));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -664,7 +664,7 @@
public @NonNull List<VolumeInfo> getWritablePrivateVolumes() {
try {
final ArrayList<VolumeInfo> res = new ArrayList<>();
- for (VolumeInfo vol : mMountService.getVolumes(0)) {
+ for (VolumeInfo vol : mStorageManager.getVolumes(0)) {
if (vol.getType() == VolumeInfo.TYPE_PRIVATE && vol.isMountedWritable()) {
res.add(vol);
}
@@ -678,7 +678,7 @@
/** {@hide} */
public @NonNull List<VolumeRecord> getVolumeRecords() {
try {
- return Arrays.asList(mMountService.getVolumeRecords(0));
+ return Arrays.asList(mStorageManager.getVolumeRecords(0));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -721,7 +721,7 @@
/** {@hide} */
public void mount(String volId) {
try {
- mMountService.mount(volId);
+ mStorageManager.mount(volId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -730,7 +730,7 @@
/** {@hide} */
public void unmount(String volId) {
try {
- mMountService.unmount(volId);
+ mStorageManager.unmount(volId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -739,7 +739,7 @@
/** {@hide} */
public void format(String volId) {
try {
- mMountService.format(volId);
+ mStorageManager.format(volId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -748,7 +748,7 @@
/** {@hide} */
public long benchmark(String volId) {
try {
- return mMountService.benchmark(volId);
+ return mStorageManager.benchmark(volId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -757,7 +757,7 @@
/** {@hide} */
public void partitionPublic(String diskId) {
try {
- mMountService.partitionPublic(diskId);
+ mStorageManager.partitionPublic(diskId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -766,7 +766,7 @@
/** {@hide} */
public void partitionPrivate(String diskId) {
try {
- mMountService.partitionPrivate(diskId);
+ mStorageManager.partitionPrivate(diskId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -775,7 +775,7 @@
/** {@hide} */
public void partitionMixed(String diskId, int ratio) {
try {
- mMountService.partitionMixed(diskId, ratio);
+ mStorageManager.partitionMixed(diskId, ratio);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -795,7 +795,7 @@
try {
// TODO: switch to explicit wipe command when we have it,
// for now rely on the fact that vfat format does a wipe
- mMountService.partitionPublic(diskId);
+ mStorageManager.partitionPublic(diskId);
} catch (Exception e) {
Slog.w(TAG, "Failed to wipe " + diskId + ", but soldiering onward", e);
}
@@ -808,7 +808,7 @@
/** {@hide} */
public void setVolumeNickname(String fsUuid, String nickname) {
try {
- mMountService.setVolumeNickname(fsUuid, nickname);
+ mStorageManager.setVolumeNickname(fsUuid, nickname);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -817,7 +817,7 @@
/** {@hide} */
public void setVolumeInited(String fsUuid, boolean inited) {
try {
- mMountService.setVolumeUserFlags(fsUuid, inited ? VolumeRecord.USER_FLAG_INITED : 0,
+ mStorageManager.setVolumeUserFlags(fsUuid, inited ? VolumeRecord.USER_FLAG_INITED : 0,
VolumeRecord.USER_FLAG_INITED);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -827,7 +827,7 @@
/** {@hide} */
public void setVolumeSnoozed(String fsUuid, boolean snoozed) {
try {
- mMountService.setVolumeUserFlags(fsUuid, snoozed ? VolumeRecord.USER_FLAG_SNOOZED : 0,
+ mStorageManager.setVolumeUserFlags(fsUuid, snoozed ? VolumeRecord.USER_FLAG_SNOOZED : 0,
VolumeRecord.USER_FLAG_SNOOZED);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -837,7 +837,7 @@
/** {@hide} */
public void forgetVolume(String fsUuid) {
try {
- mMountService.forgetVolume(fsUuid);
+ mStorageManager.forgetVolume(fsUuid);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -851,7 +851,7 @@
*/
public String getPrimaryStorageUuid() {
try {
- return mMountService.getPrimaryStorageUuid();
+ return mStorageManager.getPrimaryStorageUuid();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -865,7 +865,7 @@
*/
public void setPrimaryStorageUuid(String volumeUuid, IPackageMoveObserver callback) {
try {
- mMountService.setPrimaryStorageUuid(volumeUuid, callback);
+ mStorageManager.setPrimaryStorageUuid(volumeUuid, callback);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -982,7 +982,7 @@
/** {@hide} */
public static @NonNull StorageVolume[] getVolumeList(int userId, int flags) {
- final IMountService mountService = IMountService.Stub.asInterface(
+ final IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
try {
String packageName = ActivityThread.currentOpPackageName();
@@ -1003,7 +1003,7 @@
if (uid <= 0) {
return new StorageVolume[0];
}
- return mountService.getVolumeList(uid, packageName, flags);
+ return storageManager.getVolumeList(uid, packageName, flags);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1085,7 +1085,7 @@
/** {@hide} */
public void createUserKey(int userId, int serialNumber, boolean ephemeral) {
try {
- mMountService.createUserKey(userId, serialNumber, ephemeral);
+ mStorageManager.createUserKey(userId, serialNumber, ephemeral);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1094,7 +1094,7 @@
/** {@hide} */
public void destroyUserKey(int userId) {
try {
- mMountService.destroyUserKey(userId);
+ mStorageManager.destroyUserKey(userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1103,7 +1103,7 @@
/** {@hide} */
public void unlockUserKey(int userId, int serialNumber, byte[] token, byte[] secret) {
try {
- mMountService.unlockUserKey(userId, serialNumber, token, secret);
+ mStorageManager.unlockUserKey(userId, serialNumber, token, secret);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1112,7 +1112,7 @@
/** {@hide} */
public void lockUserKey(int userId) {
try {
- mMountService.lockUserKey(userId);
+ mStorageManager.lockUserKey(userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1121,7 +1121,7 @@
/** {@hide} */
public void prepareUserStorage(String volumeUuid, int userId, int serialNumber, int flags) {
try {
- mMountService.prepareUserStorage(volumeUuid, userId, serialNumber, flags);
+ mStorageManager.prepareUserStorage(volumeUuid, userId, serialNumber, flags);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1130,7 +1130,7 @@
/** {@hide} */
public void destroyUserStorage(String volumeUuid, int userId, int flags) {
try {
- mMountService.destroyUserStorage(volumeUuid, userId, flags);
+ mStorageManager.destroyUserStorage(volumeUuid, userId, flags);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1138,17 +1138,17 @@
/** {@hide} */
public static boolean isUserKeyUnlocked(int userId) {
- if (sMountService == null) {
- sMountService = IMountService.Stub
+ if (sStorageManager == null) {
+ sStorageManager = IStorageManager.Stub
.asInterface(ServiceManager.getService("mount"));
}
- if (sMountService == null) {
+ if (sStorageManager == null) {
Slog.w(TAG, "Early during boot, assuming locked");
return false;
}
final long token = Binder.clearCallingIdentity();
try {
- return sMountService.isUserKeyUnlocked(userId);
+ return sStorageManager.isUserKeyUnlocked(userId);
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
} finally {
@@ -1224,9 +1224,9 @@
}
try {
- IMountService mountService = IMountService.Stub.asInterface(
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
- return mountService.getPasswordType() != CRYPT_TYPE_DEFAULT;
+ return storageManager.getPasswordType() != CRYPT_TYPE_DEFAULT;
} catch (RemoteException e) {
Log.e(TAG, "Error getting encryption type");
return false;
@@ -1280,10 +1280,10 @@
/** {@hide} */
public static File maybeTranslateEmulatedPathToInternal(File path) {
- final IMountService mountService = IMountService.Stub.asInterface(
+ final IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
try {
- final VolumeInfo[] vols = mountService.getVolumes(0);
+ final VolumeInfo[] vols = storageManager.getVolumes(0);
for (VolumeInfo vol : vols) {
if ((vol.getType() == VolumeInfo.TYPE_EMULATED
|| vol.getType() == VolumeInfo.TYPE_PUBLIC) && vol.isMountedReadable()) {
@@ -1303,7 +1303,7 @@
/** {@hide} */
public ParcelFileDescriptor mountAppFuse(String name) {
try {
- return mMountService.mountAppFuse(name);
+ return mStorageManager.mountAppFuse(name);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1319,7 +1319,7 @@
/** @hide */
public static final int CRYPT_TYPE_PIN = 3;
- // Constants for the data available via MountService.getField.
+ // Constants for the data available via StorageManagerService.getField.
/** @hide */
public static final String SYSTEM_LOCALE_KEY = "SystemLocale";
/** @hide */
diff --git a/core/java/android/os/storage/MountServiceInternal.java b/core/java/android/os/storage/StorageManagerInternal.java
similarity index 98%
rename from core/java/android/os/storage/MountServiceInternal.java
rename to core/java/android/os/storage/StorageManagerInternal.java
index 17aaef9..d102b19 100644
--- a/core/java/android/os/storage/MountServiceInternal.java
+++ b/core/java/android/os/storage/StorageManagerInternal.java
@@ -21,7 +21,7 @@
*
* @hide Only for use within the system server.
*/
-public abstract class MountServiceInternal {
+public abstract class StorageManagerInternal {
/**
* Policy that influences how external storage is mounted and reported.
diff --git a/core/java/android/os/storage/StorageResultCode.java b/core/java/android/os/storage/StorageResultCode.java
index 8e7db31..c843887 100644
--- a/core/java/android/os/storage/StorageResultCode.java
+++ b/core/java/android/os/storage/StorageResultCode.java
@@ -18,7 +18,7 @@
/**
* Class that provides access to constants returned from StorageManager
- * and lower level MountService APIs.
+ * and lower level StorageManagerService APIs.
*
* @hide
*/
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 79b42ba..afbc09b 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -5854,7 +5854,8 @@
"search_per_source_concurrent_query_limit";
/**
- * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
+ * Whether or not alert sounds are played on StorageManagerService events.
+ * (0 = false, 1 = true)
* @hide
*/
public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
diff --git a/core/java/com/android/internal/content/PackageHelper.java b/core/java/com/android/internal/content/PackageHelper.java
index 4e3c3fc..a3134b3b 100644
--- a/core/java/com/android/internal/content/PackageHelper.java
+++ b/core/java/com/android/internal/content/PackageHelper.java
@@ -29,7 +29,7 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.os.storage.StorageResultCode;
import android.os.storage.StorageVolume;
@@ -53,7 +53,7 @@
/**
* Constants used internally between the PackageManager
* and media container service transports.
- * Some utility methods to invoke MountService api.
+ * Some utility methods to invoke StorageManagerService api.
*/
public class PackageHelper {
public static final int RECOMMEND_INSTALL_INTERNAL = 1;
@@ -74,13 +74,13 @@
public static final int APP_INSTALL_INTERNAL = 1;
public static final int APP_INSTALL_EXTERNAL = 2;
- public static IMountService getMountService() throws RemoteException {
+ public static IStorageManager getStorageManager() throws RemoteException {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
} else {
- Log.e(TAG, "Can't get mount service");
- throw new RemoteException("Could not contact mount service");
+ Log.e(TAG, "Can't get storagemanager service");
+ throw new RemoteException("Could not contact storagemanager service");
}
}
@@ -89,23 +89,23 @@
// Round up to nearest MB, plus another MB for filesystem overhead
final int sizeMb = (int) ((sizeBytes + MB_IN_BYTES) / MB_IN_BYTES) + 1;
try {
- IMountService mountService = getMountService();
+ IStorageManager storageManager = getStorageManager();
if (localLOGV)
Log.i(TAG, "Size of container " + sizeMb + " MB");
- int rc = mountService.createSecureContainer(cid, sizeMb, "ext4", sdEncKey, uid,
+ int rc = storageManager.createSecureContainer(cid, sizeMb, "ext4", sdEncKey, uid,
isExternal);
if (rc != StorageResultCode.OperationSucceeded) {
Log.e(TAG, "Failed to create secure container " + cid);
return null;
}
- String cachePath = mountService.getSecureContainerPath(cid);
+ String cachePath = storageManager.getSecureContainerPath(cid);
if (localLOGV) Log.i(TAG, "Created secure container " + cid +
" at " + cachePath);
return cachePath;
} catch (RemoteException e) {
- Log.e(TAG, "MountService running?");
+ Log.e(TAG, "StorageManagerService running?");
}
return null;
}
@@ -114,13 +114,13 @@
// Round up to nearest MB, plus another MB for filesystem overhead
final int sizeMb = (int) ((sizeBytes + MB_IN_BYTES) / MB_IN_BYTES) + 1;
try {
- IMountService mountService = getMountService();
- int rc = mountService.resizeSecureContainer(cid, sizeMb, sdEncKey);
+ IStorageManager storageManager = getStorageManager();
+ int rc = storageManager.resizeSecureContainer(cid, sizeMb, sdEncKey);
if (rc == StorageResultCode.OperationSucceeded) {
return true;
}
} catch (RemoteException e) {
- Log.e(TAG, "MountService running?");
+ Log.e(TAG, "StorageManagerService running?");
}
Log.e(TAG, "Failed to create secure container " + cid);
return false;
@@ -132,35 +132,35 @@
public static String mountSdDir(String cid, String key, int ownerUid, boolean readOnly) {
try {
- int rc = getMountService().mountSecureContainer(cid, key, ownerUid, readOnly);
+ int rc = getStorageManager().mountSecureContainer(cid, key, ownerUid, readOnly);
if (rc != StorageResultCode.OperationSucceeded) {
Log.i(TAG, "Failed to mount container " + cid + " rc : " + rc);
return null;
}
- return getMountService().getSecureContainerPath(cid);
+ return getStorageManager().getSecureContainerPath(cid);
} catch (RemoteException e) {
- Log.e(TAG, "MountService running?");
+ Log.e(TAG, "StorageManagerService running?");
}
return null;
}
public static boolean unMountSdDir(String cid) {
try {
- int rc = getMountService().unmountSecureContainer(cid, true);
+ int rc = getStorageManager().unmountSecureContainer(cid, true);
if (rc != StorageResultCode.OperationSucceeded) {
Log.e(TAG, "Failed to unmount " + cid + " with rc " + rc);
return false;
}
return true;
} catch (RemoteException e) {
- Log.e(TAG, "MountService running?");
+ Log.e(TAG, "StorageManagerService running?");
}
return false;
}
public static boolean renameSdDir(String oldId, String newId) {
try {
- int rc = getMountService().renameSecureContainer(oldId, newId);
+ int rc = getStorageManager().renameSecureContainer(oldId, newId);
if (rc != StorageResultCode.OperationSucceeded) {
Log.e(TAG, "Failed to rename " + oldId + " to " +
newId + "with rc " + rc);
@@ -176,7 +176,7 @@
public static String getSdDir(String cid) {
try {
- return getMountService().getSecureContainerPath(cid);
+ return getStorageManager().getSecureContainerPath(cid);
} catch (RemoteException e) {
Log.e(TAG, "Failed to get container path for " + cid +
" with exception " + e);
@@ -186,7 +186,7 @@
public static String getSdFilesystem(String cid) {
try {
- return getMountService().getSecureContainerFilesystemPath(cid);
+ return getStorageManager().getSecureContainerFilesystemPath(cid);
} catch (RemoteException e) {
Log.e(TAG, "Failed to get container path for " + cid +
" with exception " + e);
@@ -196,7 +196,7 @@
public static boolean finalizeSdDir(String cid) {
try {
- int rc = getMountService().finalizeSecureContainer(cid);
+ int rc = getStorageManager().finalizeSecureContainer(cid);
if (rc != StorageResultCode.OperationSucceeded) {
Log.i(TAG, "Failed to finalize container " + cid);
return false;
@@ -212,7 +212,7 @@
public static boolean destroySdDir(String cid) {
try {
if (localLOGV) Log.i(TAG, "Forcibly destroying container " + cid);
- int rc = getMountService().destroySecureContainer(cid, true);
+ int rc = getStorageManager().destroySecureContainer(cid, true);
if (rc != StorageResultCode.OperationSucceeded) {
Log.i(TAG, "Failed to destroy container " + cid);
return false;
@@ -227,7 +227,7 @@
public static String[] getSecureContainerList() {
try {
- return getMountService().getSecureContainerList();
+ return getStorageManager().getSecureContainerList();
} catch (RemoteException e) {
Log.e(TAG, "Failed to get secure container list with exception" +
e);
@@ -237,7 +237,7 @@
public static boolean isContainerMounted(String cid) {
try {
- return getMountService().isSecureContainerMounted(cid);
+ return getStorageManager().isSecureContainerMounted(cid);
} catch (RemoteException e) {
Log.e(TAG, "Failed to find out if container " + cid + " mounted");
}
@@ -325,7 +325,7 @@
public static boolean fixSdPermissions(String cid, int gid, String filename) {
try {
- int rc = getMountService().fixPermissionsSecureContainer(cid, gid, filename);
+ int rc = getStorageManager().fixPermissionsSecureContainer(cid, gid, filename);
if (rc != StorageResultCode.OperationSucceeded) {
Log.i(TAG, "Failed to fixperms container " + cid);
return false;
diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java
index 80c55fb..7591488 100644
--- a/core/java/com/android/internal/os/RoSystemProperties.java
+++ b/core/java/com/android/internal/os/RoSystemProperties.java
@@ -27,6 +27,8 @@
SystemProperties.getInt("ro.debuggable", 0) == 1;
public static final int FACTORYTEST =
SystemProperties.getInt("ro.factorytest", 0);
+ public static final boolean CONTROL_PRIVAPP_PERMISSIONS =
+ SystemProperties.getBoolean("ro.control_privapp_permissions", false);
// ------ ro.config.* -------- //
public static final boolean CONFIG_LOW_RAM =
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 71252fb..b0bc81b 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -36,7 +36,7 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.text.TextUtils;
@@ -682,10 +682,10 @@
return;
}
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
Log.d(TAG, "Setting owner info");
- mountService.setField(StorageManager.OWNER_INFO_KEY, ownerInfo);
+ storageManager.setField(StorageManager.OWNER_INFO_KEY, ownerInfo);
} catch (RemoteException e) {
Log.e(TAG, "Error changing user info", e);
}
@@ -746,9 +746,9 @@
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... dummy) {
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
- mountService.changeEncryptionPassword(type, password);
+ storageManager.changeEncryptionPassword(type, password);
} catch (RemoteException e) {
Log.e(TAG, "Error changing encryption password", e);
}
@@ -1122,9 +1122,9 @@
return;
}
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
- mountService.setField(StorageManager.PATTERN_VISIBLE_KEY, enabled ? "1" : "0");
+ storageManager.setField(StorageManager.PATTERN_VISIBLE_KEY, enabled ? "1" : "0");
} catch (RemoteException e) {
Log.e(TAG, "Error changing pattern visible state", e);
}
@@ -1145,9 +1145,9 @@
return;
}
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
- mountService.setField(StorageManager.PASSWORD_VISIBLE_KEY, enabled ? "1" : "0");
+ storageManager.setField(StorageManager.PASSWORD_VISIBLE_KEY, enabled ? "1" : "0");
} catch (RemoteException e) {
Log.e(TAG, "Error changing password visible state", e);
}
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java
index 429131b..168da5f 100644
--- a/core/java/com/android/server/SystemConfig.java
+++ b/core/java/com/android/server/SystemConfig.java
@@ -25,6 +25,7 @@
import android.os.Environment;
import android.os.Process;
import android.os.storage.StorageManager;
+import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Slog;
@@ -129,6 +130,9 @@
final ArrayMap<String, List<String>> mDisabledUntilUsedPreinstalledCarrierAssociatedApps =
new ArrayMap<>();
+
+ final ArrayMap<String, ArraySet<String>> mPrivAppPermissions = new ArrayMap<>();
+
public static SystemConfig getInstance() {
synchronized (SystemConfig.class) {
if (sInstance == null) {
@@ -194,6 +198,10 @@
return mDisabledUntilUsedPreinstalledCarrierAssociatedApps;
}
+ public ArraySet<String> getPrivAppPermissions(String packageName) {
+ return mPrivAppPermissions.get(packageName);
+ }
+
SystemConfig() {
// Read configuration from system
readPermissions(Environment.buildPath(
@@ -507,6 +515,8 @@
associatedPkgs.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
+ } else if ("privapp-permissions".equals(name) && allowAppConfigs) {
+ readPrivAppPermissions(parser);
} else {
XmlUtils.skipCurrentTag(parser);
continue;
@@ -584,4 +594,32 @@
XmlUtils.skipCurrentTag(parser);
}
}
+
+ void readPrivAppPermissions(XmlPullParser parser) throws IOException, XmlPullParserException {
+ String packageName = parser.getAttributeValue(null, "package");
+ if (TextUtils.isEmpty(packageName)) {
+ Slog.w(TAG, "package is required for <privapp-permissions> in "
+ + parser.getPositionDescription());
+ return;
+ }
+
+ ArraySet<String> permissions = mPrivAppPermissions.get(packageName);
+ if (permissions == null) {
+ permissions = new ArraySet<>();
+ }
+ int depth = parser.getDepth();
+ while (XmlUtils.nextElementWithin(parser, depth)) {
+ String name = parser.getName();
+ if ("permission".equals(name)) {
+ String permName = parser.getAttributeValue(null, "name");
+ if (TextUtils.isEmpty(permName)) {
+ Slog.w(TAG, "name is required for <permission> in "
+ + parser.getPositionDescription());
+ continue;
+ }
+ permissions.add(permName);
+ }
+ }
+ mPrivAppPermissions.put(packageName, permissions);
+ }
}
diff --git a/core/jni/android/graphics/Typeface.cpp b/core/jni/android/graphics/Typeface.cpp
index 7fc79d2..c920b8d 100644
--- a/core/jni/android/graphics/Typeface.cpp
+++ b/core/jni/android/graphics/Typeface.cpp
@@ -70,7 +70,7 @@
static void Typeface_setDefault(JNIEnv *env, jobject, jlong faceHandle) {
Typeface* face = reinterpret_cast<Typeface*>(faceHandle);
- return Typeface::setDefault(face);
+ Typeface::setDefault(face);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 765a326..fbad143 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -721,6 +721,7 @@
android:priority="400" />
<!-- Allows an app to access precise location.
+ Alternatively, you might want {@link #ACCESS_COARSE_LOCATION}.
<p>Protection level: dangerous
-->
<permission android:name="android.permission.ACCESS_FINE_LOCATION"
@@ -730,6 +731,7 @@
android:protectionLevel="dangerous|ephemeral" />
<!-- Allows an app to access approximate location.
+ Alternatively, you might want {@link #ACCESS_FINE_LOCATION}.
<p>Protection level: dangerous
-->
<permission android:name="android.permission.ACCESS_COARSE_LOCATION"
diff --git a/core/tests/coretests/src/android/content/pm/PackageHelperTests.java b/core/tests/coretests/src/android/content/pm/PackageHelperTests.java
index 06c495e..5af2667 100644
--- a/core/tests/coretests/src/android/content/pm/PackageHelperTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageHelperTests.java
@@ -21,7 +21,7 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.test.AndroidTestCase;
import android.util.Log;
@@ -31,14 +31,14 @@
private static final boolean localLOGV = true;
public static final String TAG = "PackageHelperTests";
protected final String PREFIX = "android.content.pm";
- private IMountService mMs;
+ private IStorageManager mSm;
private String fullId;
private String fullId2;
- private IMountService getMs() {
+ private IStorageManager getSm() {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
} else {
Log.e(TAG, "Can't get mount service");
}
@@ -47,12 +47,12 @@
private void cleanupContainers() throws RemoteException {
Log.d(TAG,"cleanUp");
- IMountService ms = getMs();
- String[] containers = ms.getSecureContainerList();
+ IStorageManager sm = getSm();
+ String[] containers = sm.getSecureContainerList();
for (int i = 0; i < containers.length; i++) {
if (containers[i].startsWith(PREFIX)) {
Log.d(TAG,"cleaing up "+containers[i]);
- ms.destroySecureContainer(containers[i], true);
+ sm.destroySecureContainer(containers[i], true);
}
}
}
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index b5f0617..a15cba0 100644
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -46,7 +46,7 @@
import android.os.StatFs;
import android.os.SystemClock;
import android.os.UserManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageListener;
import android.os.storage.StorageManager;
import android.os.storage.StorageResultCode;
@@ -1149,12 +1149,12 @@
}
}
- IMountService getMs() {
+ IStorageManager getSm() {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
} else {
- Log.e(TAG, "Can't get mount service");
+ Log.e(TAG, "Can't get storagemanager service");
}
return null;
}
@@ -1185,7 +1185,7 @@
try {
// Wait on observer
synchronized (observer) {
- int ret = getMs().mountVolume(path);
+ int ret = getSm().mountVolume(path);
if (ret != StorageResultCode.OperationSucceeded) {
throw new Exception("Could not mount the media");
}
@@ -1224,7 +1224,7 @@
try {
// Wait on observer
synchronized (observer) {
- getMs().unmountVolume(path, true, false);
+ getSm().unmountVolume(path, true, false);
long waitTime = 0;
while ((!observer.isDone()) && (waitTime < MAX_WAIT_TIME)) {
observer.wait(WAIT_TIME_INCR);
@@ -2754,7 +2754,7 @@
}
}
- /* This test creates a stale container via MountService and then installs
+ /* This test creates a stale container via StorageManagerService and then installs
* a package and verifies that the stale container is cleaned up and install
* is successful.
* Please note that this test is very closely tied to the framework's
diff --git a/core/tests/coretests/src/android/os/storage/AsecTests.java b/core/tests/coretests/src/android/os/storage/AsecTests.java
index 4f724fe..e9a810d 100644
--- a/core/tests/coretests/src/android/os/storage/AsecTests.java
+++ b/core/tests/coretests/src/android/os/storage/AsecTests.java
@@ -50,21 +50,21 @@
}
private void cleanupContainers() throws RemoteException {
- IMountService ms = getMs();
- String[] containers = ms.getSecureContainerList();
+ IStorageManager sm = getSm();
+ String[] containers = sm.getSecureContainerList();
for (int i = 0; i < containers.length; i++) {
if (containers[i].startsWith(SECURE_CONTAINER_PREFIX)) {
if (localLOGV)
Log.i(TAG, "Cleaning: " + containers[i]);
- ms.destroySecureContainer(containers[i], true);
+ sm.destroySecureContainer(containers[i], true);
}
}
}
private boolean containerExists(String localId) throws RemoteException {
- IMountService ms = getMs();
- String[] containers = ms.getSecureContainerList();
+ IStorageManager sm = getSm();
+ String[] containers = sm.getSecureContainerList();
String fullId = SECURE_CONTAINER_PREFIX + localId;
for (int i = 0; i < containers.length; i++) {
@@ -80,8 +80,8 @@
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.createSecureContainer(fullId, size, filesystem, key, android.os.Process.myUid(),
+ IStorageManager sm = getSm();
+ return sm.createSecureContainer(fullId, size, filesystem, key, android.os.Process.myUid(),
isExternal);
}
@@ -89,8 +89,8 @@
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.mountSecureContainer(fullId, key, android.os.Process.myUid(), true);
+ IStorageManager sm = getSm();
+ return sm.mountSecureContainer(fullId, key, android.os.Process.myUid(), true);
}
private int renameContainer(String localId1, String localId2) throws Exception {
@@ -98,47 +98,47 @@
String fullId1 = SECURE_CONTAINER_PREFIX + localId1;
String fullId2 = SECURE_CONTAINER_PREFIX + localId2;
- IMountService ms = getMs();
- return ms.renameSecureContainer(fullId1, fullId2);
+ IStorageManager sm = getSm();
+ return sm.renameSecureContainer(fullId1, fullId2);
}
private int unmountContainer(String localId, boolean force) throws Exception {
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.unmountSecureContainer(fullId, force);
+ IStorageManager sm = getSm();
+ return sm.unmountSecureContainer(fullId, force);
}
private int destroyContainer(String localId, boolean force) throws Exception {
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.destroySecureContainer(fullId, force);
+ IStorageManager sm = getSm();
+ return sm.destroySecureContainer(fullId, force);
}
private boolean isContainerMounted(String localId) throws Exception {
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.isSecureContainerMounted(fullId);
+ IStorageManager sm = getSm();
+ return sm.isSecureContainerMounted(fullId);
}
- private IMountService getMs() {
+ private IStorageManager getSm() {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
} else {
- Log.e(TAG, "Can't get mount service");
+ Log.e(TAG, "Can't get storagemanager service");
}
return null;
}
private boolean isMediaMounted() throws Exception {
String mPath = Environment.getExternalStorageDirectory().toString();
- String state = getMs().getVolumeState(mPath);
+ String state = getSm().getVolumeState(mPath);
return Environment.MEDIA_MOUNTED.equals(state);
}
@@ -385,11 +385,11 @@
return;
}
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testUnmountBusyContainer", 4, "none", FS_FAT, true));
- String path = ms.getSecureContainerPath(SECURE_CONTAINER_PREFIX
+ String path = sm.getSecureContainerPath(SECURE_CONTAINER_PREFIX
+ "testUnmountBusyContainer");
File f = new File(path, "reference");
@@ -408,12 +408,12 @@
return;
}
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testDestroyBusyContainer", 4, "none", FS_FAT, true));
- String path = ms.getSecureContainerPath(SECURE_CONTAINER_PREFIX
+ String path = sm.getSecureContainerPath(SECURE_CONTAINER_PREFIX
+ "testDestroyBusyContainer");
File f = new File(path, "reference");
@@ -480,10 +480,10 @@
return;
}
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testContainerSize", 1, "none", FS_FAT, true));
- String path = ms.getSecureContainerPath(SECURE_CONTAINER_PREFIX + "testContainerSize");
+ String path = sm.getSecureContainerPath(SECURE_CONTAINER_PREFIX + "testContainerSize");
byte[] buf = new byte[4096];
File f = new File(path, "reference");
@@ -495,9 +495,9 @@
}
public void testGetSecureContainerPath_NonExistPath_Failure() throws Exception {
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
assertNull("Getting the path for an invalid container should return null",
- ms.getSecureContainerPath("jparks.broke.it"));
+ sm.getSecureContainerPath("jparks.broke.it"));
}
/*------------ Tests for unmounting volume ---*/
@@ -506,7 +506,7 @@
boolean getMediaState() throws Exception {
String mPath = Environment.getExternalStorageDirectory().toString();
- String state = getMs().getVolumeState(mPath);
+ String state = getSm().getVolumeState(mPath);
return Environment.MEDIA_MOUNTED.equals(state);
}
@@ -520,7 +520,7 @@
}
String mPath = Environment.getExternalStorageDirectory().toString();
- int ret = getMs().mountVolume(mPath);
+ int ret = getSm().mountVolume(mPath);
return ret == StorageResultCode.OperationSucceeded;
}
@@ -567,7 +567,7 @@
try {
// Wait on observer
synchronized(observer) {
- getMs().unmountVolume(path, false, false);
+ getSm().unmountVolume(path, false, false);
long waitTime = 0;
while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) {
observer.wait(WAIT_TIME_INCR);
@@ -634,7 +634,7 @@
// Wait on observer
synchronized(observer) {
for (int i = 0; i < 5; i++) {
- getMs().unmountVolume(path, false, false);
+ getSm().unmountVolume(path, false, false);
}
long waitTime = 0;
while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) {
@@ -661,7 +661,7 @@
}
}
- class ShutdownObserver extends IMountShutdownObserver.Stub{
+ class ShutdownObserver extends IStorageShutdownObserver.Stub{
private boolean doneFlag = false;
int statusCode;
@@ -683,10 +683,10 @@
}
void invokeShutdown() throws Exception {
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
ShutdownObserver observer = new ShutdownObserver();
synchronized (observer) {
- ms.shutdown(observer);
+ sm.shutdown(observer);
}
}
@@ -731,12 +731,12 @@
if (!getMediaState()) {
mountMedia();
}
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
ShutdownObserver observer = new ShutdownObserver();
synchronized (observer) {
- ms.shutdown(observer);
+ sm.shutdown(observer);
for (int i = 0; i < 4; i++) {
- ms.shutdown(null);
+ sm.shutdown(null);
}
}
} finally {
diff --git a/data/etc/Android.mk b/data/etc/Android.mk
index 134ac0c..6718259 100644
--- a/data/etc/Android.mk
+++ b/data/etc/Android.mk
@@ -18,30 +18,17 @@
########################
include $(CLEAR_VARS)
-
LOCAL_MODULE := platform.xml
-
LOCAL_MODULE_CLASS := ETC
-
-# This will install the file in /system/etc/permissions
-#
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
-
LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
include $(BUILD_PREBUILT)
########################
-#include $(CLEAR_VARS)
+include $(CLEAR_VARS)
+LOCAL_MODULE := privapp-permissions-platform.xml
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+include $(BUILD_PREBUILT)
-#LOCAL_MODULE := required_hardware.xml
-
-#LOCAL_MODULE_CLASS := ETC
-
-# This will install the file in /system/etc/permissions
-#
-#LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
-
-#LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-#include $(BUILD_PREBUILT)
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
new file mode 100644
index 0000000..3fc7914
--- /dev/null
+++ b/data/etc/privapp-permissions-platform.xml
@@ -0,0 +1,324 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+
+<!--
+This XML file declares which signature|privileged permissions should be granted to privileged
+applications that come with the platform
+-->
+<permissions>
+ <privapp-permissions package="com.android.backupconfirm">
+ <permission name="android.permission.BACKUP"/>
+ <permission name="android.permission.CRYPT_KEEPER"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.cellbroadcastreceiver">
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
+ <permission name="android.permission.RECEIVE_EMERGENCY_BROADCAST"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.contacts">
+ <permission name="android.permission.GET_ACCOUNTS_PRIVILEGED"/>
+ <permission name="com.android.voicemail.permission.READ_VOICEMAIL"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.defcontainer">
+ <permission name="android.permission.ACCESS_CACHE_FILESYSTEM"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.dialer">
+ <permission name="android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK"/>
+ <permission name="android.permission.CONTROL_INCALL_EXPERIENCE"/>
+ <permission name="android.permission.GET_ACCOUNTS_PRIVILEGED"/>
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ <permission name="android.permission.STOP_APP_SWITCHES"/>
+ <permission name="com.android.voicemail.permission.READ_VOICEMAIL"/>
+ <permission name="com.android.voicemail.permission.WRITE_VOICEMAIL"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.emergency">
+ <permission name="android.permission.MANAGE_USERS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.externalstorage">
+ <permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
+ <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.launcher">
+ <permission name="android.permission.BIND_APPWIDGET"/>
+ <permission name="android.permission.GET_ACCOUNTS_PRIVILEGED"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.location.fused">
+ <permission name="android.permission.INSTALL_LOCATION_PROVIDER"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.managedprovisioning">
+ <permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
+ <permission name="android.permission.CHANGE_CONFIGURATION"/>
+ <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
+ <permission name="android.permission.CRYPT_KEEPER"/>
+ <permission name="android.permission.DELETE_PACKAGES"/>
+ <permission name="android.permission.INSTALL_PACKAGES"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.MANAGE_DEVICE_ADMINS"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.MASTER_CLEAR"/>
+ <permission name="android.permission.PERFORM_CDMA_PROVISIONING"/>
+ <permission name="android.permission.SET_TIME"/>
+ <permission name="android.permission.SET_TIME_ZONE"/>
+ <permission name="android.permission.SHUTDOWN"/>
+ <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.mms.service">
+ <permission name="android.permission.BIND_CARRIER_MESSAGING_SERVICE"/>
+ <permission name="android.permission.BIND_CARRIER_SERVICES"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.mtp">
+ <permission name="android.permission.MANAGE_USB"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.musicfx">
+ <permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.packageinstaller">
+ <permission name="android.permission.CLEAR_APP_CACHE"/>
+ <permission name="android.permission.DELETE_PACKAGES"/>
+ <permission name="android.permission.INSTALL_PACKAGES"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.phone">
+ <permission name="android.permission.ACCESS_IMS_CALL_SERVICE"/>
+ <permission name="android.permission.BIND_CARRIER_MESSAGING_SERVICE"/>
+ <permission name="android.permission.BIND_CARRIER_SERVICES"/>
+ <permission name="android.permission.CALL_PRIVILEGED"/>
+ <permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
+ <permission name="android.permission.CHANGE_CONFIGURATION"/>
+ <permission name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST"/>
+ <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
+ <permission name="android.permission.DUMP"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.LOCAL_MAC_ADDRESS"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ <permission name="android.permission.PERFORM_CDMA_PROVISIONING"/>
+ <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
+ <permission name="android.permission.READ_SEARCH_INDEXABLES"/>
+ <permission name="android.permission.REBOOT"/>
+ <permission name="android.permission.REGISTER_CALL_PROVIDER"/>
+ <permission name="android.permission.REGISTER_SIM_SUBSCRIPTION"/>
+ <permission name="android.permission.SEND_RESPOND_VIA_MESSAGE"/>
+ <permission name="android.permission.SET_TIME"/>
+ <permission name="android.permission.SET_TIME_ZONE"/>
+ <permission name="android.permission.SHUTDOWN"/>
+ <permission name="android.permission.STATUS_BAR"/>
+ <permission name="android.permission.STOP_APP_SWITCHES"/>
+ <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
+ <permission name="android.permission.UPDATE_DEVICE_STATS"/>
+ <permission name="android.permission.UPDATE_LOCK"/>
+ <permission name="android.permission.WRITE_APN_SETTINGS"/>
+ <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
+ <permission name="com.android.voicemail.permission.READ_VOICEMAIL"/>
+ <permission name="com.android.voicemail.permission.WRITE_VOICEMAIL"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.providers.calendar">
+ <permission name="android.permission.GET_ACCOUNTS_PRIVILEGED"/>
+ <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.providers.contacts">
+ <permission name="android.permission.BIND_DIRECTORY_SEARCH"/>
+ <permission name="android.permission.GET_ACCOUNTS_PRIVILEGED"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.providers.downloads">
+ <permission name="android.permission.ACCESS_CACHE_FILESYSTEM"/>
+ <permission name="android.permission.CLEAR_APP_CACHE"/>
+ <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
+ <permission name="android.permission.MODIFY_NETWORK_ACCOUNTING"/>
+ <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
+ <permission name="android.permission.UPDATE_DEVICE_STATS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.providers.media">
+ <permission name="android.permission.ACCESS_MTP"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.providers.telephony">
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.provision">
+ <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.server.telecom">
+ <permission name="android.permission.BIND_CONNECTION_SERVICE"/>
+ <permission name="android.permission.BIND_INCALL_SERVICE"/>
+ <permission name="android.permission.CALL_PRIVILEGED"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ <permission name="android.permission.STOP_APP_SWITCHES"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.settings">
+ <permission name="android.permission.ACCESS_CHECKIN_PROPERTIES"/>
+ <permission name="android.permission.ACCESS_NOTIFICATIONS"/>
+ <permission name="android.permission.BACKUP"/>
+ <permission name="android.permission.BATTERY_STATS"/>
+ <permission name="android.permission.BLUETOOTH_PRIVILEGED"/>
+ <permission name="android.permission.CHANGE_CONFIGURATION"/>
+ <permission name="android.permission.DELETE_PACKAGES"/>
+ <permission name="android.permission.FORCE_STOP_PACKAGES"/>
+ <permission name="android.permission.MANAGE_DEVICE_ADMINS"/>
+ <permission name="android.permission.MANAGE_FINGERPRINT"/>
+ <permission name="android.permission.MANAGE_USB"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.MASTER_CLEAR"/>
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ <permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
+ <permission name="android.permission.MOVE_PACKAGE"/>
+ <permission name="android.permission.OVERRIDE_WIFI_CONFIG"/>
+ <permission name="android.permission.PACKAGE_USAGE_STATS"/>
+ <permission name="android.permission.READ_SEARCH_INDEXABLES"/>
+ <permission name="android.permission.REBOOT"/>
+ <permission name="android.permission.SET_TIME"/>
+ <permission name="android.permission.STATUS_BAR"/>
+ <permission name="android.permission.TETHER_PRIVILEGED"/>
+ <permission name="android.permission.USER_ACTIVITY"/>
+ <permission name="android.permission.WRITE_APN_SETTINGS"/>
+ <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
+ <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.sharedstoragebackup">
+ <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.shell">
+ <permission name="android.permission.BACKUP"/>
+ <permission name="android.permission.BATTERY_STATS"/>
+ <permission name="android.permission.BIND_APPWIDGET"/>
+ <permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
+ <permission name="android.permission.CHANGE_CONFIGURATION"/>
+ <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
+ <permission name="android.permission.DELETE_CACHE_FILES"/>
+ <permission name="android.permission.DELETE_PACKAGES"/>
+ <permission name="android.permission.DUMP"/>
+ <permission name="android.permission.FORCE_STOP_PACKAGES"/>
+ <permission name="android.permission.GET_APP_OPS_STATS"/>
+ <permission name="android.permission.INSTALL_LOCATION_PROVIDER"/>
+ <permission name="android.permission.INSTALL_PACKAGES"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.MANAGE_ACTIVITY_STACKS"/>
+ <permission name="android.permission.MANAGE_DEVICE_ADMINS"/>
+ <permission name="android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS"/>
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ <permission name="android.permission.MOUNT_FORMAT_FILESYSTEMS"/>
+ <permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
+ <permission name="android.permission.MOVE_PACKAGE"/>
+ <permission name="android.permission.READ_FRAME_BUFFER"/>
+ <permission name="android.permission.REAL_GET_TASKS"/>
+ <permission name="android.permission.REGISTER_CALL_PROVIDER"/>
+ <permission name="android.permission.REGISTER_CONNECTION_MANAGER"/>
+ <permission name="android.permission.REGISTER_SIM_SUBSCRIPTION"/>
+ <permission name="android.permission.RETRIEVE_WINDOW_CONTENT"/>
+ <permission name="android.permission.SET_ALWAYS_FINISH"/>
+ <permission name="android.permission.SET_ANIMATION_SCALE"/>
+ <permission name="android.permission.SET_DEBUG_APP"/>
+ <permission name="android.permission.SET_PROCESS_LIMIT"/>
+ <permission name="android.permission.SIGNAL_PERSISTENT_PROCESSES"/>
+ <permission name="android.permission.STOP_APP_SWITCHES"/>
+ <permission name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME"/>
+ <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
+ <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
+ <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.statementservice">
+ <permission name="android.permission.INTENT_FILTER_VERIFICATION_AGENT"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.storagemanager">
+ <permission name="android.permission.DELETE_PACKAGES"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.PACKAGE_USAGE_STATS"/>
+ <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.systemui">
+ <permission name="android.permission.BATTERY_STATS"/>
+ <permission name="android.permission.BIND_APPWIDGET"/>
+ <permission name="android.permission.BLUETOOTH_PRIVILEGED"/>
+ <permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
+ <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
+ <permission name="android.permission.CONTROL_VPN"/>
+ <permission name="android.permission.DUMP"/>
+ <permission name="android.permission.GET_APP_OPS_STATS"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.MANAGE_ACTIVITY_STACKS"/>
+ <permission name="android.permission.MANAGE_USB"/>
+ <permission name="android.permission.MANAGE_USERS"/>
+ <permission name="android.permission.MASTER_CLEAR"/>
+ <permission name="android.permission.MEDIA_CONTENT_CONTROL"/>
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ <permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
+ <permission name="android.permission.OVERRIDE_WIFI_CONFIG"/>
+ <permission name="android.permission.READ_DREAM_STATE"/>
+ <permission name="android.permission.READ_FRAME_BUFFER"/>
+ <permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
+ <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
+ <permission name="android.permission.REAL_GET_TASKS"/>
+ <permission name="android.permission.RECEIVE_MEDIA_RESOURCE_USAGE"/>
+ <permission name="android.permission.START_TASKS_FROM_RECENTS"/>
+ <permission name="android.permission.STATUS_BAR"/>
+ <permission name="android.permission.STOP_APP_SWITCHES"/>
+ <permission name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME"/>
+ <permission name="android.permission.TETHER_PRIVILEGED"/>
+ <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
+ <permission name="android.permission.WRITE_DREAM_STATE"/>
+ <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
+ <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
+ </privapp-permissions>
+
+ <privapp-permissions package="com.android.vpndialogs">
+ <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
+ <permission name="android.permission.CONTROL_VPN"/>
+ </privapp-permissions>
+
+</permissions>
\ No newline at end of file
diff --git a/libs/hwui/hwui/Typeface.cpp b/libs/hwui/hwui/Typeface.cpp
index 59b1185..f95d98c 100644
--- a/libs/hwui/hwui/Typeface.cpp
+++ b/libs/hwui/hwui/Typeface.cpp
@@ -49,60 +49,10 @@
}
Typeface* gDefaultTypeface = NULL;
-pthread_once_t gDefaultTypefaceOnce = PTHREAD_ONCE_INIT;
-
-// This installs a default typeface (from a hardcoded path) that allows
-// layouts to work (not crash on null pointer) before the default
-// typeface is set. This happens if HWUI is used outside of zygote/app_process.
-static minikin::FontCollection *makeFontCollection() {
- std::vector<minikin::FontFamily *>typefaces;
- const char *fns[] = {
- "/system/fonts/Roboto-Regular.ttf",
- };
-
- minikin::FontFamily *family = new minikin::FontFamily();
- for (size_t i = 0; i < sizeof(fns)/sizeof(fns[0]); i++) {
- const char *fn = fns[i];
- ALOGD("makeFontCollection adding %s", fn);
- sk_sp<SkTypeface> skFace = SkTypeface::MakeFromFile(fn);
- if (skFace != NULL) {
- // TODO: might be a nice optimization to get access to the underlying font
- // data, but would require us opening the file ourselves and passing that
- // to the appropriate Create method of SkTypeface.
- minikin::MinikinFont *font = new MinikinFontSkia(std::move(skFace), NULL, 0, 0);
- family->addFont(font);
- font->Unref();
- } else {
- ALOGE("failed to create font %s", fn);
- }
- }
- typefaces.push_back(family);
-
- minikin::FontCollection *result = new minikin::FontCollection(typefaces);
- family->Unref();
- return result;
-}
-
-static void getDefaultTypefaceOnce() {
- minikin::Layout::init();
- if (gDefaultTypeface == NULL) {
- // We expect the client to set a default typeface, but provide a
- // default so we can make progress before that happens.
- gDefaultTypeface = new Typeface;
- gDefaultTypeface->fFontCollection = makeFontCollection();
- gDefaultTypeface->fSkiaStyle = SkTypeface::kNormal;
- gDefaultTypeface->fBaseWeight = 400;
- resolveStyle(gDefaultTypeface);
- }
-}
Typeface* Typeface::resolveDefault(Typeface* src) {
- if (src == NULL) {
- pthread_once(&gDefaultTypefaceOnce, getDefaultTypefaceOnce);
- return gDefaultTypeface;
- } else {
- return src;
- }
+ LOG_ALWAYS_FATAL_IF(gDefaultTypeface == nullptr);
+ return src == nullptr ? gDefaultTypeface : src;
}
Typeface* Typeface::createFromTypeface(Typeface* src, SkTypeface::Style style) {
@@ -164,4 +114,27 @@
gDefaultTypeface = face;
}
+void Typeface::setRobotoTypefaceForTest() {
+ const char* kRobotoFont = "/system/fonts/Roboto-Regular.ttf";
+ sk_sp<SkTypeface> typeface = SkTypeface::MakeFromFile(kRobotoFont);
+ LOG_ALWAYS_FATAL_IF(typeface == nullptr, "Failed to make typeface from %s", kRobotoFont);
+
+ minikin::FontFamily* family = new minikin::FontFamily();
+ minikin::MinikinFont* font = new MinikinFontSkia(std::move(typeface), nullptr, 0, 0);
+ family->addFont(font);
+ font->Unref();
+
+ std::vector<minikin::FontFamily*> typefaces = { family };
+ minikin::FontCollection *collection = new minikin::FontCollection(typefaces);
+ family->Unref();
+
+ Typeface* hwTypeface = new Typeface();
+ hwTypeface->fFontCollection = collection;
+ hwTypeface->fSkiaStyle = SkTypeface::kNormal;
+ hwTypeface->fBaseWeight = 400;
+ hwTypeface->fStyle = minikin::FontStyle(4 /* weight */, false /* italic */);
+
+ Typeface::setDefault(hwTypeface);
+}
+
}
diff --git a/libs/hwui/hwui/Typeface.h b/libs/hwui/hwui/Typeface.h
index ed0a7ebd..1be630c 100644
--- a/libs/hwui/hwui/Typeface.h
+++ b/libs/hwui/hwui/Typeface.h
@@ -48,6 +48,9 @@
static Typeface* createFromFamilies(const std::vector<minikin::FontFamily*>& families);
static void setDefault(Typeface* face);
+
+ // Sets roboto font as the default typeface for testing purpose.
+ static void setRobotoTypefaceForTest();
};
}
diff --git a/libs/hwui/tests/macrobench/main.cpp b/libs/hwui/tests/macrobench/main.cpp
index ebc1dd7..1f56222 100644
--- a/libs/hwui/tests/macrobench/main.cpp
+++ b/libs/hwui/tests/macrobench/main.cpp
@@ -17,6 +17,7 @@
#include "tests/common/LeakChecker.h"
#include "tests/common/TestScene.h"
+#include "hwui/Typeface.h"
#include "protos/hwui.pb.h"
#include "Properties.h"
@@ -303,6 +304,8 @@
// set defaults
gOpts.count = 150;
+ Typeface::setRobotoTypefaceForTest();
+
parseOptions(argc, argv);
if (!gBenchmarkReporter && gOpts.renderOffscreen) {
gBenchmarkReporter.reset(new benchmark::ConsoleReporter());
diff --git a/libs/hwui/tests/microbench/main.cpp b/libs/hwui/tests/microbench/main.cpp
index 9771c85..b5abf5b 100644
--- a/libs/hwui/tests/microbench/main.cpp
+++ b/libs/hwui/tests/microbench/main.cpp
@@ -17,6 +17,8 @@
#include "debug/GlesDriver.h"
#include "debug/NullGlesDriver.h"
+#include "hwui/Typeface.h"
+
#include <benchmark/benchmark.h>
#include <memory>
@@ -27,6 +29,7 @@
int main(int argc, char** argv) {
debug::GlesDriver::replace(std::make_unique<debug::NullGlesDriver>());
benchmark::Initialize(&argc, argv);
+ Typeface::setRobotoTypefaceForTest();
benchmark::RunSpecifiedBenchmarks();
return 0;
}
diff --git a/libs/hwui/tests/unit/main.cpp b/libs/hwui/tests/unit/main.cpp
index d05bdbf..cea84c0 100644
--- a/libs/hwui/tests/unit/main.cpp
+++ b/libs/hwui/tests/unit/main.cpp
@@ -20,6 +20,7 @@
#include "Caches.h"
#include "debug/GlesDriver.h"
#include "debug/NullGlesDriver.h"
+#include "hwui/Typeface.h"
#include "thread/TaskManager.h"
#include "tests/common/LeakChecker.h"
@@ -50,6 +51,13 @@
raise(sig);
}
+class TypefaceEnvironment : public testing::Environment {
+public:
+ virtual void SetUp() {
+ Typeface::setRobotoTypefaceForTest();
+ }
+};
+
int main(int argc, char* argv[]) {
// Register a crash handler
struct sigaction sa;
@@ -69,6 +77,8 @@
testing::InitGoogleTest(&argc, argv);
testing::InitGoogleMock(&argc, argv);
+ testing::AddGlobalTestEnvironment(new TypefaceEnvironment());
+
int ret = RUN_ALL_TESTS();
test::LeakChecker::checkForLeaks();
return ret;
diff --git a/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp
index fe1ee02..fa3d8bd 100644
--- a/libs/storage/IMountService.cpp
+++ b/libs/storage/IMountService.cpp
@@ -553,7 +553,7 @@
}
};
-IMPLEMENT_META_INTERFACE(MountService, "android.os.storage.IMountService")
+IMPLEMENT_META_INTERFACE(MountService, "android.os.storage.IStorageManager")
// ----------------------------------------------------------------------
diff --git a/libs/storage/IMountServiceListener.cpp b/libs/storage/IMountServiceListener.cpp
index 6a093fd..033d70d 100644
--- a/libs/storage/IMountServiceListener.cpp
+++ b/libs/storage/IMountServiceListener.cpp
@@ -34,7 +34,7 @@
const String16& /* oldState */, const String16& /* newState */) { }
};
-IMPLEMENT_META_INTERFACE(MountServiceListener, "android.os.storage.IMountServiceListener")
+IMPLEMENT_META_INTERFACE(MountServiceListener, "android.os.storage.IStorageEventListener")
// ----------------------------------------------------------------------
diff --git a/libs/storage/IMountShutdownObserver.cpp b/libs/storage/IMountShutdownObserver.cpp
index 6114d4a..e5de603 100644
--- a/libs/storage/IMountShutdownObserver.cpp
+++ b/libs/storage/IMountShutdownObserver.cpp
@@ -31,7 +31,7 @@
virtual void onShutDownComplete(const int32_t /* statusCode */) {}
};
-IMPLEMENT_META_INTERFACE(MountShutdownObserver, "android.os.storage.IMountShutdownObserver")
+IMPLEMENT_META_INTERFACE(MountShutdownObserver, "android.os.storage.IStorageShutdownObserver")
status_t BnMountShutdownObserver::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
diff --git a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
index bfc9ff3..7fa5736 100644
--- a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
+++ b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
@@ -27,7 +27,7 @@
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.text.Editable;
import android.text.TextWatcher;
@@ -64,7 +64,7 @@
Handler mHandler;
IBackupManager mBackupManager;
- IMountService mMountService;
+ IStorageManager mStorageManager;
FullObserver mObserver;
int mToken;
boolean mIsEncrypted;
@@ -158,7 +158,7 @@
}
mBackupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
- mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
mHandler = new ObserverHandler(getApplicationContext());
final Object oldObserver = getLastNonConfigurationInstance();
@@ -271,14 +271,14 @@
boolean deviceIsEncrypted() {
try {
- return mMountService.getEncryptionState()
+ return mStorageManager.getEncryptionState()
!= StorageManager.ENCRYPTION_STATE_NONE
- && mMountService.getPasswordType()
+ && mStorageManager.getPasswordType()
!= StorageManager.CRYPT_TYPE_DEFAULT;
} catch (Exception e) {
- // If we can't talk to the mount service we have a serious problem; fail
+ // If we can't talk to the storagemanager service we have a serious problem; fail
// "secure" i.e. assuming that the device is encrypted.
- Slog.e(TAG, "Unable to communicate with mount service: " + e.getMessage());
+ Slog.e(TAG, "Unable to communicate with storagemanager service: " + e.getMessage());
return true;
}
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index dd543a3..d784a3a 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -645,7 +645,7 @@
if (upgradeVersion == 45) {
/*
- * New settings for MountService
+ * New settings for StorageManagerService
*/
db.beginTransaction();
try {
diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java
index f6e558f..15ce90f 100644
--- a/packages/Shell/src/com/android/shell/BugreportReceiver.java
+++ b/packages/Shell/src/com/android/shell/BugreportReceiver.java
@@ -40,8 +40,7 @@
private static final String TAG = "BugreportReceiver";
/**
- * Always keep the newest 8 bugreport files; 4 reports and 4 screenshots are
- * roughly 17MB of disk space.
+ * Always keep the newest 8 bugreport files.
*/
private static final int MIN_KEEP_COUNT = 8;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 69d76e5..068631d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -1226,7 +1226,7 @@
}
private String getKeyguardOrLockScreenString() {
- if (mQs.isCustomizing()) {
+ if (mQs != null && mQs.isCustomizing()) {
return getContext().getString(R.string.accessibility_desc_quick_settings_edit);
} else if (mStatusBarState == StatusBarState.KEYGUARD) {
return getContext().getString(R.string.accessibility_desc_lock_screen);
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/ThemePreference.java b/packages/SystemUI/src/com/android/systemui/tuner/ThemePreference.java
index e5bb3d5..a068172 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/ThemePreference.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/ThemePreference.java
@@ -40,12 +40,13 @@
@Override
public void onAttached() {
super.onAttached();
- File file = new File("/vendor/overlay");
- ArrayList<String> options = Lists.newArrayList(file.list());
String def = SystemProperties.get("ro.boot.vendor.overlay.theme");
if (TextUtils.isEmpty(def)) {
def = getContext().getString(R.string.default_theme);
}
+ String[] fileList = new File("/vendor/overlay").list();
+ ArrayList<String> options = fileList != null
+ ? Lists.newArrayList(fileList) : new ArrayList<>();
if (!options.contains(def)) {
options.add(0, def);
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
index 8ca277e..42b06b2 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
@@ -797,7 +797,7 @@
// update slider
final boolean enableSlider = !zenMuted;
- final int vlevel = row.ss.muted && (isRingVibrate || !isRingStream && !zenMuted) ? 0
+ final int vlevel = row.ss.muted && (!isRingStream && !zenMuted) ? 0
: row.ss.level;
updateVolumeRowSliderH(row, enableSlider, vlevel);
}
diff --git a/preloaded-classes b/preloaded-classes
index 7aa029c..a79ae50 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -1726,9 +1726,9 @@
android.os.Vibrator
android.os.ZygoteStartFailedEx
android.os.health.SystemHealthManager
-android.os.storage.IMountService
-android.os.storage.IMountService$Stub
-android.os.storage.IMountService$Stub$Proxy
+android.os.storage.IStorageManager
+android.os.storage.IStorageManager$Stub
+android.os.storage.IStorageManager$Stub$Proxy
android.os.storage.StorageManager
android.os.storage.StorageVolume
android.os.storage.StorageVolume$1
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 539f748..8151c8a 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -80,7 +80,7 @@
import android.os.UserHandle;
import android.os.WorkSource;
import android.os.Environment.UserEnvironment;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.system.ErrnoException;
@@ -268,7 +268,7 @@
private IActivityManager mActivityManager;
private PowerManager mPowerManager;
private AlarmManager mAlarmManager;
- private IMountService mMountService;
+ private IStorageManager mStorageManager;
IBackupManager mBackupManagerBinder;
boolean mEnabled; // access to this is synchronized on 'this'
@@ -1079,7 +1079,7 @@
mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
- mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
mBackupManagerBinder = Trampoline.asInterface(parent.asBinder());
@@ -3982,14 +3982,14 @@
boolean deviceIsEncrypted() {
try {
- return mMountService.getEncryptionState()
+ return mStorageManager.getEncryptionState()
!= StorageManager.ENCRYPTION_STATE_NONE
- && mMountService.getPasswordType()
+ && mStorageManager.getPasswordType()
!= StorageManager.CRYPT_TYPE_DEFAULT;
} catch (Exception e) {
- // If we can't talk to the mount service we have a serious problem; fail
+ // If we can't talk to the storagemanager service we have a serious problem; fail
// "secure" i.e. assuming that the device is encrypted.
- Slog.e(TAG, "Unable to communicate with mount service: " + e.getMessage());
+ Slog.e(TAG, "Unable to communicate with storagemanager service: " + e.getMessage());
return true;
}
}
diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java
index 7c2eea3f..570843e 100644
--- a/services/core/java/com/android/server/AppOpsService.java
+++ b/services/core/java/com/android/server/AppOpsService.java
@@ -54,7 +54,7 @@
import android.os.ShellCallback;
import android.os.ShellCommand;
import android.os.UserHandle;
-import android.os.storage.MountServiceInternal;
+import android.os.storage.StorageManagerInternal;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.AtomicFile;
@@ -294,10 +294,10 @@
}
}
- MountServiceInternal mountServiceInternal = LocalServices.getService(
- MountServiceInternal.class);
- mountServiceInternal.addExternalStoragePolicy(
- new MountServiceInternal.ExternalStorageMountPolicy() {
+ StorageManagerInternal storageManagerInternal = LocalServices.getService(
+ StorageManagerInternal.class);
+ storageManagerInternal.addExternalStoragePolicy(
+ new StorageManagerInternal.ExternalStorageMountPolicy() {
@Override
public int getMountMode(int uid, String packageName) {
if (Process.isIsolated(uid)) {
diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags
index 74ff41c..eb2cd0b 100644
--- a/services/core/java/com/android/server/EventLogTags.logtags
+++ b/services/core/java/com/android/server/EventLogTags.logtags
@@ -248,7 +248,7 @@
51501 idle_maintenance_window_finish (time|2|3), (lastUserActivity|2|3), (batteryLevel|1|6), (batteryCharging|1|5)
# ---------------------------
-# MountService.java
+# StorageManagerService.java
# ---------------------------
2755 fstrim_start (time|2|3)
2756 fstrim_finish (time|2|3)
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index 991ce45..6701431 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -51,7 +51,7 @@
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ShellCallback;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.os.ServiceManager;
import android.os.StrictMode;
@@ -1160,10 +1160,10 @@
private void addUserKeyAuth(int userId, byte[] token, byte[] secret)
throws RemoteException {
final UserInfo userInfo = UserManager.get(mContext).getUserInfo(userId);
- final IMountService mountService = getMountService();
+ final IStorageManager storageManager = getStorageManager();
final long callingId = Binder.clearCallingIdentity();
try {
- mountService.addUserKeyAuth(userId, userInfo.serialNumber, token, secret);
+ storageManager.addUserKeyAuth(userId, userInfo.serialNumber, token, secret);
} finally {
Binder.restoreCallingIdentity(callingId);
}
@@ -1171,10 +1171,10 @@
private void fixateNewestUserKeyAuth(int userId)
throws RemoteException {
- final IMountService mountService = getMountService();
+ final IStorageManager storageManager = getStorageManager();
final long callingId = Binder.clearCallingIdentity();
try {
- mountService.fixateNewestUserKeyAuth(userId);
+ storageManager.fixateNewestUserKeyAuth(userId);
} finally {
Binder.restoreCallingIdentity(callingId);
}
@@ -1488,7 +1488,7 @@
// we should, within the first minute of decrypting the phone if this
// service can't connect to vold, it restarts, and then the new instance
// does successfully connect.
- final IMountService service = getMountService();
+ final IStorageManager service = getStorageManager();
String password;
long identity = Binder.clearCallingIdentity();
try {
@@ -1651,10 +1651,10 @@
Secure.LOCK_SCREEN_OWNER_INFO
};
- private IMountService getMountService() {
+ private IStorageManager getStorageManager() {
final IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
}
return null;
}
diff --git a/services/core/java/com/android/server/MountServiceIdler.java b/services/core/java/com/android/server/MountServiceIdler.java
index 956568d..d8bd0bb 100644
--- a/services/core/java/com/android/server/MountServiceIdler.java
+++ b/services/core/java/com/android/server/MountServiceIdler.java
@@ -67,7 +67,7 @@
// that lets us cleanly end our idle timeslice. It's safe to call
// finishIdle() from any thread.
mJobParams = params;
- MountService ms = MountService.sSelf;
+ StorageManagerService ms = StorageManagerService.sSelf;
if (ms != null) {
synchronized (mFinishCallback) {
mStarted = true;
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/StorageManagerService.java
similarity index 98%
rename from services/core/java/com/android/server/MountService.java
rename to services/core/java/com/android/server/StorageManagerService.java
index ee625d9..11fabb4 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -68,11 +68,11 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.DiskInfo;
-import android.os.storage.IMountService;
-import android.os.storage.IMountServiceListener;
-import android.os.storage.IMountShutdownObserver;
+import android.os.storage.IStorageEventListener;
+import android.os.storage.IStorageShutdownObserver;
import android.os.storage.IObbActionListener;
-import android.os.storage.MountServiceInternal;
+import android.os.storage.IStorageManager;
+import android.os.storage.StorageManagerInternal;
import android.os.storage.OnObbStateChangeListener;
import android.os.storage.StorageManager;
import android.os.storage.StorageResultCode;
@@ -149,14 +149,14 @@
* watch for and manage dynamically added storage, such as SD cards and USB mass
* storage. Also decides how storage should be presented to users on the device.
*/
-class MountService extends IMountService.Stub
+class StorageManagerService extends IStorageManager.Stub
implements INativeDaemonConnectorCallbacks, Watchdog.Monitor {
// Static direct instance pointer for the tightly-coupled idle service to use
- static MountService sSelf = null;
+ static StorageManagerService sSelf = null;
public static class Lifecycle extends SystemService {
- private MountService mMountService;
+ private StorageManagerService mStorageManagerService;
public Lifecycle(Context context) {
super(context);
@@ -164,33 +164,33 @@
@Override
public void onStart() {
- mMountService = new MountService(getContext());
- publishBinderService("mount", mMountService);
- mMountService.start();
+ mStorageManagerService = new StorageManagerService(getContext());
+ publishBinderService("mount", mStorageManagerService);
+ mStorageManagerService.start();
}
@Override
public void onBootPhase(int phase) {
if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
- mMountService.systemReady();
+ mStorageManagerService.systemReady();
} else if (phase == SystemService.PHASE_BOOT_COMPLETED) {
- mMountService.bootCompleted();
+ mStorageManagerService.bootCompleted();
}
}
@Override
public void onSwitchUser(int userHandle) {
- mMountService.mCurrentUserId = userHandle;
+ mStorageManagerService.mCurrentUserId = userHandle;
}
@Override
public void onUnlockUser(int userHandle) {
- mMountService.onUnlockUser(userHandle);
+ mStorageManagerService.onUnlockUser(userHandle);
}
@Override
public void onCleanupUser(int userHandle) {
- mMountService.onCleanupUser(userHandle);
+ mStorageManagerService.onCleanupUser(userHandle);
}
}
@@ -209,7 +209,7 @@
*/
private static final boolean EMULATE_FBE_SUPPORTED = true;
- private static final String TAG = "MountService";
+ private static final String TAG = "StorageManagerService";
private static final String TAG_STORAGE_BENCHMARK = "storage_benchmark";
private static final String TAG_STORAGE_TRIM = "storage_trim";
@@ -500,7 +500,8 @@
final private Map<String, ObbState> mObbPathToStateMap = new HashMap<String, ObbState>();
// Not guarded by a lock.
- private final MountServiceInternalImpl mMountServiceInternal = new MountServiceInternalImpl();
+ private final StorageManagerInternalImpl mStorageManagerInternal
+ = new StorageManagerInternalImpl();
class ObbState implements IBinder.DeathRecipient {
public ObbState(String rawPath, String canonicalPath, int callingUid,
@@ -609,8 +610,8 @@
private static final int H_PARTITION_FORGET = 9;
private static final int H_RESET = 10;
- class MountServiceHandler extends Handler {
- public MountServiceHandler(Looper looper) {
+ class StorageManagerServiceHandler extends Handler {
+ public StorageManagerServiceHandler(Looper looper) {
super(looper);
}
@@ -661,7 +662,7 @@
break;
}
case H_SHUTDOWN: {
- final IMountShutdownObserver obs = (IMountShutdownObserver) msg.obj;
+ final IStorageShutdownObserver obs = (IStorageShutdownObserver) msg.obj;
boolean success = false;
try {
success = mConnector.execute("volume", "shutdown").isClassOk();
@@ -1481,11 +1482,11 @@
}
/**
- * Constructs a new MountService instance
+ * Constructs a new StorageManagerService instance
*
* @param context Binder context for this service
*/
- public MountService(Context context) {
+ public StorageManagerService(Context context) {
sSelf = this;
mContext = context;
@@ -1497,9 +1498,9 @@
HandlerThread hthread = new HandlerThread(TAG);
hthread.start();
- mHandler = new MountServiceHandler(hthread.getLooper());
+ mHandler = new StorageManagerServiceHandler(hthread.getLooper());
- // Add OBB Action Handler to MountService thread.
+ // Add OBB Action Handler to StorageManagerService thread.
mObbActionHandler = new ObbActionHandler(IoThread.get().getLooper());
// Initialize the last-fstrim tracking if necessary
@@ -1525,7 +1526,7 @@
readSettingsLocked();
}
- LocalServices.addService(MountServiceInternal.class, mMountServiceInternal);
+ LocalServices.addService(StorageManagerInternal.class, mStorageManagerInternal);
/*
* Create the connection to vold with a maximum queue of twice the
@@ -1685,17 +1686,17 @@
*/
@Override
- public void registerListener(IMountServiceListener listener) {
+ public void registerListener(IStorageEventListener listener) {
mCallbacks.register(listener);
}
@Override
- public void unregisterListener(IMountServiceListener listener) {
+ public void unregisterListener(IStorageEventListener listener) {
mCallbacks.unregister(listener);
}
@Override
- public void shutdown(final IMountShutdownObserver observer) {
+ public void shutdown(final IStorageShutdownObserver observer) {
enforcePermission(android.Manifest.permission.SHUTDOWN);
Slog.i(TAG, "Shutting down");
@@ -3045,7 +3046,7 @@
final long token = Binder.clearCallingIdentity();
try {
userKeyUnlocked = isUserKeyUnlocked(userId);
- storagePermission = mMountServiceInternal.hasExternalStorage(uid, packageName);
+ storagePermission = mStorageManagerInternal.hasExternalStorage(uid, packageName);
} finally {
Binder.restoreCallingIdentity(token);
}
@@ -3162,7 +3163,7 @@
for (final ObbState o : obbStates) {
if (o.rawPath.equals(obbState.rawPath)) {
throw new IllegalStateException("Attempt to add ObbState twice. "
- + "This indicates an error in the MountService logic.");
+ + "This indicates an error in the StorageManagerService logic.");
}
}
}
@@ -3424,7 +3425,7 @@
try {
mObbState.token.onObbResult(mObbState.rawPath, mObbState.nonce, status);
} catch (RemoteException e) {
- Slog.w(TAG, "MountServiceListener went away while calling onObbStateChanged");
+ Slog.w(TAG, "StorageEventListener went away while calling onObbStateChanged");
}
}
}
@@ -3614,18 +3615,18 @@
private static final int MSG_DISK_SCANNED = 5;
private static final int MSG_DISK_DESTROYED = 6;
- private final RemoteCallbackList<IMountServiceListener>
+ private final RemoteCallbackList<IStorageEventListener>
mCallbacks = new RemoteCallbackList<>();
public Callbacks(Looper looper) {
super(looper);
}
- public void register(IMountServiceListener callback) {
+ public void register(IStorageEventListener callback) {
mCallbacks.register(callback);
}
- public void unregister(IMountServiceListener callback) {
+ public void unregister(IStorageEventListener callback) {
mCallbacks.unregister(callback);
}
@@ -3634,7 +3635,7 @@
final SomeArgs args = (SomeArgs) msg.obj;
final int n = mCallbacks.beginBroadcast();
for (int i = 0; i < n; i++) {
- final IMountServiceListener callback = mCallbacks.getBroadcastItem(i);
+ final IStorageEventListener callback = mCallbacks.getBroadcastItem(i);
try {
invokeCallback(callback, msg.what, args);
} catch (RemoteException ignored) {
@@ -3644,7 +3645,7 @@
args.recycle();
}
- private void invokeCallback(IMountServiceListener callback, int what, SomeArgs args)
+ private void invokeCallback(IStorageEventListener callback, int what, SomeArgs args)
throws RemoteException {
switch (what) {
case MSG_STORAGE_STATE_CHANGED: {
@@ -3829,7 +3830,7 @@
}
}
- private final class MountServiceInternalImpl extends MountServiceInternal {
+ private final class StorageManagerInternalImpl extends StorageManagerInternal {
// Not guarded by a lock.
private final CopyOnWriteArrayList<ExternalStorageMountPolicy> mPolicies =
new CopyOnWriteArrayList<>();
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index e080fd9..77d36f2 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -196,8 +196,8 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.os.WorkSource;
-import android.os.storage.IMountService;
-import android.os.storage.MountServiceInternal;
+import android.os.storage.IStorageManager;
+import android.os.storage.StorageManagerInternal;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.service.voice.IVoiceInteractionSession;
@@ -2097,9 +2097,9 @@
try {
Locale l = (Locale) msg.obj;
IBinder service = ServiceManager.getService("mount");
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
Log.d(TAG, "Storing locale " + l.toLanguageTag() + " for decryption UI");
- mountService.setField(StorageManager.SYSTEM_LOCALE_KEY, l.toLanguageTag());
+ storageManager.setField(StorageManager.SYSTEM_LOCALE_KEY, l.toLanguageTag());
} catch (RemoteException e) {
Log.e(TAG, "Error storing locale for decryption UI", e);
}
@@ -3599,9 +3599,9 @@
final IPackageManager pm = AppGlobals.getPackageManager();
permGids = pm.getPackageGids(app.info.packageName,
MATCH_DEBUG_TRIAGED_MISSING, app.userId);
- MountServiceInternal mountServiceInternal = LocalServices.getService(
- MountServiceInternal.class);
- mountExternal = mountServiceInternal.getExternalStorageMountMode(uid,
+ StorageManagerInternal storageManagerInternal = LocalServices.getService(
+ StorageManagerInternal.class);
+ mountExternal = storageManagerInternal.getExternalStorageMountMode(uid,
app.info.packageName);
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
@@ -6490,11 +6490,12 @@
// SDK can see it. Since access to the serial is now behind a
// permission we push down the value.
String buildSerial = Build.UNKNOWN;
- if (appInfo.targetSdkVersion <= Build.VERSION_CODES.N_MR1) {
+ // TODO: SHTOPSHIP Uncomment the check when clients migrate
+// if (appInfo.targetSdkVersion <= Build.VERSION_CODES.N_MR1) {
buildSerial = IDeviceIdentifiersPolicyService.Stub.asInterface(
ServiceManager.getService(Context.DEVICE_IDENTIFIERS_SERVICE))
.getSerial();
- }
+// }
thread.bindApplication(processName, appInfo, providers, app.instrumentationClass,
profilerInfo, app.instrumentationArguments, app.instrumentationWatcher,
diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
index 52ad72d..14b843a 100644
--- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
+++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
@@ -80,6 +80,7 @@
import static android.app.ActivityManager.RESIZE_MODE_USER;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
+import static android.view.Display.INVALID_DISPLAY;
final class ActivityManagerShellCommand extends ShellCommand {
public static final String NO_CLASS_ERROR_CODE = "Error type 3";
@@ -114,6 +115,7 @@
private String mProfileFile;
private int mSamplingInterval;
private boolean mAutoStop;
+ private int mDisplayId;
private int mStackId;
final boolean mDumping;
@@ -249,6 +251,7 @@
mSamplingInterval = 0;
mAutoStop = false;
mUserId = defUser;
+ mDisplayId = INVALID_DISPLAY;
mStackId = INVALID_STACK_ID;
return Intent.parseCommandArgs(this, new Intent.CommandOptionHandler() {
@@ -278,6 +281,8 @@
mUserId = UserHandle.parseUserArg(getNextArgRequired());
} else if (opt.equals("--receiver-permission")) {
mReceiverPermission = getNextArgRequired();
+ } else if (opt.equals("--display")) {
+ mDisplayId = Integer.parseInt(getNextArgRequired());
} else if (opt.equals("--stack")) {
mStackId = Integer.parseInt(getNextArgRequired());
} else {
@@ -354,6 +359,10 @@
int res;
final long startTime = SystemClock.uptimeMillis();
ActivityOptions options = null;
+ if (mDisplayId != INVALID_DISPLAY) {
+ options = ActivityOptions.makeBasic();
+ options.setLaunchDisplayId(mDisplayId);
+ }
if (mStackId != INVALID_STACK_ID) {
options = ActivityOptions.makeBasic();
options.setLaunchStackId(mStackId);
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 282ec50..539ac16 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -38,6 +38,8 @@
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.Display.FLAG_PRIVATE;
+import static android.view.Display.INVALID_DISPLAY;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALL;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONTAINERS;
@@ -90,6 +92,7 @@
import static com.android.server.wm.AppTransition.TRANSIT_DOCK_TASK_FROM_RECENTS;
import android.Manifest;
+import android.annotation.NonNull;
import android.annotation.UserIdInt;
import android.app.Activity;
import android.app.ActivityManager;
@@ -1483,16 +1486,35 @@
Slog.w(TAG, message);
return false;
}
- if (options != null && options.getLaunchTaskId() != -1) {
- final int startInTaskPerm = mService.checkPermission(START_TASKS_FROM_RECENTS,
- callingPid, callingUid);
- if (startInTaskPerm != PERMISSION_GRANTED) {
- final String msg = "Permission Denial: starting " + intent.toString()
- + " from " + callerApp + " (pid=" + callingPid
- + ", uid=" + callingUid + ") with launchTaskId="
- + options.getLaunchTaskId();
- Slog.w(TAG, msg);
- throw new SecurityException(msg);
+ if (options != null) {
+ if (options.getLaunchTaskId() != INVALID_STACK_ID) {
+ final int startInTaskPerm = mService.checkPermission(START_TASKS_FROM_RECENTS,
+ callingPid, callingUid);
+ if (startInTaskPerm != PERMISSION_GRANTED) {
+ final String msg = "Permission Denial: starting " + intent.toString()
+ + " from " + callerApp + " (pid=" + callingPid
+ + ", uid=" + callingUid + ") with launchTaskId="
+ + options.getLaunchTaskId();
+ Slog.w(TAG, msg);
+ throw new SecurityException(msg);
+ }
+ }
+ // Check if someone tries to launch an activity on a private display with a different
+ // owner.
+ final int launchDisplayId = options.getLaunchDisplayId();
+ if (launchDisplayId != INVALID_DISPLAY) {
+ final ActivityDisplay activityDisplay = mActivityDisplays.get(launchDisplayId);
+ if (activityDisplay != null
+ && (activityDisplay.mDisplay.getFlags() & FLAG_PRIVATE) != 0) {
+ if (activityDisplay.mDisplay.getOwnerUid() != callingUid) {
+ final String msg = "Permission Denial: starting " + intent.toString()
+ + " from " + callerApp + " (pid=" + callingPid
+ + ", uid=" + callingUid + ") with launchDisplayId="
+ + launchDisplayId;
+ Slog.w(TAG, msg);
+ throw new SecurityException(msg);
+ }
+ }
}
}
@@ -1937,7 +1959,7 @@
}
ActivityStack getStack(int stackId, boolean createStaticStackIfNeeded, boolean createOnTop) {
- ActivityContainer activityContainer = mActivityContainers.get(stackId);
+ final ActivityContainer activityContainer = mActivityContainers.get(stackId);
if (activityContainer != null) {
return activityContainer.mStack;
}
@@ -1948,6 +1970,40 @@
return createStackOnDisplay(stackId, DEFAULT_DISPLAY, createOnTop);
}
+ /**
+ * Get a topmost stack on the display, that is a valid launch stack for specified activity.
+ * If there is no such stack, new dynamic stack can be created.
+ * @param displayId Target display.
+ * @param r Activity that should be launched there.
+ * @return Existing stack if there is a valid one, new dynamic stack if it is valid or null.
+ */
+ ActivityStack getValidLaunchStackOnDisplay(int displayId, @NonNull ActivityRecord r) {
+ final ActivityDisplay activityDisplay = mActivityDisplays.get(displayId);
+ if (activityDisplay == null) {
+ throw new IllegalArgumentException(
+ "Display with displayId=" + displayId + " not found.");
+ }
+
+ // Return the topmost valid stack on the display.
+ for (int i = activityDisplay.mStacks.size() - 1; i >= 0; --i) {
+ final ActivityStack stack = activityDisplay.mStacks.get(i);
+ if (mService.mActivityStarter.isValidLaunchStackId(stack.mStackId, r)) {
+ return stack;
+ }
+ }
+
+ // If there is no valid stack on the external display - check if new dynamic stack will do.
+ if (displayId != Display.DEFAULT_DISPLAY) {
+ final int newDynamicStackId = getNextStackId();
+ if (mService.mActivityStarter.isValidLaunchStackId(newDynamicStackId, r)) {
+ return createStackOnDisplay(newDynamicStackId, displayId, true /*onTop*/);
+ }
+ }
+
+ Slog.w(TAG, "getValidLaunchStackOnDisplay: can't launch on displayId " + displayId);
+ return null;
+ }
+
ArrayList<ActivityStack> getStacks() {
ArrayList<ActivityStack> allStacks = new ArrayList<>();
for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
@@ -2326,11 +2382,15 @@
* Restores a recent task to a stack
* @param task The recent task to be restored.
* @param stackId The stack to restore the task to (default launch stack will be used
- * if stackId is {@link android.app.ActivityManager.StackId#INVALID_STACK_ID}).
+ * if stackId is {@link android.app.ActivityManager.StackId#INVALID_STACK_ID}
+ * or is not a static stack).
* @return true if the task has been restored successfully.
*/
private boolean restoreRecentTaskLocked(TaskRecord task, int stackId) {
- if (stackId == INVALID_STACK_ID) {
+ if (!StackId.isStaticStack(stackId)) {
+ // If stack is not static (or stack id is invalid) - use the default one.
+ // This means that tasks that were on external displays will be restored on the
+ // primary display.
stackId = task.getLaunchStackId();
} else if (stackId == DOCKED_STACK_ID && !task.canGoInDockedStack()) {
// Preferred stack is the docked stack, but the task can't go in the docked stack.
@@ -3504,7 +3564,10 @@
if (activityDisplay != null) {
ArrayList<ActivityStack> stacks = activityDisplay.mStacks;
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
- stacks.get(stackNdx).mActivityContainer.removeLocked();
+ final ActivityStack stack = stacks.get(stackNdx);
+ // TODO: Implement proper stack removal and ability to choose the behavior -
+ // remove stack completely or move it to other display.
+ moveStackToDisplayLocked(stack.mStackId, DEFAULT_DISPLAY);
}
mActivityDisplays.remove(displayId);
}
@@ -4155,7 +4218,10 @@
}
}
- /** Remove the stack completely. */
+ /**
+ * Remove the stack completely. Must be called only when there are no tasks left in it,
+ * as this method does not finish running activities.
+ */
void removeLocked() {
if (DEBUG_STACK) Slog.d(TAG_STACK, "removeLocked: " + this + " from display="
+ mActivityDisplay + " Callers=" + Debug.getCallers(2));
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index 691d6b9..709c3d0 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -31,6 +31,7 @@
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
+import static android.app.ActivityManager.StackId.isStaticStack;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
@@ -50,6 +51,8 @@
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE;
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_TASK;
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_TOP;
+import static android.view.Display.INVALID_DISPLAY;
+
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_FOCUS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PERMISSIONS_REVIEW;
@@ -254,11 +257,7 @@
if (err == ActivityManager.START_SUCCESS) {
Slog.i(TAG, "START u" + userId + " {" + intent.toShortString(true, true, true, false)
- + "} from uid " + callingUid
- + " on display " + (container == null ? (mSupervisor.mFocusedStack == null ?
- Display.DEFAULT_DISPLAY : mSupervisor.mFocusedStack.mDisplayId) :
- (container.mActivityDisplay == null ? Display.DEFAULT_DISPLAY :
- container.mActivityDisplay.mDisplayId)));
+ + "} from uid " + callingUid);
}
ActivityRecord sourceRecord = null;
@@ -1952,12 +1951,14 @@
// The fullscreen stack can contain any task regardless of if the task is resizeable
// or not. So, we let the task go in the fullscreen task if it is the focus stack.
+ // Same also applies to dynamic stacks, as they behave similar to fullscreen stack.
// If the freeform or docked stack has focus, and the activity to be launched is resizeable,
// we can also put it in the focused stack.
final int focusedStackId = mSupervisor.mFocusedStack.mStackId;
final boolean canUseFocusedStack = focusedStackId == FULLSCREEN_WORKSPACE_STACK_ID
|| (focusedStackId == DOCKED_STACK_ID && r.canGoInDockedStack())
- || (focusedStackId == FREEFORM_WORKSPACE_STACK_ID && r.isResizeableOrForced());
+ || (focusedStackId == FREEFORM_WORKSPACE_STACK_ID && r.isResizeableOrForced())
+ || !isStaticStack(focusedStackId);
if (canUseFocusedStack && (!newTask
|| mSupervisor.mFocusedStack.mActivityContainer.isEligibleForNewTasks())) {
if (DEBUG_FOCUS || DEBUG_STACK) Slog.d(TAG_FOCUS,
@@ -1965,7 +1966,7 @@
return mSupervisor.mFocusedStack;
}
- // We first try to put the task in the first dynamic stack.
+ // We first try to put the task in the first dynamic stack on home display.
final ArrayList<ActivityStack> homeDisplayStacks = mSupervisor.mHomeStack.mStacks;
for (int stackNdx = homeDisplayStacks.size() - 1; stackNdx >= 0; --stackNdx) {
stack = homeDisplayStacks.get(stackNdx);
@@ -1994,16 +1995,29 @@
return mReuseTask.getStack();
}
+ final int launchDisplayId =
+ (aOptions != null) ? aOptions.getLaunchDisplayId() : INVALID_DISPLAY;
+
final int launchStackId =
(aOptions != null) ? aOptions.getLaunchStackId() : INVALID_STACK_ID;
+ if (launchStackId != INVALID_STACK_ID && launchDisplayId != INVALID_DISPLAY) {
+ throw new IllegalArgumentException(
+ "Stack and display id can't be set at the same time.");
+ }
+
if (isValidLaunchStackId(launchStackId, r)) {
return mSupervisor.getStack(launchStackId, CREATE_IF_NEEDED, ON_TOP);
- } else if (launchStackId == DOCKED_STACK_ID) {
+ }
+ if (launchStackId == DOCKED_STACK_ID) {
// The preferred launch stack is the docked stack, but it isn't a valid launch stack
// for this activity, so we put the activity in the fullscreen stack.
return mSupervisor.getStack(FULLSCREEN_WORKSPACE_STACK_ID, CREATE_IF_NEEDED, ON_TOP);
}
+ if (launchDisplayId != INVALID_DISPLAY) {
+ // Stack id has higher priority than display id.
+ return mSupervisor.getValidLaunchStackOnDisplay(launchDisplayId, r);
+ }
if ((launchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) == 0) {
return null;
@@ -2047,9 +2061,8 @@
}
}
- private boolean isValidLaunchStackId(int stackId, ActivityRecord r) {
- if (stackId == INVALID_STACK_ID || stackId == HOME_STACK_ID
- || !StackId.isStaticStack(stackId)) {
+ boolean isValidLaunchStackId(int stackId, ActivityRecord r) {
+ if (stackId == INVALID_STACK_ID || stackId == HOME_STACK_ID) {
return false;
}
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 9697855..a0a04bb 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -75,7 +75,7 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManagerInternal;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.util.ArraySet;
import android.util.IntArray;
@@ -735,8 +735,8 @@
}
}
- private IMountService getMountService() {
- return IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ private IStorageManager getStorageManager() {
+ return IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
}
/**
@@ -980,10 +980,10 @@
// TODO Move this block outside of synchronized if it causes lock contention
if (!StorageManager.isUserKeyUnlocked(userId)) {
final UserInfo userInfo = getUserInfo(userId);
- final IMountService mountService = getMountService();
+ final IStorageManager storageManager = getStorageManager();
try {
// We always want to unlock user storage, even user is not started yet
- mountService.unlockUserKey(userId, userInfo.serialNumber, token, secret);
+ storageManager.unlockUserKey(userId, userInfo.serialNumber, token, secret);
} catch (RemoteException | RuntimeException e) {
Slog.w(TAG, "Failed to unlock: " + e.getMessage());
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index a9d10dd..6eb8927 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -192,8 +192,8 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManagerInternal;
-import android.os.storage.IMountService;
-import android.os.storage.MountServiceInternal;
+import android.os.storage.IStorageManager;
+import android.os.storage.StorageManagerInternal;
import android.os.storage.StorageEventListener;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
@@ -233,6 +233,7 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.os.IParcelFileDescriptorFactory;
import com.android.internal.os.InstallerConnection.InstallerException;
+import com.android.internal.os.RoSystemProperties;
import com.android.internal.os.SomeArgs;
import com.android.internal.os.Zygote;
import com.android.internal.telephony.CarrierAppUtils;
@@ -1469,10 +1470,11 @@
}
if (reportStatus) {
try {
- if (DEBUG_SD_INSTALL) Log.i(TAG, "Invoking MountService call back");
- PackageHelper.getMountService().finishMediaUpdate();
+ if (DEBUG_SD_INSTALL) Log.i(TAG,
+ "Invoking StorageManagerService call back");
+ PackageHelper.getStorageManager().finishMediaUpdate();
} catch (RemoteException e) {
- Log.e(TAG, "MountService not running?");
+ Log.e(TAG, "StorageManagerService not running?");
}
}
} break;
@@ -1877,6 +1879,11 @@
Slog.d(TAG, "Destroying " + ps.name + " because volume was forgotten");
deletePackage(ps.name, new LegacyPackageDeleteObserver(null).getBinder(),
UserHandle.USER_SYSTEM, PackageManager.DELETE_ALL_USERS);
+
+ // Try very hard to release any references to this package
+ // so we don't risk the system server being killed due to
+ // open FDs
+ AttributeCache.instance().removePackage(ps.name);
}
mSettings.onVolumeForgotten(fsUuid);
@@ -4132,9 +4139,9 @@
final long token = Binder.clearCallingIdentity();
try {
if (sUserManager.isInitialized(userId)) {
- MountServiceInternal mountServiceInternal = LocalServices.getService(
- MountServiceInternal.class);
- mountServiceInternal.onExternalStoragePolicyChanged(uid, packageName);
+ StorageManagerInternal storageManagerInternal = LocalServices.getService(
+ StorageManagerInternal.class);
+ storageManagerInternal.onExternalStoragePolicyChanged(uid, packageName);
}
} finally {
Binder.restoreCallingIdentity(token);
@@ -7237,15 +7244,15 @@
// Before everything else, see whether we need to fstrim.
try {
- IMountService ms = PackageHelper.getMountService();
- if (ms != null) {
+ IStorageManager sm = PackageHelper.getStorageManager();
+ if (sm != null) {
boolean doTrim = false;
final long interval = android.provider.Settings.Global.getLong(
mContext.getContentResolver(),
android.provider.Settings.Global.FSTRIM_MANDATORY_INTERVAL,
DEFAULT_MANDATORY_FSTRIM_INTERVAL);
if (interval > 0) {
- final long timeSinceLast = System.currentTimeMillis() - ms.lastMaintenance();
+ final long timeSinceLast = System.currentTimeMillis() - sm.lastMaintenance();
if (timeSinceLast > interval) {
doTrim = true;
Slog.w(TAG, "No disk maintenance in " + timeSinceLast
@@ -7265,13 +7272,13 @@
} catch (RemoteException e) {
}
}
- ms.runMaintenance();
+ sm.runMaintenance();
}
} else {
- Slog.e(TAG, "Mount service unavailable!");
+ Slog.e(TAG, "storageManager service unavailable!");
}
} catch (RemoteException e) {
- // Can't happen; MountService is local
+ // Can't happen; StorageManagerService is local
}
}
@@ -10394,14 +10401,28 @@
private boolean grantSignaturePermission(String perm, PackageParser.Package pkg,
BasePermission bp, PermissionsState origPermissions) {
- boolean allowed;
- allowed = (compareSignatures(
+ boolean privilegedPermission = (bp.protectionLevel
+ & PermissionInfo.PROTECTION_FLAG_PRIVILEGED) != 0;
+ boolean controlPrivappPermissions = RoSystemProperties.CONTROL_PRIVAPP_PERMISSIONS;
+ boolean platformPermission = PLATFORM_PACKAGE_NAME.equals(bp.sourcePackage);
+ boolean platformPackage = PLATFORM_PACKAGE_NAME.equals(pkg.packageName);
+ if (controlPrivappPermissions && privilegedPermission && pkg.isPrivilegedApp()
+ && !platformPackage && platformPermission) {
+ ArraySet<String> wlPermissions = SystemConfig.getInstance()
+ .getPrivAppPermissions(pkg.packageName);
+ boolean whitelisted = wlPermissions != null && wlPermissions.contains(perm);
+ if (!whitelisted) {
+ Slog.e(TAG, "Not granting privileged permission " + perm + " for package "
+ + pkg.packageName + " - not in privapp-permissions whitelist");
+ return false;
+ }
+ }
+ boolean allowed = (compareSignatures(
bp.packageSetting.signatures.mSignatures, pkg.mSignatures)
== PackageManager.SIGNATURE_MATCH)
|| (compareSignatures(mPlatformPackage.mSignatures, pkg.mSignatures)
== PackageManager.SIGNATURE_MATCH);
- if (!allowed && (bp.protectionLevel
- & PermissionInfo.PROTECTION_FLAG_PRIVILEGED) != 0) {
+ if (!allowed && privilegedPermission) {
if (isSystemApp(pkg)) {
// For updated system applications, a system permission
// is granted only if it had been defined by the original application.
@@ -13795,7 +13816,7 @@
}
/**
- * Extract the MountService "container ID" from the full code path of an
+ * Extract the StorageManagerService "container ID" from the full code path of an
* .apk.
*/
static String cidFromCodePath(String fullCodePath) {
@@ -18396,10 +18417,10 @@
mInstallerService.systemReady();
mPackageDexOptimizer.systemReady();
- MountServiceInternal mountServiceInternal = LocalServices.getService(
- MountServiceInternal.class);
- mountServiceInternal.addExternalStoragePolicy(
- new MountServiceInternal.ExternalStorageMountPolicy() {
+ StorageManagerInternal StorageManagerInternal = LocalServices.getService(
+ StorageManagerInternal.class);
+ StorageManagerInternal.addExternalStoragePolicy(
+ new StorageManagerInternal.ExternalStorageMountPolicy() {
@Override
public int getMountMode(int uid, String packageName) {
if (Process.isIsolated(uid)) {
@@ -19277,7 +19298,7 @@
}
/**
- * Called by MountService when the initial ASECs to scan are available.
+ * Called by StorageManagerService when the initial ASECs to scan are available.
* Should block until all the ASEC containers are finished being scanned.
*/
public void scanAvailableAsecs() {
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 42cc3a8..eef8ce2 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -1415,7 +1415,6 @@
VersionInfo ver = mVersion.get(volumeUuid);
if (ver == null) {
ver = new VersionInfo();
- ver.forceCurrent();
mVersion.put(volumeUuid, ver);
}
return ver;
@@ -2802,8 +2801,8 @@
"No settings file; creating initial state");
// It's enough to just touch version details to create them
// with default values
- findOrCreateVersion(StorageManager.UUID_PRIVATE_INTERNAL);
- findOrCreateVersion(StorageManager.UUID_PRIMARY_PHYSICAL);
+ findOrCreateVersion(StorageManager.UUID_PRIVATE_INTERNAL).forceCurrent();
+ findOrCreateVersion(StorageManager.UUID_PRIMARY_PHYSICAL).forceCurrent();
return false;
}
str = new FileInputStream(mSettingsFilename);
diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java
index a920d54..cd966ef 100644
--- a/services/core/java/com/android/server/power/ShutdownThread.java
+++ b/services/core/java/com/android/server/power/ShutdownThread.java
@@ -43,8 +43,8 @@
import android.os.UserManager;
import android.os.Vibrator;
import android.os.SystemVibrator;
-import android.os.storage.IMountService;
-import android.os.storage.IMountShutdownObserver;
+import android.os.storage.IStorageShutdownObserver;
+import android.os.storage.IStorageManager;
import android.system.ErrnoException;
import android.system.Os;
@@ -442,30 +442,30 @@
sInstance.setRebootProgress(RADIO_STOP_PERCENT, null);
}
- // Shutdown MountService to ensure media is in a safe state
- IMountShutdownObserver observer = new IMountShutdownObserver.Stub() {
+ // Shutdown StorageManagerService to ensure media is in a safe state
+ IStorageShutdownObserver observer = new IStorageShutdownObserver.Stub() {
public void onShutDownComplete(int statusCode) throws RemoteException {
- Log.w(TAG, "Result code " + statusCode + " from MountService.shutdown");
+ Log.w(TAG, "Result code " + statusCode + " from StorageManagerService.shutdown");
actionDone();
}
};
- Log.i(TAG, "Shutting down MountService");
+ Log.i(TAG, "Shutting down StorageManagerService");
// Set initial variables and time out time.
mActionDone = false;
final long endShutTime = SystemClock.elapsedRealtime() + MAX_SHUTDOWN_WAIT_TIME;
synchronized (mActionDoneSync) {
try {
- final IMountService mount = IMountService.Stub.asInterface(
+ final IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.checkService("mount"));
- if (mount != null) {
- mount.shutdown(observer);
+ if (storageManager != null) {
+ storageManager.shutdown(observer);
} else {
- Log.w(TAG, "MountService unavailable for shutdown");
+ Log.w(TAG, "StorageManagerService unavailable for shutdown");
}
} catch (Exception e) {
- Log.e(TAG, "Exception during MountService shutdown", e);
+ Log.e(TAG, "Exception during StorageManagerService shutdown", e);
}
while (!mActionDone) {
long delay = endShutTime - SystemClock.elapsedRealtime();
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index c8e35eb..e73acde 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -727,7 +727,8 @@
win.getTouchableRegion(mTmpRegion);
mTouchExcludeRegion.op(mTmpRegion, Region.Op.UNION);
}
- if (getDockedStackLocked() != null) {
+ // TODO(multi-display): Support docked stacks on secondary displays.
+ if (mDisplayId == DEFAULT_DISPLAY && getDockedStackLocked() != null) {
mDividerControllerLocked.getTouchRegion(mTmpRect);
mTmpRegion.set(mTmpRect);
mTouchExcludeRegion.op(mTmpRegion, Op.UNION);
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index c0b3f27..c11003d 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1357,7 +1357,7 @@
* being visible.
*/
boolean isOnScreen() {
- if (!mHasSurface || mDestroying) {
+ if (!mHasSurface || mDestroying || !mPolicyVisibility) {
return false;
}
final AppWindowToken atoken = mAppToken;
diff --git a/services/core/jni/com_android_server_storage_AppFuseBridge.cpp b/services/core/jni/com_android_server_storage_AppFuseBridge.cpp
index 640fd0e..2f20ecd 100644
--- a/services/core/jni/com_android_server_storage_AppFuseBridge.cpp
+++ b/services/core/jni/com_android_server_storage_AppFuseBridge.cpp
@@ -30,7 +30,7 @@
static jclass appFuseClass;
static jmethodID appFuseOnMount;
-class Callback : public FuseBridgeLoop::Callback {
+class Callback : public fuse::FuseBridgeLoopCallback {
JNIEnv* mEnv;
jobject mSelf;
@@ -47,9 +47,8 @@
jboolean com_android_server_storage_AppFuseBridge_start_loop(
JNIEnv* env, jobject self, jint devJavaFd, jint proxyJavaFd) {
- FuseBridgeLoop loop;
Callback callback(env, self);
- return loop.Start(devJavaFd, proxyJavaFd, &callback);
+ return fuse::StartFuseBridgeLoop(devJavaFd, proxyJavaFd, &callback);
}
const JNINativeMethod methods[] = {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 3db24fa..1202025 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -42,7 +42,7 @@
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.EventLog;
@@ -167,8 +167,8 @@
"com.android.server.job.JobSchedulerService";
private static final String LOCK_SETTINGS_SERVICE_CLASS =
"com.android.server.LockSettingsService$Lifecycle";
- private static final String MOUNT_SERVICE_CLASS =
- "com.android.server.MountService$Lifecycle";
+ private static final String STORAGE_MANAGER_SERVICE_CLASS =
+ "com.android.server.StorageManagerService$Lifecycle";
private static final String SEARCH_MANAGER_SERVICE_CLASS =
"com.android.server.search.SearchManagerService$Lifecycle";
private static final String THERMAL_OBSERVER_CLASS =
@@ -572,7 +572,7 @@
private void startOtherServices() {
final Context context = mSystemContext;
VibratorService vibrator = null;
- IMountService mountService = null;
+ IStorageManager storageManager = null;
NetworkManagementService networkManagement = null;
NetworkStatsService networkStats = null;
NetworkPolicyManagerService networkPolicy = null;
@@ -784,17 +784,17 @@
if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
if (!disableStorage &&
!"0".equals(SystemProperties.get("system_init.startmountservice"))) {
- traceBeginAndSlog("StartMountService");
+ traceBeginAndSlog("StartStorageManagerService");
try {
/*
- * NotificationManagerService is dependant on MountService,
- * (for media / usb notifications) so we must start MountService first.
+ * NotificationManagerService is dependant on StorageManagerService,
+ * (for media / usb notifications) so we must start StorageManagerService first.
*/
- mSystemServiceManager.startService(MOUNT_SERVICE_CLASS);
- mountService = IMountService.Stub.asInterface(
+ mSystemServiceManager.startService(STORAGE_MANAGER_SERVICE_CLASS);
+ storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
} catch (Throwable e) {
- reportWtf("starting Mount Service", e);
+ reportWtf("starting StorageManager Service", e);
}
traceEnd();
}
@@ -993,14 +993,14 @@
}
/*
- * MountService has a few dependencies: Notification Manager and
- * AppWidget Provider. Make sure MountService is completely started
+ * StorageManagerService has a few dependencies: Notification Manager and
+ * AppWidget Provider. Make sure StorageManagerService is completely started
* first before continuing.
*/
- if (mountService != null && !mOnlyCore) {
+ if (storageManager != null && !mOnlyCore) {
traceBeginAndSlog("WaitForAsecScan");
try {
- mountService.waitForAsecScan();
+ storageManager.waitForAsecScan();
} catch (RemoteException ignored) {
}
traceEnd();
diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java
index 3df1df9..4499275 100644
--- a/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java
+++ b/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java
@@ -41,9 +41,7 @@
/**
* Tests for the {@link WindowState} class.
*
- * Build: mmma -j32 frameworks/base/services/tests/servicestests
- * Install: adb install -r out/target/product/$TARGET_PRODUCT/data/app/FrameworksServicesTests/FrameworksServicesTests.apk
- * Run: adb shell am instrument -w -e class com.android.server.wm.WindowStateTests com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
+ * runtest frameworks-services -c com.android.server.wm.WindowStateTests
*/
@SmallTest
@Presubmit
@@ -160,6 +158,15 @@
assertEquals(root, child2.getTopParentWindow());
}
+ @Test
+ public void testIsOnScreen_hiddenByPolicy() {
+ final WindowState window = createWindow(null, TYPE_APPLICATION);
+ window.setHasSurface(true);
+ assertTrue(window.isOnScreen());
+ window.hideLw(false /* doAnimation */);
+ assertFalse(window.isOnScreen());
+ }
+
private WindowState createWindow(WindowState parent, int type) {
final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(type);
diff --git a/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl b/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl
index 5b71149..2ae424f 100644
--- a/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl
+++ b/telephony/java/com/android/ims/internal/uce/presence/IPresenceListener.aidl
@@ -89,4 +89,11 @@
*/
void listCapInfoReceived(in PresRlmiInfo rlmiInfo,
in PresResInfo [] resInfo);
+
+ /**
+ * Callback function to be invoked to inform the client when Unpublish message
+ * is sent to network.
+ */
+ void unpublishMessageSent();
+
}
\ No newline at end of file
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index bc38284..9e897bf 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -59,11 +59,6 @@
int addOrUpdateNetwork(in WifiConfiguration config);
- int addPasspointManagementObject(String mo);
-
- int modifyPasspointManagementObject(String fqdn,
- in List<PasspointManagementObjectDefinition> mos);
-
boolean addPasspointConfiguration(in PasspointConfiguration config);
boolean removePasspointConfiguration(in String fqdn);
@@ -132,8 +127,6 @@
WifiConfiguration getWifiApConfiguration();
- WifiConfiguration buildWifiConfig(String uriString, String mimeType, in byte[] data);
-
void setWifiApConfiguration(in WifiConfiguration wifiConfig);
Messenger getWifiServiceMessenger();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 98a6ca5..674c161 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -842,36 +842,6 @@
}
/**
- * Add a Hotspot 2.0 release 2 Management Object
- * @param mo The MO in XML form
- * @return -1 for failure
- * @hide
- */
- public int addPasspointManagementObject(String mo) {
- try {
- return mService.addPasspointManagementObject(mo);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
- /**
- * Modify a Hotspot 2.0 release 2 Management Object
- * @param fqdn The FQDN of the service provider
- * @param mos A List of MO definitions to be updated
- * @return the number of nodes updated, or -1 for failure
- * @hide
- */
- public int modifyPasspointManagementObject(String fqdn,
- List<PasspointManagementObjectDefinition> mos) {
- try {
- return mService.modifyPasspointManagementObject(fqdn, mos);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
- /**
* Add a Passpoint configuration. The configuration provides a credential
* for connecting to Passpoint networks that are operated by the Passpoint
* service provider specified in the configuration.
@@ -1628,20 +1598,6 @@
}
/**
- * Builds a WifiConfiguration from Hotspot 2.0 MIME file.
- * @return AP details in WifiConfiguration
- *
- * @hide Dont open yet
- */
- public WifiConfiguration buildWifiConfig(String uriString, String mimeType, byte[] data) {
- try {
- return mService.buildWifiConfig(uriString, mimeType, data);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
- /**
* Sets the Wi-Fi AP Configuration.
* @return {@code true} if the operation succeeded, {@code false} otherwise
*