Add a music apps view to the Storage Settings.
When you tap the Music & Audio preference, it takes you a
hybridized applications view. In this view, there also is
a line item which defines the amount of storage used by
audio files on the device. Using the new storage query, we
can add this information very quickly to the view.
Bug: 33199077
Test: Settings robo tests
Change-Id: If51cba0b3de20805543a39049367eb13613081e7
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 248358c..f5bd2ce 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -25,6 +25,7 @@
import android.app.IActivityManager;
import android.app.KeyguardManager;
import android.app.admin.DevicePolicyManager;
+import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@@ -1224,4 +1225,24 @@
return null;
}
}
+
+ /**
+ * Launches an intent which may optionally have a user id defined.
+ * @param fragment Fragment to use to launch the activity.
+ * @param intent Intent to launch.
+ */
+ public static void launchIntent(Fragment fragment, Intent intent) {
+ try {
+ final int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, -1);
+
+ if (userId == -1) {
+ fragment.startActivity(intent);
+ } else {
+ fragment.getActivity().startActivityAsUser(intent, new UserHandle(userId));
+ }
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "No activity found for " + intent);
+ }
+ }
+
}