diff options
| -rw-r--r-- | core/java/android/os/ParcelFileDescriptor.java | 3 | ||||
| -rw-r--r-- | core/java/android/os/storage/DiskInfo.java | 6 | ||||
| -rw-r--r-- | core/java/android/text/TextUtils.java | 9 | ||||
| -rw-r--r-- | core/java/android/view/Choreographer.java | 32 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 7 | ||||
| -rw-r--r-- | core/jni/android/graphics/SurfaceTexture.cpp | 11 | ||||
| -rw-r--r-- | core/res/AndroidManifest.xml | 18 | ||||
| -rw-r--r-- | core/res/res/values/strings.xml | 11 | ||||
| -rwxr-xr-x | core/res/res/values/symbols.xml | 1 | ||||
| -rw-r--r-- | media/jni/android_media_ImageReader.cpp | 11 | ||||
| -rw-r--r-- | packages/DocumentsUI/res/values/strings.xml | 3 | ||||
| -rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java | 7 |
12 files changed, 75 insertions, 44 deletions
diff --git a/core/java/android/os/ParcelFileDescriptor.java b/core/java/android/os/ParcelFileDescriptor.java index 1c9c71336bdd..135f369f895f 100644 --- a/core/java/android/os/ParcelFileDescriptor.java +++ b/core/java/android/os/ParcelFileDescriptor.java @@ -621,6 +621,9 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { final int fd = getFd(); Parcel.clearFileDescriptor(mFd); writeCommStatusAndClose(Status.DETACHED, null); + mClosed = true; + mGuard.close(); + releaseResources(); return fd; } } diff --git a/core/java/android/os/storage/DiskInfo.java b/core/java/android/os/storage/DiskInfo.java index 04e54aafbce9..5bc45d572085 100644 --- a/core/java/android/os/storage/DiskInfo.java +++ b/core/java/android/os/storage/DiskInfo.java @@ -80,6 +80,12 @@ public class DiskInfo implements Parcelable { if (label.toLowerCase().contains("generic")) { return false; } + if (label.toLowerCase().startsWith("usb")) { + return false; + } + if (label.toLowerCase().startsWith("multiple")) { + return false; + } return true; } diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java index 6c4d8fd01443..d51aa7939c3d 100644 --- a/core/java/android/text/TextUtils.java +++ b/core/java/android/text/TextUtils.java @@ -1790,6 +1790,15 @@ public class TextUtils { } } + /** + * Return localized string representing the given number of selected items. + * + * @hide + */ + public static CharSequence formatSelectedCount(int count) { + return Resources.getSystem().getQuantityString(R.plurals.selected_count, count, count); + } + private static Object sLock = new Object(); private static char[] sTemp = null; diff --git a/core/java/android/view/Choreographer.java b/core/java/android/view/Choreographer.java index d2b6533fd4ac..a865307b12bb 100644 --- a/core/java/android/view/Choreographer.java +++ b/core/java/android/view/Choreographer.java @@ -22,6 +22,7 @@ import android.os.Looper; import android.os.Message; import android.os.SystemClock; import android.os.SystemProperties; +import android.os.Trace; import android.util.Log; import android.util.TimeUtils; @@ -160,6 +161,14 @@ public final class Choreographer { FrameInfo mFrameInfo = new FrameInfo(); /** + * Must be kept in sync with CALLBACK_* ints below, used to index into this array. + * @hide + */ + private static final String[] CALLBACK_TRACE_TITLES = { + "input", "animation", "traversal", "commit" + }; + + /** * Callback type: Input callback. Runs first. * @hide */ @@ -584,16 +593,22 @@ public final class Choreographer { mLastFrameTimeNanos = frameTimeNanos; } - mFrameInfo.markInputHandlingStart(); - doCallbacks(Choreographer.CALLBACK_INPUT, frameTimeNanos); + try { + Trace.traceBegin(Trace.TRACE_TAG_VIEW, "Choreographer#doFrame"); + + mFrameInfo.markInputHandlingStart(); + doCallbacks(Choreographer.CALLBACK_INPUT, frameTimeNanos); - mFrameInfo.markAnimationsStart(); - doCallbacks(Choreographer.CALLBACK_ANIMATION, frameTimeNanos); + mFrameInfo.markAnimationsStart(); + doCallbacks(Choreographer.CALLBACK_ANIMATION, frameTimeNanos); - mFrameInfo.markPerformTraversalsStart(); - doCallbacks(Choreographer.CALLBACK_TRAVERSAL, frameTimeNanos); + mFrameInfo.markPerformTraversalsStart(); + doCallbacks(Choreographer.CALLBACK_TRAVERSAL, frameTimeNanos); - doCallbacks(Choreographer.CALLBACK_COMMIT, frameTimeNanos); + doCallbacks(Choreographer.CALLBACK_COMMIT, frameTimeNanos); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_VIEW); + } if (DEBUG_FRAMES) { final long endNanos = System.nanoTime(); @@ -627,6 +642,7 @@ public final class Choreographer { // safe by ensuring the commit time is always at least one frame behind. if (callbackType == Choreographer.CALLBACK_COMMIT) { final long jitterNanos = now - frameTimeNanos; + Trace.traceCounter(Trace.TRACE_TAG_VIEW, "jitterNanos", (int) jitterNanos); if (jitterNanos >= 2 * mFrameIntervalNanos) { final long lastFrameOffset = jitterNanos % mFrameIntervalNanos + mFrameIntervalNanos; @@ -644,6 +660,7 @@ public final class Choreographer { } } try { + Trace.traceBegin(Trace.TRACE_TAG_VIEW, CALLBACK_TRACE_TITLES[callbackType]); for (CallbackRecord c = callbacks; c != null; c = c.next) { if (DEBUG_FRAMES) { Log.d(TAG, "RunCallback: type=" + callbackType @@ -661,6 +678,7 @@ public final class Choreographer { callbacks = next; } while (callbacks != null); } + Trace.traceEnd(Trace.TRACE_TAG_VIEW); } } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index e1e015498512..e2f42db0f085 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1105,12 +1105,7 @@ public final class ViewRootImpl implements ViewParent, Debug.startMethodTracing("ViewAncestor"); } - Trace.traceBegin(Trace.TRACE_TAG_VIEW, "performTraversals"); - try { - performTraversals(); - } finally { - Trace.traceEnd(Trace.TRACE_TAG_VIEW); - } + performTraversals(); if (mProfile) { Debug.stopMethodTracing(); diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp index 08d61d593b0a..b9e48a0c0cc8 100644 --- a/core/jni/android/graphics/SurfaceTexture.cpp +++ b/core/jni/android/graphics/SurfaceTexture.cpp @@ -49,6 +49,12 @@ struct fields_t { }; static fields_t fields; +// Get an ID that's unique within this process. +static int32_t createProcessUniqueId() { + static volatile int32_t globalCounter = 0; + return android_atomic_inc(&globalCounter); +} + // ---------------------------------------------------------------------------- static void SurfaceTexture_setSurfaceTexture(JNIEnv* env, jobject thiz, @@ -253,6 +259,11 @@ static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jboolean isDetached, "Unable to create native SurfaceTexture"); return; } + surfaceTexture->setName(String8::format("SurfaceTexture-%d-%d-%d", + (isDetached ? 0 : texName), + getpid(), + createProcessUniqueId())); + SurfaceTexture_setSurfaceTexture(env, thiz, surfaceTexture); SurfaceTexture_setProducer(env, thiz, producer); diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 482ca13a677d..54123f51af2d 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1602,24 +1602,6 @@ <permission android:name="android.permission.WRITE_APN_SETTINGS" android:protectionLevel="signature|system" /> - <!-- Allows an application to allow access the subscribed feeds ContentProvider. - @hide - @removed - --> - <permission android:name="android.permission.SUBSCRIBED_FEEDS_READ" - android:label="@string/permlab_subscribedFeedsRead" - android:description="@string/permdesc_subscribedFeedsRead" - android:protectionLevel="normal" /> - - <!-- - @hide - @removed - --> - <permission android:name="android.permission.SUBSCRIBED_FEEDS_WRITE" - android:label="@string/permlab_subscribedFeedsWrite" - android:description="@string/permdesc_subscribedFeedsWrite" - android:protectionLevel="dangerous" /> - <!-- Allows applications to change network connectivity state --> <permission android:name="android.permission.CHANGE_NETWORK_STATE" android:description="@string/permdesc_changeNetworkState" diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 28274ae74e79..675d3e2e0fb2 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1302,12 +1302,6 @@ <string name="permdesc_readSyncStats">Allows an app to read the sync stats for an account, including the history of sync events and how much data is synced. </string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> - <string name="permlab_subscribedFeedsWrite">write subscribed feeds</string> - <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> - <string name="permdesc_subscribedFeedsWrite">Allows the app to modify - your currently synced feeds. Malicious apps may change your synced feeds.</string> - - <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_readDictionary">read terms you added to the dictionary</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_readDictionary">Allows the app to read all words, @@ -4207,4 +4201,9 @@ notification_template_material_inbox.xml. DO NOT TRANSLATE --> <string name="notification_inbox_ellipsis">\u2026</string> + + <!-- Label describing the number of selected items [CHAR LIMIT=48] --> + <plurals name="selected_count"> + <item quantity="other"><xliff:g id="count" example="3">%1$d</xliff:g> selected</item> + </plurals> </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 890068816233..b019adbbe1eb 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2306,5 +2306,6 @@ <java-symbol type="string" name="ext_media_status_missing" /> <java-symbol type="string" name="ext_media_unsupported_notification_message" /> <java-symbol type="string" name="ext_media_unsupported_notification_title" /> + <java-symbol type="plurals" name="selected_count" /> </resources> diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp index 49614bdc76fd..635fa11c6b44 100644 --- a/media/jni/android_media_ImageReader.cpp +++ b/media/jni/android_media_ImageReader.cpp @@ -72,6 +72,12 @@ static struct { jmethodID ctor; } gSurfacePlaneClassInfo; +// Get an ID that's unique within this process. +static int32_t createProcessUniqueId() { + static volatile int32_t globalCounter = 0; + return android_atomic_inc(&globalCounter); +} + // ---------------------------------------------------------------------------- class JNIImageReaderContext : public ConsumerBase::FrameAvailableListener @@ -808,6 +814,9 @@ static void ImageReader_init(JNIEnv* env, jobject thiz, jobject weakThiz, sp<ConsumerBase> consumer; sp<CpuConsumer> cpuConsumer; sp<BufferItemConsumer> opaqueConsumer; + String8 consumerName = String8::format("ImageReader-%dx%df%xm%d-%d-%d", + width, height, format, maxImages, getpid(), + createProcessUniqueId()); if (isFormatOpaque(nativeFormat)) { // Use the SW_READ_NEVER usage to tell producer that this format is not for preview or video // encoding. The only possibility will be ZSL output. @@ -819,6 +828,7 @@ static void ImageReader_init(JNIEnv* env, jobject thiz, jobject weakThiz, return; } ctx->setOpaqueConsumer(opaqueConsumer); + opaqueConsumer->setName(consumerName); consumer = opaqueConsumer; } else { cpuConsumer = new CpuConsumer(gbConsumer, maxImages, /*controlledByApp*/true); @@ -828,6 +838,7 @@ static void ImageReader_init(JNIEnv* env, jobject thiz, jobject weakThiz, return; } ctx->setCpuConsumer(cpuConsumer); + cpuConsumer->setName(consumerName); consumer = cpuConsumer; } diff --git a/packages/DocumentsUI/res/values/strings.xml b/packages/DocumentsUI/res/values/strings.xml index 943104d2e094..a4e6ce78f523 100644 --- a/packages/DocumentsUI/res/values/strings.xml +++ b/packages/DocumentsUI/res/values/strings.xml @@ -68,9 +68,6 @@ <!-- Button label that copies files to the current directory [CHAR LIMIT=24] --> <string name="button_copy">Copy</string> - <!-- Action mode title summarizing the number of documents selected [CHAR LIMIT=32] --> - <string name="mode_selected_count"><xliff:g id="count" example="3">%1$d</xliff:g> selected</string> - <!-- Mode that sorts documents by their display name alphabetically [CHAR LIMIT=24] --> <string name="sort_name">By name</string> <!-- Mode that sorts documents by their last modified time in descending order; most recent first [CHAR LIMIT=24] --> diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java index a789da86badd..f4be9c5252b7 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java @@ -54,6 +54,7 @@ import android.os.OperationCanceledException; import android.os.Parcelable; import android.provider.DocumentsContract; import android.provider.DocumentsContract.Document; +import android.text.TextUtils; import android.text.format.DateUtils; import android.text.format.Formatter; import android.text.format.Time; @@ -474,8 +475,7 @@ public class DirectoryFragment extends Fragment { @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.mode_directory, menu); - mode.setTitle(getResources() - .getString(R.string.mode_selected_count, mCurrentView.getCheckedItemCount())); + mode.setTitle(TextUtils.formatSelectedCount(mCurrentView.getCheckedItemCount())); return true; } @@ -571,8 +571,7 @@ public class DirectoryFragment extends Fragment { } } - mode.setTitle(getResources() - .getString(R.string.mode_selected_count, mCurrentView.getCheckedItemCount())); + mode.setTitle(TextUtils.formatSelectedCount(mCurrentView.getCheckedItemCount())); } }; |