diff options
42 files changed, 466 insertions, 176 deletions
diff --git a/apct-tests/perftests/core/AndroidTest.xml b/apct-tests/perftests/core/AndroidTest.xml new file mode 100644 index 000000000000..6aa34a627940 --- /dev/null +++ b/apct-tests/perftests/core/AndroidTest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 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. +--> +<configuration description="Runs CorePerfTests metric instrumentation."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-metric-instrumentation" /> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true" /> + <option name="test-file-name" value="CorePerfTests.apk" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.AndroidJUnitTest" > + <option name="package" value="com.android.perftests.core" /> + </test> +</configuration> diff --git a/apct-tests/perftests/multiuser/Android.mk b/apct-tests/perftests/multiuser/Android.mk index a803369d1e03..9bc7d051121a 100644 --- a/apct-tests/perftests/multiuser/Android.mk +++ b/apct-tests/perftests/multiuser/Android.mk @@ -26,6 +26,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ LOCAL_PACKAGE_NAME := MultiUserPerfTests LOCAL_PRIVATE_PLATFORM_APIS := true +LOCAL_COMPATIBILITY_SUITE += device-tests + LOCAL_CERTIFICATE := platform include $(BUILD_PACKAGE) diff --git a/apct-tests/perftests/multiuser/AndroidTest.xml b/apct-tests/perftests/multiuser/AndroidTest.xml new file mode 100644 index 000000000000..6ede8275afcb --- /dev/null +++ b/apct-tests/perftests/multiuser/AndroidTest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 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. +--> +<configuration description="Runs MultiUserPerfTests metric instrumentation."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-metric-instrumentation" /> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true" /> + <option name="test-file-name" value="MultiUserPerfTests.apk" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.AndroidJUnitTest" > + <option name="package" value="com.android.perftests.multiuser" /> + </test> +</configuration> diff --git a/api/current.txt b/api/current.txt index c8657e350f45..99682580d4e9 100644 --- a/api/current.txt +++ b/api/current.txt @@ -7219,6 +7219,7 @@ package android.app.slice { field public static final java.lang.String HINT_LIST_ITEM = "list_item"; field public static final java.lang.String HINT_NO_TINT = "no_tint"; field public static final java.lang.String HINT_PARTIAL = "partial"; + field public static final java.lang.String HINT_PERMISSION_REQUEST = "permission_request"; field public static final java.lang.String HINT_SEE_MORE = "see_more"; field public static final java.lang.String HINT_SELECTED = "selected"; field public static final java.lang.String HINT_SHORTCUT = "shortcut"; @@ -13658,7 +13659,8 @@ package android.graphics { method public android.graphics.ImageDecoder setOnPartialImageListener(android.graphics.ImageDecoder.OnPartialImageListener); method public android.graphics.ImageDecoder setPostProcessor(android.graphics.PostProcessor); method public android.graphics.ImageDecoder setRequireUnpremultiplied(boolean); - method public android.graphics.ImageDecoder setSampleSize(int); + method public android.graphics.ImageDecoder setTargetColorSpace(android.graphics.ColorSpace); + method public android.graphics.ImageDecoder setTargetSampleSize(int); method public android.graphics.ImageDecoder setTargetSize(int, int); field public static final int ALLOCATOR_DEFAULT = 0; // 0x0 field public static final int ALLOCATOR_HARDWARE = 3; // 0x3 @@ -13675,6 +13677,7 @@ package android.graphics { } public static class ImageDecoder.ImageInfo { + method public android.graphics.ColorSpace getColorSpace(); method public java.lang.String getMimeType(); method public android.util.Size getSize(); method public boolean isAnimated(); diff --git a/api/system-current.txt b/api/system-current.txt index a81afed5ecdb..ed763babb7ef 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -57,6 +57,7 @@ package android { field public static final java.lang.String CONFIGURE_DISPLAY_BRIGHTNESS = "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS"; field public static final java.lang.String CONNECTIVITY_INTERNAL = "android.permission.CONNECTIVITY_INTERNAL"; field public static final java.lang.String CONNECTIVITY_USE_RESTRICTED_NETWORKS = "android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS"; + field public static final java.lang.String CONTROL_DISPLAY_SATURATION = "android.permission.CONTROL_DISPLAY_SATURATION"; field public static final java.lang.String CONTROL_INCALL_EXPERIENCE = "android.permission.CONTROL_INCALL_EXPERIENCE"; field public static final java.lang.String CONTROL_LOCATION_UPDATES = "android.permission.CONTROL_LOCATION_UPDATES"; field public static final java.lang.String CONTROL_VPN = "android.permission.CONTROL_VPN"; @@ -1252,6 +1253,7 @@ package android.hardware.display { method public android.hardware.display.BrightnessConfiguration getDefaultBrightnessConfiguration(); method public android.graphics.Point getStableDisplaySize(); method public void setBrightnessConfiguration(android.hardware.display.BrightnessConfiguration); + method public void setSaturationLevel(float); } } diff --git a/core/java/android/app/slice/Slice.java b/core/java/android/app/slice/Slice.java index 95bb1f682701..fc3b38d2bcfb 100644 --- a/core/java/android/app/slice/Slice.java +++ b/core/java/android/app/slice/Slice.java @@ -70,6 +70,7 @@ public final class Slice implements Parcelable { HINT_ERROR, HINT_TTL, HINT_LAST_UPDATED, + HINT_PERMISSION_REQUEST, }) @Retention(RetentionPolicy.SOURCE) public @interface SliceHint {} @@ -184,6 +185,11 @@ public final class Slice implements Parcelable { */ public static final String HINT_LAST_UPDATED = "last_updated"; /** + * A hint to indicate that this slice represents a permission request for showing + * slices. + */ + public static final String HINT_PERMISSION_REQUEST = "permission_request"; + /** * Key to retrieve an extra added to an intent when a control is changed. */ public static final String EXTRA_TOGGLE_STATE = "android.app.slice.extra.TOGGLE_STATE"; diff --git a/core/java/android/app/slice/SliceProvider.java b/core/java/android/app/slice/SliceProvider.java index bf856b74f067..bbeb3849be78 100644 --- a/core/java/android/app/slice/SliceProvider.java +++ b/core/java/android/app/slice/SliceProvider.java @@ -428,15 +428,17 @@ public abstract class SliceProvider extends ContentProvider { } finally { Handler.getMain().removeCallbacks(mAnr); } - return new Slice.Builder(sliceUri) - .addAction(action, - new Slice.Builder(sliceUri.buildUpon().appendPath("permission").build()) - .addText(getPermissionString(context, callingPackage), null, - Collections.emptyList()) - .build(), - null) - .addHints(Arrays.asList(Slice.HINT_LIST_ITEM)) - .build(); + Slice.Builder parent = new Slice.Builder(sliceUri); + Slice.Builder childAction = new Slice.Builder(parent) + .addHints(Arrays.asList(Slice.HINT_TITLE, Slice.HINT_SHORTCUT)) + .addAction(action, new Slice.Builder(parent).build(), null); + + parent.addSubSlice(new Slice.Builder(sliceUri.buildUpon().appendPath("permission").build()) + .addText(getPermissionString(context, callingPackage), null, + Collections.emptyList()) + .addSubSlice(childAction.build(), null) + .build(), null); + return parent.addHints(Arrays.asList(Slice.HINT_PERMISSION_REQUEST)).build(); } /** diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java index a3b2d22deccb..efb9517adc00 100644 --- a/core/java/android/hardware/display/DisplayManager.java +++ b/core/java/android/hardware/display/DisplayManager.java @@ -535,6 +535,19 @@ public final class DisplayManager { } /** + * Set the level of color saturation to apply to the display. + * @param level The amount of saturation to apply, between 0 and 1 inclusive. + * 0 produces a grayscale image, 1 is normal. + * + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_SATURATION) + public void setSaturationLevel(float level) { + mGlobal.setSaturationLevel(level); + } + + /** * Creates a virtual display. * * @see #createVirtualDisplay(String, int, int, int, Surface, int, diff --git a/core/java/android/hardware/display/DisplayManagerGlobal.java b/core/java/android/hardware/display/DisplayManagerGlobal.java index 1f67a6bf71a7..2d0ef2f23432 100644 --- a/core/java/android/hardware/display/DisplayManagerGlobal.java +++ b/core/java/android/hardware/display/DisplayManagerGlobal.java @@ -384,6 +384,17 @@ public final class DisplayManagerGlobal { } } + /** + * Set the level of color saturation to apply to the display. + */ + public void setSaturationLevel(float level) { + try { + mDm.setSaturationLevel(level); + } catch (RemoteException ex) { + throw ex.rethrowFromSystemServer(); + } + } + public VirtualDisplay createVirtualDisplay(Context context, MediaProjection projection, String name, int width, int height, int densityDpi, Surface surface, int flags, VirtualDisplay.Callback callback, Handler handler, String uniqueId) { diff --git a/core/java/android/hardware/display/IDisplayManager.aidl b/core/java/android/hardware/display/IDisplayManager.aidl index 9fcb9d3fc265..b77de748a987 100644 --- a/core/java/android/hardware/display/IDisplayManager.aidl +++ b/core/java/android/hardware/display/IDisplayManager.aidl @@ -65,6 +65,9 @@ interface IDisplayManager { // Requires CONFIGURE_DISPLAY_COLOR_MODE void requestColorMode(int displayId, int colorMode); + // Requires CONTROL_DISPLAY_SATURATION + void setSaturationLevel(float level); + // Requires CAPTURE_VIDEO_OUTPUT, CAPTURE_SECURE_VIDEO_OUTPUT, or an appropriate // MediaProjection token for certain combinations of flags. int createVirtualDisplay(in IVirtualDisplayCallback callback, diff --git a/core/java/android/hardware/radio/ProgramList.java b/core/java/android/hardware/radio/ProgramList.java index b2aa9ba532a9..e6f523c07e70 100644 --- a/core/java/android/hardware/radio/ProgramList.java +++ b/core/java/android/hardware/radio/ProgramList.java @@ -263,6 +263,17 @@ public final class ProgramList implements AutoCloseable { /** * @hide for framework use only */ + public Filter() { + mIdentifierTypes = Collections.emptySet(); + mIdentifiers = Collections.emptySet(); + mIncludeCategories = false; + mExcludeModifications = false; + mVendorFilter = null; + } + + /** + * @hide for framework use only + */ public Filter(@Nullable Map<String, String> vendorFilter) { mIdentifierTypes = Collections.emptySet(); mIdentifiers = Collections.emptySet(); diff --git a/core/java/android/hardware/radio/TunerAdapter.java b/core/java/android/hardware/radio/TunerAdapter.java index 85f3115689cd..be2846f87079 100644 --- a/core/java/android/hardware/radio/TunerAdapter.java +++ b/core/java/android/hardware/radio/TunerAdapter.java @@ -60,6 +60,7 @@ class TunerAdapter extends RadioTuner { mLegacyListProxy.close(); mLegacyListProxy = null; } + mCallback.close(); } try { mTuner.close(); @@ -278,6 +279,7 @@ class TunerAdapter extends RadioTuner { try { mTuner.startProgramListUpdates(filter); } catch (UnsupportedOperationException ex) { + Log.i(TAG, "Program list is not supported with this hardware"); return null; } catch (RemoteException ex) { mCallback.setProgramListObserver(null, () -> { }); diff --git a/core/java/android/hardware/radio/TunerCallbackAdapter.java b/core/java/android/hardware/radio/TunerCallbackAdapter.java index 7437c40351db..0fb93e532cd3 100644 --- a/core/java/android/hardware/radio/TunerCallbackAdapter.java +++ b/core/java/android/hardware/radio/TunerCallbackAdapter.java @@ -53,6 +53,12 @@ class TunerCallbackAdapter extends ITunerCallback.Stub { } } + void close() { + synchronized (mLock) { + if (mProgramList != null) mProgramList.close(); + } + } + void setProgramListObserver(@Nullable ProgramList programList, @NonNull ProgramList.OnCloseListener closeListener) { Objects.requireNonNull(closeListener); diff --git a/core/java/android/os/storage/VolumeInfo.java b/core/java/android/os/storage/VolumeInfo.java index 5c99f6c87d7c..9e3e386eedb2 100644 --- a/core/java/android/os/storage/VolumeInfo.java +++ b/core/java/android/os/storage/VolumeInfo.java @@ -312,7 +312,7 @@ public class VolumeInfo implements Parcelable { * {@link android.Manifest.permission#WRITE_MEDIA_STORAGE}. */ public File getInternalPathForUser(int userId) { - if (type == TYPE_PUBLIC) { + if (type == TYPE_PUBLIC && !isVisible()) { // TODO: plumb through cleaner path from vold return new File(path.replace("/storage/", "/mnt/media_rw/")); } else { diff --git a/core/java/android/service/autofill/FillEventHistory.java b/core/java/android/service/autofill/FillEventHistory.java index df62446427d3..6e5bacf1aad1 100644 --- a/core/java/android/service/autofill/FillEventHistory.java +++ b/core/java/android/service/autofill/FillEventHistory.java @@ -424,7 +424,7 @@ public final class FillEventHistory implements Parcelable { * @return map map whose key is the id of the manually-entered field, and value is the * ids of the datasets that have that value but were not selected by the user. */ - @Nullable public Map<AutofillId, Set<String>> getManuallyEnteredField() { + @NonNull public Map<AutofillId, Set<String>> getManuallyEnteredField() { if (mManuallyFilledFieldIds == null || mManuallyFilledDatasetIds == null) { return Collections.emptyMap(); } diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 92f496a87c3f..99467265b5c5 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -4585,8 +4585,8 @@ public class Editor { return mContainer.isShowing(); } - private boolean isVisible() { - // Always show a dragging handle. + private boolean shouldShow() { + // A dragging handle should always be shown. if (mIsDragging) { return true; } @@ -4599,6 +4599,10 @@ public class Editor { mPositionX + mHotspotX + getHorizontalOffset(), mPositionY); } + private void setVisible(final boolean visible) { + mContainer.getContentView().setVisibility(visible ? VISIBLE : INVISIBLE); + } + public abstract int getCurrentCursorOffset(); protected abstract void updateSelection(int offset); @@ -4692,7 +4696,7 @@ public class Editor { onHandleMoved(); } - if (isVisible()) { + if (shouldShow()) { // Transform to the window coordinates to follow the view tranformation. final int[] pts = { mPositionX + mHotspotX + getHorizontalOffset(), mPositionY}; mTextView.transformFromViewToWindowSpace(pts); @@ -4745,6 +4749,15 @@ public class Editor { return 0; } + private boolean tooLargeTextForMagnifier() { + final float magnifierContentHeight = Math.round( + mMagnifierAnimator.mMagnifier.getHeight() + / mMagnifierAnimator.mMagnifier.getZoom()); + final Paint.FontMetrics fontMetrics = mTextView.getPaint().getFontMetrics(); + final float glyphHeight = fontMetrics.descent - fontMetrics.ascent; + return glyphHeight > magnifierContentHeight; + } + /** * Computes the position where the magnifier should be shown, relative to * {@code mTextView}, and writes them to {@code showPosInView}. Also decides @@ -4824,13 +4837,12 @@ public class Editor { return true; } - private boolean tooLargeTextForMagnifier() { - final float magnifierContentHeight = Math.round( - mMagnifierAnimator.mMagnifier.getHeight() - / mMagnifierAnimator.mMagnifier.getZoom()); - final Paint.FontMetrics fontMetrics = mTextView.getPaint().getFontMetrics(); - final float glyphHeight = fontMetrics.descent - fontMetrics.ascent; - return glyphHeight > magnifierContentHeight; + private boolean handleOverlapsMagnifier() { + final int handleY = mContainer.getDecorViewLayoutParams().y; + final int magnifierBottomWhenAtWindowTop = + mTextView.getRootWindowInsets().getSystemWindowInsetTop() + + mMagnifierAnimator.mMagnifier.getHeight(); + return handleY <= magnifierBottomWhenAtWindowTop; } protected final void updateMagnifier(@NonNull final MotionEvent event) { @@ -4846,6 +4858,13 @@ public class Editor { mRenderCursorRegardlessTiming = true; mTextView.invalidateCursorPath(); suspendBlink(); + // Hide handle if it overlaps the magnifier. + if (handleOverlapsMagnifier()) { + setVisible(false); + } else { + setVisible(true); + } + mMagnifierAnimator.show(showPosInView.x, showPosInView.y); } else { dismissMagnifier(); @@ -4857,6 +4876,7 @@ public class Editor { mMagnifierAnimator.dismiss(); mRenderCursorRegardlessTiming = false; resumeBlink(); + setVisible(true); } } diff --git a/core/jni/android/graphics/ImageDecoder.cpp b/core/jni/android/graphics/ImageDecoder.cpp index 726c450a4af2..825b7a0a9884 100644 --- a/core/jni/android/graphics/ImageDecoder.cpp +++ b/core/jni/android/graphics/ImageDecoder.cpp @@ -210,7 +210,7 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong jint desiredWidth, jint desiredHeight, jobject jsubset, jboolean requireMutable, jint allocator, jboolean requireUnpremul, jboolean preferRamOverQuality, - jboolean asAlphaMask) { + jboolean asAlphaMask, jobject jcolorSpace) { auto* decoder = reinterpret_cast<ImageDecoder*>(nativePtr); SkAndroidCodec* codec = decoder->mCodec.get(); const SkISize desiredSize = SkISize::Make(desiredWidth, desiredHeight); @@ -264,7 +264,8 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong // This is currently the only way to know that we should decode to F16. colorType = codec->computeOutputColorType(colorType); } - sk_sp<SkColorSpace> colorSpace = codec->computeOutputColorSpace(colorType); + sk_sp<SkColorSpace> colorSpace = GraphicsJNI::getNativeColorSpace(env, jcolorSpace); + colorSpace = codec->computeOutputColorSpace(colorType, colorSpace); decodeInfo = decodeInfo.makeColorType(colorType).makeColorSpace(colorSpace); SkBitmap bm; @@ -507,18 +508,26 @@ static jstring ImageDecoder_nGetMimeType(JNIEnv* env, jobject /*clazz*/, jlong n return encodedFormatToString(env, decoder->mCodec->getEncodedFormat()); } +static jobject ImageDecoder_nGetColorSpace(JNIEnv* env, jobject /*clazz*/, jlong nativePtr) { + auto* codec = reinterpret_cast<ImageDecoder*>(nativePtr)->mCodec.get(); + auto colorType = codec->computeOutputColorType(codec->getInfo().colorType()); + sk_sp<SkColorSpace> colorSpace = codec->computeOutputColorSpace(colorType); + return GraphicsJNI::getColorSpace(env, colorSpace, colorType); +} + static const JNINativeMethod gImageDecoderMethods[] = { { "nCreate", "(JLandroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateAsset }, { "nCreate", "(Ljava/nio/ByteBuffer;IILandroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateByteBuffer }, { "nCreate", "([BIILandroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateByteArray }, { "nCreate", "(Ljava/io/InputStream;[BLandroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateInputStream }, { "nCreate", "(Ljava/io/FileDescriptor;Landroid/graphics/ImageDecoder$Source;)Landroid/graphics/ImageDecoder;", (void*) ImageDecoder_nCreateFd }, - { "nDecodeBitmap", "(JLandroid/graphics/ImageDecoder;ZIILandroid/graphics/Rect;ZIZZZ)Landroid/graphics/Bitmap;", + { "nDecodeBitmap", "(JLandroid/graphics/ImageDecoder;ZIILandroid/graphics/Rect;ZIZZZLandroid/graphics/ColorSpace;)Landroid/graphics/Bitmap;", (void*) ImageDecoder_nDecodeBitmap }, { "nGetSampledSize","(JI)Landroid/util/Size;", (void*) ImageDecoder_nGetSampledSize }, { "nGetPadding", "(JLandroid/graphics/Rect;)V", (void*) ImageDecoder_nGetPadding }, { "nClose", "(J)V", (void*) ImageDecoder_nClose}, { "nGetMimeType", "(J)Ljava/lang/String;", (void*) ImageDecoder_nGetMimeType }, + { "nGetColorSpace", "(J)Landroid/graphics/ColorSpace;", (void*) ImageDecoder_nGetColorSpace }, }; int register_android_graphics_ImageDecoder(JNIEnv* env) { diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index cb375d5394fa..f4715fc7645d 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -3121,6 +3121,12 @@ <permission android:name="android.permission.CONFIGURE_DISPLAY_COLOR_MODE" android:protectionLevel="signature" /> + <!-- Allows an application to control the color saturation of the display. + @hide + @SystemApi --> + <permission android:name="android.permission.CONTROL_DISPLAY_SATURATION" + android:protectionLevel="signature|privileged" /> + <!-- Allows an application to collect usage infomation about brightness slider changes. <p>Not for use by third-party applications.</p> @hide diff --git a/graphics/java/android/graphics/ImageDecoder.java b/graphics/java/android/graphics/ImageDecoder.java index 6939907bb419..6051f88733bf 100644 --- a/graphics/java/android/graphics/ImageDecoder.java +++ b/graphics/java/android/graphics/ImageDecoder.java @@ -432,6 +432,18 @@ public final class ImageDecoder implements AutoCloseable { public boolean isAnimated() { return mDecoder.mAnimated; } + + /** + * If known, the color space the decoded bitmap will have. Note that the + * output color space is not guaranteed to be the color space the bitmap + * is encoded with. If not known (when the config is + * {@link Bitmap.Config#ALPHA_8} for instance), or there is an error, + * it is set to null. + */ + @Nullable + public ColorSpace getColorSpace() { + return mDecoder.getColorSpace(); + } }; /** @removed @@ -582,16 +594,17 @@ public final class ImageDecoder implements AutoCloseable { private final int mHeight; private final boolean mAnimated; - private int mDesiredWidth; - private int mDesiredHeight; - private int mAllocator = ALLOCATOR_DEFAULT; - private boolean mRequireUnpremultiplied = false; - private boolean mMutable = false; - private boolean mConserveMemory = false; - private boolean mDecodeAsAlphaMask = false; - private Rect mCropRect; - private Rect mOutPaddingRect; - private Source mSource; + private int mDesiredWidth; + private int mDesiredHeight; + private int mAllocator = ALLOCATOR_DEFAULT; + private boolean mRequireUnpremultiplied = false; + private boolean mMutable = false; + private boolean mConserveMemory = false; + private boolean mDecodeAsAlphaMask = false; + private ColorSpace mDesiredColorSpace = null; + private Rect mCropRect; + private Rect mOutPaddingRect; + private Source mSource; private PostProcessor mPostProcessor; private OnPartialImageListener mOnPartialImageListener; @@ -806,7 +819,8 @@ public final class ImageDecoder implements AutoCloseable { * image, which can be retrieved from the {@link ImageInfo} in * {@link OnHeaderDecodedListener#onHeaderDecoded}.</p> * - * <p>Only the last call to this or {@link #setSampleSize} is respected.</p> + * <p>Only the last call to this or {@link #setTargetSampleSize} is + * respected.</p> * * @param width must be greater than 0. * @param height must be greater than 0. @@ -824,11 +838,11 @@ public final class ImageDecoder implements AutoCloseable { } /** @removed - * @deprecated Renamed to {@link #setSampleSize}. + * @deprecated Renamed to {@link #setTargetSampleSize}. */ @java.lang.Deprecated public ImageDecoder setResize(int sampleSize) { - return this.setSampleSize(sampleSize); + return this.setTargetSampleSize(sampleSize); } private int getTargetDimension(int original, int sampleSize, int computed) { @@ -877,7 +891,7 @@ public final class ImageDecoder implements AutoCloseable { * @param sampleSize Sampling rate of the encoded image. * @return this object for chaining. */ - public ImageDecoder setSampleSize(int sampleSize) { + public ImageDecoder setTargetSampleSize(int sampleSize) { Size size = this.getSampledSize(sampleSize); int targetWidth = getTargetDimension(mWidth, sampleSize, size.getWidth()); int targetHeight = getTargetDimension(mHeight, sampleSize, size.getHeight()); @@ -1179,6 +1193,37 @@ public final class ImageDecoder implements AutoCloseable { return this.getDecodeAsAlphaMask(); } + /** + * Specify the desired {@link ColorSpace} for the output. + * + * <p>If non-null, the decoder will try to decode into this + * color space. If it is null, which is the default, or the request cannot + * be met, the decoder will pick either the color space embedded in the + * image or the color space best suited for the requested image + * configuration (for instance {@link ColorSpace.Named#SRGB sRGB} for + * the {@link Bitmap.Config#ARGB_8888} configuration).</p> + * + * <p>{@link Bitmap.Config#RGBA_F16} always uses the + * {@link ColorSpace.Named#LINEAR_EXTENDED_SRGB scRGB} color space). + * Bitmaps in other configurations without an embedded color space are + * assumed to be in the {@link ColorSpace.Named#SRGB sRGB} color space.</p> + * + * <p class="note">Only {@link ColorSpace.Model#RGB} color spaces are + * currently supported. An <code>IllegalArgumentException</code> will + * be thrown by the decode methods when setting a non-RGB color space + * such as {@link ColorSpace.Named#CIE_LAB Lab}.</p> + * + * <p class="note">The specified color space's transfer function must be + * an {@link ColorSpace.Rgb.TransferParameters ICC parametric curve}. An + * <code>IllegalArgumentException</code> will be thrown by the decode methods + * if calling {@link ColorSpace.Rgb#getTransferParameters()} on the + * specified color space returns null.</p> + */ + public ImageDecoder setTargetColorSpace(ColorSpace colorSpace) { + mDesiredColorSpace = colorSpace; + return this; + } + @Override public void close() { mCloseGuard.close(); @@ -1217,6 +1262,17 @@ public final class ImageDecoder implements AutoCloseable { if (mPostProcessor != null && mRequireUnpremultiplied) { throw new IllegalStateException("Cannot draw to unpremultiplied pixels!"); } + + if (mDesiredColorSpace != null) { + if (!(mDesiredColorSpace instanceof ColorSpace.Rgb)) { + throw new IllegalArgumentException("The target color space must use the " + + "RGB color model - provided: " + mDesiredColorSpace); + } + if (((ColorSpace.Rgb) mDesiredColorSpace).getTransferParameters() == null) { + throw new IllegalArgumentException("The target color space must use an " + + "ICC parametric transfer function - provided: " + mDesiredColorSpace); + } + } } private static void checkSubset(int width, int height, Rect r) { @@ -1235,7 +1291,7 @@ public final class ImageDecoder implements AutoCloseable { return nDecodeBitmap(mNativePtr, this, mPostProcessor != null, mDesiredWidth, mDesiredHeight, mCropRect, mMutable, mAllocator, mRequireUnpremultiplied, - mConserveMemory, mDecodeAsAlphaMask); + mConserveMemory, mDecodeAsAlphaMask, mDesiredColorSpace); } private void callHeaderDecoded(@Nullable OnHeaderDecodedListener listener, @@ -1425,6 +1481,11 @@ public final class ImageDecoder implements AutoCloseable { return nGetMimeType(mNativePtr); } + @Nullable + private ColorSpace getColorSpace() { + return nGetColorSpace(mNativePtr); + } + /** * See {@link #decodeBitmap(Source, OnHeaderDecodedListener)}. */ @@ -1474,11 +1535,13 @@ public final class ImageDecoder implements AutoCloseable { int width, int height, @Nullable Rect cropRect, boolean mutable, int allocator, boolean requireUnpremul, - boolean conserveMemory, boolean decodeAsAlphaMask) + boolean conserveMemory, boolean decodeAsAlphaMask, + @Nullable ColorSpace desiredColorSpace) throws IOException; private static native Size nGetSampledSize(long nativePtr, int sampleSize); private static native void nGetPadding(long nativePtr, @NonNull Rect outRect); private static native void nClose(long nativePtr); private static native String nGetMimeType(long nativePtr); + private static native ColorSpace nGetColorSpace(long nativePtr); } diff --git a/packages/MtpDocumentsProvider/perf_tests/Android.mk b/packages/MtpDocumentsProvider/perf_tests/Android.mk index 6504af12db23..e873157dcf34 100644 --- a/packages/MtpDocumentsProvider/perf_tests/Android.mk +++ b/packages/MtpDocumentsProvider/perf_tests/Android.mk @@ -8,5 +8,6 @@ LOCAL_PACKAGE_NAME := MtpDocumentsProviderPerfTests LOCAL_PRIVATE_PLATFORM_APIS := true LOCAL_INSTRUMENTATION_FOR := MtpDocumentsProvider LOCAL_CERTIFICATE := media +LOCAL_COMPATIBILITY_SUITE += device-tests include $(BUILD_PACKAGE) diff --git a/packages/MtpDocumentsProvider/perf_tests/AndroidTest.xml b/packages/MtpDocumentsProvider/perf_tests/AndroidTest.xml new file mode 100644 index 000000000000..8b7292b625e1 --- /dev/null +++ b/packages/MtpDocumentsProvider/perf_tests/AndroidTest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 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. +--> +<configuration description="Runs MtpDocumentsProviderPerfTests metric instrumentation."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-metric-instrumentation" /> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true" /> + <option name="test-file-name" value="MtpDocumentsProviderPerfTests.apk" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.AndroidJUnitTest" > + <option name="package" value="com.android.mtp.perftests" /> + </test> +</configuration> diff --git a/packages/SystemUI/res/drawable/ic_1x_mobiledata.xml b/packages/SystemUI/res/drawable/ic_1x_mobiledata.xml index 726d814f7eb2..c0e0e59a88e2 100644 --- a/packages/SystemUI/res/drawable/ic_1x_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_1x_mobiledata.xml @@ -14,17 +14,17 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="14dp" - android:height="24dp" - android:viewportWidth="14" - android:viewportHeight="24"> + android:width="14dp" + android:height="17dp" + android:viewportWidth="14" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M5.62,16.29H4.58V9.06l-1.79,0.8V8.88l2.67-1.17h0.16V16.29z" /> + android:pathData="M3.77,13.48H2.55V5.05L0.46,5.98V4.84l3.12-1.36h0.19V13.48z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M11.08,11.02l1.61-3.27h1.26l-2.22,4.23l2.27,4.3h-1.27l-1.64-3.33l-1.65,3.33H8.16l2.28-4.3L8.21,7.75h1.25L11.08,11.02z" /> + android:pathData="M10.14,7.34l1.87-3.81h1.47L10.9,8.46l2.65,5.02h-1.48l-1.91-3.88l-1.92,3.88H6.74L9.4,8.46l-2.6-4.94h1.46L10.14,7.34z" /> <path - android:pathData="M 0 0 H 13.99 V 24 H 0 V 0 Z" /> -</vector>
\ No newline at end of file + android:pathData="M 0 0 H 14 V 17 H 0 V 0 Z" /> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_3g_mobiledata.xml b/packages/SystemUI/res/drawable/ic_3g_mobiledata.xml index 7a539ffe3471..e4a5bf8a9130 100644 --- a/packages/SystemUI/res/drawable/ic_3g_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_3g_mobiledata.xml @@ -14,17 +14,17 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="14dp" - android:height="24dp" - android:viewportWidth="14" - android:viewportHeight="24"> + android:width="14dp" + android:height="17dp" + android:viewportWidth="14" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M3.83,11.38h0.66c0.43,0,0.75-0.13,0.98-0.39s0.35-0.62,0.35-1.07c0-1-0.39-1.5-1.16-1.5c-0.37,0-0.66,0.13-0.87,0.4 S3.47,9.44,3.47,9.88H2.44c0-0.68,0.21-1.25,0.62-1.69s0.95-0.67,1.6-0.67c0.67,0,1.21,0.21,1.6,0.63s0.59,1.01,0.59,1.78 c0,0.39-0.1,0.76-0.31,1.1s-0.47,0.59-0.8,0.75c0.8,0.3,1.21,0.96,1.21,2c0,0.76-0.21,1.37-0.64,1.82s-0.98,0.68-1.66,0.68 c-0.68,0-1.22-0.21-1.64-0.64s-0.62-1-0.62-1.73h1.04c0,0.45,0.11,0.81,0.33,1.08s0.52,0.4,0.9,0.4c0.39,0,0.69-0.13,0.92-0.39 s0.34-0.66,0.34-1.2c0-1.04-0.49-1.55-1.47-1.55H3.83V11.38z" /> + android:pathData="M1.9,7.88h0.77c0.5,0,0.88-0.15,1.15-0.46s0.4-0.72,0.4-1.25c0-1.17-0.45-1.75-1.35-1.75c-0.43,0-0.77,0.16-1.02,0.47 S1.49,5.62,1.49,6.13h-1.2c0-0.8,0.24-1.46,0.73-1.97s1.11-0.78,1.86-0.78c0.78,0,1.41,0.25,1.87,0.73S5.43,5.31,5.43,6.2 c0,0.46-0.12,0.89-0.36,1.29S4.52,8.18,4.14,8.37c0.94,0.35,1.41,1.12,1.41,2.33c0,0.89-0.25,1.6-0.74,2.12 c-0.49,0.53-1.14,0.79-1.94,0.79c-0.79,0-1.43-0.25-1.91-0.75c-0.49-0.5-0.73-1.17-0.73-2.01h1.21c0,0.53,0.13,0.95,0.38,1.26 c0.26,0.31,0.6,0.47,1.05,0.47c0.45,0,0.81-0.15,1.08-0.46s0.4-0.77,0.4-1.39c0-1.21-0.57-1.81-1.72-1.81H1.9V7.88z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M14,15.11l-0.19,0.23c-0.54,0.63-1.33,0.94-2.37,0.94c-0.92,0-1.65-0.31-2.17-0.92s-0.79-1.48-0.81-2.59V11.1 c0-1.2,0.24-2.09,0.72-2.69s1.19-0.89,2.15-0.89c0.81,0,1.45,0.23,1.91,0.68s0.71,1.1,0.76,1.94h-1.07 c-0.04-0.53-0.19-0.95-0.44-1.25s-0.63-0.45-1.15-0.45c-0.61,0-1.06,0.2-1.35,0.6s-0.43,1.04-0.45,1.92v1.74 c0,0.86,0.16,1.52,0.49,1.98s0.8,0.69,1.41,0.69c0.58,0,1.02-0.14,1.32-0.42l0.16-0.15v-1.96h-1.56v-0.92H14V15.11z" /> + android:pathData="M13.77,12.24l-0.22,0.27c-0.63,0.73-1.55,1.1-2.76,1.1c-1.08,0-1.92-0.36-2.53-1.07c-0.61-0.71-0.93-1.72-0.94-3.02V7.56 c0-1.39,0.28-2.44,0.84-3.13s1.39-1.04,2.51-1.04c0.95,0,1.69,0.26,2.23,0.79s0.83,1.28,0.89,2.26h-1.25 C12.47,5.82,12.3,5.33,12,4.98s-0.74-0.52-1.34-0.52c-0.72,0-1.24,0.23-1.57,0.7S8.59,6.37,8.58,7.4v2.03c0,1,0.19,1.77,0.57,2.31 c0.38,0.54,0.93,0.8,1.65,0.8c0.67,0,1.19-0.16,1.54-0.49l0.18-0.17V9.59H10.7V8.52h3.07V12.24z" /> <path - android:pathData="M 0 0 H 14 V 24 H 0 V 0 Z" /> -</vector>
\ No newline at end of file + android:pathData="M 0 0 H 14 V 17 H 0 V 0 Z" /> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_4g_mobiledata.xml b/packages/SystemUI/res/drawable/ic_4g_mobiledata.xml index b2fab0c80d51..e98560b9c0a2 100644 --- a/packages/SystemUI/res/drawable/ic_4g_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_4g_mobiledata.xml @@ -14,17 +14,17 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="14dp" - android:height="24dp" - android:viewportWidth="14" - android:viewportHeight="24"> + android:width="14dp" + android:height="17dp" + android:viewportWidth="14" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M6.42,13.3h0.95v0.88H6.42v1.98H5.38v-1.98H2.16v-0.64l3.17-5.91h1.09C6.42,7.63,6.42,13.3,6.42,13.3z M3.31,13.3h2.07 V9.25L3.31,13.3z" /> + android:pathData="M5.07,10.13h1.11v1.03H5.07v2.31H3.86v-2.31H0.1v-0.75l3.7-6.9h1.27V10.13z M1.44,10.13h2.42V5.4L1.44,10.13z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M13.99,15.11l-0.19,0.23c-0.54,0.63-1.33,0.94-2.37,0.94c-0.92,0-1.65-0.31-2.17-0.92s-0.79-1.48-0.8-2.59V11.1 c0-1.2,0.24-2.09,0.72-2.69s1.2-0.89,2.15-0.89c0.81,0,1.45,0.23,1.91,0.68s0.71,1.1,0.76,1.94h-1.07 c-0.04-0.53-0.19-0.95-0.44-1.25s-0.63-0.45-1.14-0.45c-0.61,0-1.06,0.2-1.35,0.6s-0.43,1.04-0.45,1.92v1.74 c0,0.86,0.16,1.52,0.49,1.98s0.8,0.69,1.41,0.69c0.58,0,1.02-0.14,1.32-0.42l0.16-0.15v-1.96h-1.56v-0.92h2.62V15.11z" /> + android:pathData="M13.9,12.24l-0.22,0.27c-0.63,0.73-1.55,1.1-2.76,1.1c-1.08,0-1.92-0.36-2.53-1.07c-0.61-0.71-0.93-1.72-0.94-3.02V7.56 c0-1.39,0.28-2.44,0.84-3.13s1.39-1.04,2.51-1.04c0.95,0,1.69,0.26,2.23,0.79s0.83,1.28,0.89,2.26h-1.25 c-0.05-0.62-0.22-1.1-0.52-1.45s-0.74-0.52-1.34-0.52c-0.72,0-1.24,0.23-1.57,0.7S8.72,6.37,8.71,7.4v2.03 c0,1,0.19,1.77,0.57,2.31c0.38,0.54,0.93,0.8,1.65,0.8c0.67,0,1.19-0.16,1.54-0.49l0.18-0.17V9.59h-1.82V8.52h3.07V12.24z" /> <path - android:pathData="M 0 0 H 14 V 24 H 0 V 0 Z" /> + android:pathData="M 0 0 H 14 V 17 H 0 V 0 Z" /> </vector> diff --git a/packages/SystemUI/res/drawable/ic_4g_plus_mobiledata.xml b/packages/SystemUI/res/drawable/ic_4g_plus_mobiledata.xml index bdbb2df3ce0e..bf39ea2798b3 100644 --- a/packages/SystemUI/res/drawable/ic_4g_plus_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_4g_plus_mobiledata.xml @@ -14,20 +14,20 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="20dp" - android:height="24dp" - android:viewportWidth="20" - android:viewportHeight="24"> + android:width="22dp" + android:height="17dp" + android:viewportWidth="22" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M6.18,13.3h0.95v0.88H6.18v1.98H5.14v-1.98H1.92v-0.64l3.17-5.91h1.09V13.3z M3.07,13.3h2.07V9.25L3.07,13.3z" /> + android:pathData="M5.32,10.13h1.11v1.03H5.32v2.31H4.11v-2.31H0.35v-0.75l3.7-6.9h1.27V10.13z M1.69,10.13h2.42V5.4L1.69,10.13z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M13.75,15.11l-0.19,0.23c-0.54,0.63-1.33,0.94-2.37,0.94c-0.92,0-1.65-0.31-2.17-0.92s-0.79-1.48-0.8-2.59V11.1 c0-1.2,0.24-2.09,0.72-2.69s1.2-0.89,2.15-0.89c0.81,0,1.45,0.23,1.91,0.68s0.71,1.1,0.76,1.94h-1.07 c-0.04-0.53-0.19-0.95-0.44-1.25s-0.63-0.45-1.14-0.45c-0.61,0-1.06,0.2-1.35,0.6s-0.43,1.04-0.45,1.92v1.74 c0,0.86,0.16,1.52,0.49,1.98s0.8,0.69,1.41,0.69c0.58,0,1.02-0.14,1.32-0.42l0.16-0.15v-1.96h-1.56v-0.92h2.63V15.11z" /> + android:pathData="M14.15,12.24l-0.22,0.27c-0.63,0.73-1.55,1.1-2.76,1.1c-1.08,0-1.92-0.36-2.53-1.07c-0.61-0.71-0.93-1.72-0.94-3.02V7.56 c0-1.39,0.28-2.44,0.84-3.13s1.39-1.04,2.51-1.04c0.95,0,1.69,0.26,2.23,0.79s0.83,1.28,0.89,2.26H12.9 c-0.05-0.62-0.22-1.1-0.52-1.45s-0.74-0.52-1.34-0.52c-0.72,0-1.24,0.23-1.57,0.7S8.97,6.37,8.96,7.4v2.03 c0,1,0.19,1.77,0.57,2.31c0.38,0.54,0.93,0.8,1.65,0.8c0.67,0,1.19-0.16,1.54-0.49l0.18-0.17V9.59h-1.82V8.52h3.07V12.24z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M 20 9.64 L 18 9.64 L 18 7.64 L 17 7.64 L 17 9.64 L 15 9.64 L 15 10.64 L 17 10.64 L 17 12.64 L 18 12.64 L 18 10.64 L 20 10.64 Z" /> + android:pathData="M 19.3 5.74 L 19.3 3.39 L 18 3.39 L 18 5.74 L 15.65 5.74 L 15.65 7.04 L 18 7.04 L 18 9.39 L 19.3 9.39 L 19.3 7.04 L 21.65 7.04 L 21.65 5.74 Z" /> <path - android:pathData="M 0 0 H 20 V 24 H 0 V 0 Z" /> + android:pathData="M 0 0 H 22 V 17 H 0 V 0 Z" /> </vector> diff --git a/packages/SystemUI/res/drawable/ic_e_mobiledata.xml b/packages/SystemUI/res/drawable/ic_e_mobiledata.xml index 1a4a2e362b47..ca601d6c36ab 100644 --- a/packages/SystemUI/res/drawable/ic_e_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_e_mobiledata.xml @@ -14,14 +14,14 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="7dp" - android:height="24dp" - android:viewportWidth="7" - android:viewportHeight="24"> + android:width="6dp" + android:height="17dp" + android:viewportWidth="6" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M6.5,12.32H3.48v3.02H7v0.92H2.41V7.73h4.53v0.92H3.48v2.75H6.5V12.32z" /> + android:pathData="M5.1,8.88H1.57v3.53h4.1v1.07H0.32V3.52h5.28V4.6H1.57V7.8H5.1V8.88z" /> <path - android:pathData="M 0 0 H 7 V 24 H 0 V 0 Z" /> + android:pathData="M 0 0 H 6 V 17 H 0 V 0 Z" /> </vector> diff --git a/packages/SystemUI/res/drawable/ic_g_mobiledata.xml b/packages/SystemUI/res/drawable/ic_g_mobiledata.xml index d6a0488544fd..8ff6d7a5cc88 100644 --- a/packages/SystemUI/res/drawable/ic_g_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_g_mobiledata.xml @@ -14,14 +14,14 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="8dp" - android:height="24dp" - android:viewportWidth="8" - android:viewportHeight="24"> + android:width="7dp" + android:height="17dp" + android:viewportWidth="7" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M8,15.21l-0.19,0.23c-0.54,0.63-1.33,0.94-2.37,0.94c-0.92,0-1.65-0.31-2.17-0.92s-0.79-1.48-0.81-2.59V11.2 c0-1.2,0.24-2.09,0.72-2.69s1.19-0.89,2.15-0.89c0.81,0,1.45,0.23,1.91,0.68S7.95,9.39,8,10.23H6.93C6.88,9.7,6.74,9.28,6.49,8.99 S5.85,8.54,5.34,8.54c-0.61,0-1.06,0.2-1.35,0.6s-0.43,1.04-0.45,1.92v1.74c0,0.86,0.16,1.52,0.49,1.98s0.8,0.69,1.41,0.69 c0.58,0,1.02-0.14,1.32-0.42l0.16-0.15v-1.96H5.37v-0.92H8V15.21z" /> + android:pathData="M6.73,12.24l-0.22,0.27c-0.63,0.73-1.55,1.1-2.76,1.1c-1.08,0-1.92-0.36-2.53-1.07c-0.61-0.71-0.93-1.72-0.94-3.02V7.56 c0-1.39,0.28-2.44,0.84-3.13S2.5,3.39,3.62,3.39c0.95,0,1.69,0.26,2.23,0.79s0.83,1.28,0.89,2.26H5.48 c-0.05-0.62-0.22-1.1-0.52-1.45S4.22,4.46,3.62,4.46c-0.72,0-1.24,0.23-1.57,0.7S1.54,6.37,1.53,7.4v2.03c0,1,0.19,1.77,0.57,2.31 c0.38,0.54,0.93,0.8,1.65,0.8c0.67,0,1.19-0.16,1.54-0.49l0.18-0.17V9.59H3.66V8.52h3.07V12.24z" /> <path - android:pathData="M 0 0 H 8 V 24 H 0 V 0 Z" /> + android:pathData="M 0 0 H 7 V 17 H 0 V 0 Z" /> </vector> diff --git a/packages/SystemUI/res/drawable/ic_h_mobiledata.xml b/packages/SystemUI/res/drawable/ic_h_mobiledata.xml index be85bbb4f79b..68ea58e33f31 100644 --- a/packages/SystemUI/res/drawable/ic_h_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_h_mobiledata.xml @@ -14,14 +14,14 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="8dp" - android:height="24dp" - android:viewportWidth="8" - android:viewportHeight="24"> + android:width="7dp" + android:height="17dp" + android:viewportWidth="7" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M8,16.27H6.92v-3.94H3.49v3.94H2.42V7.73h1.07v3.67h3.43V7.73H8V16.27z" /> + android:pathData="M6.76,13.48H5.5v-4.6H1.49v4.6H0.24V3.52h1.25V7.8H5.5V3.52h1.26V13.48z" /> <path - android:pathData="M 0 0 H 8 V 24 H 0 V 0 Z" /> + android:pathData="M 0 0 H 7 V 17 H 0 V 0 Z" /> </vector> diff --git a/packages/SystemUI/res/drawable/ic_h_plus_mobiledata.xml b/packages/SystemUI/res/drawable/ic_h_plus_mobiledata.xml index f31f83c51412..4212800217ec 100644 --- a/packages/SystemUI/res/drawable/ic_h_plus_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_h_plus_mobiledata.xml @@ -14,17 +14,17 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="14dp" - android:height="24dp" - android:viewportWidth="14" - android:viewportHeight="24"> + android:width="15dp" + android:height="17dp" + android:viewportWidth="15" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M7.64,16.27H6.56v-3.94H3.13v3.94H2.06V7.73h1.07v3.67h3.43V7.73h1.08V16.27z" /> + android:pathData="M7.01,13.48H5.75v-4.6H1.74v4.6H0.49V3.52h1.25V7.8h4.01V3.52h1.26V13.48z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M 14 9.73 L 12 9.73 L 12 7.73 L 11 7.73 L 11 9.73 L 9 9.73 L 9 10.73 L 11 10.73 L 11 12.73 L 12 12.73 L 12 10.73 L 14 10.73 Z" /> + android:pathData="M 12.16 5.74 L 12.16 3.39 L 10.86 3.39 L 10.86 5.74 L 8.51 5.74 L 8.51 7.04 L 10.86 7.04 L 10.86 9.39 L 12.16 9.39 L 12.16 7.04 L 14.51 7.04 L 14.51 5.74 Z" /> <path - android:pathData="M 0 0 H 14 V 24 H 0 V 0 Z" /> + android:pathData="M 0 0 H 15 V 17 H 0 V 0 Z" /> </vector> diff --git a/packages/SystemUI/res/drawable/ic_lte_mobiledata.xml b/packages/SystemUI/res/drawable/ic_lte_mobiledata.xml index e45b5e05aff0..7536f5134cbe 100644 --- a/packages/SystemUI/res/drawable/ic_lte_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_lte_mobiledata.xml @@ -14,20 +14,20 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="18dp" - android:height="24dp" - android:viewportWidth="18" - android:viewportHeight="24"> + android:width="18dp" + android:height="17dp" + android:viewportWidth="18" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M3.79,15.35h3.35v0.92H2.71V7.73h1.08V15.35z" /> + android:pathData="M1.34,12.4h3.9v1.07H0.08V3.52h1.26V12.4z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M12.15,8.65H9.91v7.61H8.84V8.65H6.6V7.73h5.55V8.65z" /> + android:pathData="M11.1,4.6H8.48v8.88H7.23V4.6H4.62V3.52h6.48V4.6z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M17.5,12.32h-3.02v3.02H18v0.92h-4.59V7.73h4.53v0.92h-3.46v2.75h3.02V12.32z" /> + android:pathData="M17.34,8.88h-3.52v3.53h4.1v1.07h-5.35V3.52h5.28V4.6h-4.03V7.8h3.52V8.88z" /> <path - android:pathData="M 0 0 H 18 V 24 H 0 V 0 Z" /> + android:pathData="M 0 0 H 18 V 17 H 0 V 0 Z" /> </vector> diff --git a/packages/SystemUI/res/drawable/ic_lte_plus_mobiledata.xml b/packages/SystemUI/res/drawable/ic_lte_plus_mobiledata.xml index 553a5bdc021e..302e3bdc5287 100644 --- a/packages/SystemUI/res/drawable/ic_lte_plus_mobiledata.xml +++ b/packages/SystemUI/res/drawable/ic_lte_plus_mobiledata.xml @@ -14,23 +14,23 @@ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> + android:width="26dp" + android:height="17dp" + android:viewportWidth="26" + android:viewportHeight="17"> <path android:fillColor="#FFFFFFFF" - android:pathData="M3.91,15.35h3.35v0.92H2.84V7.73h1.08V15.35z" /> + android:pathData="M1.59,12.4h3.9v1.07H0.33V3.52h1.26V12.4z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M12.28,8.65h-2.24v7.61H8.96V8.65H6.73V7.73h5.55V8.65z" /> + android:pathData="M11.35,4.6H8.73v8.88H7.48V4.6H4.87V3.52h6.48V4.6z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M17.63,12.32h-3.02v3.02h3.52v0.92h-4.59V7.73h4.53v0.92h-3.46v2.75h3.02V12.32z" /> + android:pathData="M17.59,8.88h-3.52v3.53h4.1v1.07h-5.35V3.52h5.28V4.6h-4.03V7.8h3.52V8.88z" /> <path android:fillColor="#FFFFFFFF" - android:pathData="M 24 9.76 L 22 9.76 L 22 7.76 L 21 7.76 L 21 9.76 L 19 9.76 L 19 10.76 L 21 10.76 L 21 12.76 L 22 12.76 L 22 10.76 L 24 10.76 Z" /> + android:pathData="M 23.32 5.74 L 23.32 3.39 L 22.02 3.39 L 22.02 5.74 L 19.67 5.74 L 19.67 7.04 L 22.02 7.04 L 22.02 9.39 L 23.32 9.39 L 23.32 7.04 L 25.67 7.04 L 25.67 5.74 Z" /> <path - android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" /> + android:pathData="M 0 0 H 26 V 17 H 0 V 0 Z" /> </vector> diff --git a/packages/SystemUI/res/drawable/stat_sys_roaming.xml b/packages/SystemUI/res/drawable/stat_sys_roaming.xml index bd2edf39d929..0dd9f5a39f91 100644 --- a/packages/SystemUI/res/drawable/stat_sys_roaming.xml +++ b/packages/SystemUI/res/drawable/stat_sys_roaming.xml @@ -1,28 +1,27 @@ <!-- -Copyright (C) 2014 The Android Open Source Project + Copyright (C) 2018 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 + 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 + 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. + 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="@dimen/signal_icon_size" android:height="@dimen/signal_icon_size" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#FFFFFFFF" - android:pathData="M7.8,7.2L9,10H7L5.87,7.33H4V10H2V2h5c1.13,0,2,0.87,2,2v1.33C9,6.13,8.47,6.87,7.8,7.2z M7,4H4v1.33h3V4z" /> - <path - android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" /> - <path - android:pathData="M0,0h24v24H0V0z" /> -</vector>
\ No newline at end of file + android:viewportWidth="17" + android:viewportHeight="17"> + +<path + android:fillColor="#FFFFFFFF" + android:pathData="M2.93,4.81H1.81V7.4H1V1h1.79c0.63,0,1.1,0.16,1.42,0.49S4.7,2.29,4.7,2.92c0,0.4-0.09,0.74-0.26,1.04 C4.26,4.25,4.02,4.48,3.7,4.63l1.24,2.72V7.4H4.07L2.93,4.81z M1.81,4.12h0.98c0.34,0,0.61-0.11,0.81-0.33 c0.2-0.22,0.3-0.51,0.3-0.87c0-0.82-0.37-1.23-1.12-1.23H1.81V4.12z" /> +<path + android:pathData="M 0 0 H 17 V 17 H 0 V 0 Z" /> +</vector> diff --git a/packages/SystemUI/res/layout/mobile_signal_group.xml b/packages/SystemUI/res/layout/mobile_signal_group.xml index cc6e3bfbebaa..5ecd380c6950 100644 --- a/packages/SystemUI/res/layout/mobile_signal_group.xml +++ b/packages/SystemUI/res/layout/mobile_signal_group.xml @@ -50,7 +50,8 @@ android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center_vertical" - android:paddingEnd="1dp" + android:paddingStart="1dp" + android:paddingEnd="2dp" android:visibility="gone" /> <Space android:id="@+id/mobile_roaming_space" diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 706a6ab8436f..e14584f9070b 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -2503,8 +2503,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState pw.print(prefix); pw.print("mHasCallback: "); pw.println(mHasCallback); if (mClientState != null) { - pw.print(prefix); pw.println("mClientState: "); pw.print(mClientState.getSize()); pw - .println(" items"); + pw.print(prefix); pw.print("mClientState: "); pw.print(mClientState.getSize()); pw + .println(" bytes"); } pw.print(prefix); pw.print("mCompatMode: "); pw.println(mCompatMode); pw.print(prefix); pw.print("mUrlBar: "); diff --git a/services/core/java/com/android/server/am/LockTaskController.java b/services/core/java/com/android/server/am/LockTaskController.java index 106b37f819c3..bef650b90f44 100644 --- a/services/core/java/com/android/server/am/LockTaskController.java +++ b/services/core/java/com/android/server/am/LockTaskController.java @@ -285,6 +285,16 @@ public class LockTaskController { return false; } + /** + * @return the root task of the lock task. + */ + TaskRecord getRootTask() { + if (mLockTaskModeTasks.isEmpty()) { + return null; + } + return mLockTaskModeTasks.get(0); + } + private boolean isLockTaskModeViolationInternal(TaskRecord task, boolean isNewClearTask) { // TODO: Double check what's going on here. If the task is already in lock task mode, it's // likely whitelisted, so will return false below. diff --git a/services/core/java/com/android/server/am/RecentTasks.java b/services/core/java/com/android/server/am/RecentTasks.java index fcf00ce79ea9..1d305fb4248f 100644 --- a/services/core/java/com/android/server/am/RecentTasks.java +++ b/services/core/java/com/android/server/am/RecentTasks.java @@ -1155,6 +1155,11 @@ class RecentTasks { } } + // If we're in lock task mode, ignore the root task + if (task == mService.mLockTaskController.getRootTask()) { + return false; + } + return true; } diff --git a/services/core/java/com/android/server/broadcastradio/hal1/TunerCallback.java b/services/core/java/com/android/server/broadcastradio/hal1/TunerCallback.java index 32b1d1adfe3a..7a6d9647bf43 100644 --- a/services/core/java/com/android/server/broadcastradio/hal1/TunerCallback.java +++ b/services/core/java/com/android/server/broadcastradio/hal1/TunerCallback.java @@ -17,6 +17,7 @@ package com.android.server.broadcastradio.hal1; import android.annotation.NonNull; +import android.annotation.Nullable; import android.hardware.radio.ITuner; import android.hardware.radio.ITunerCallback; import android.hardware.radio.ProgramList; @@ -87,8 +88,9 @@ class TunerCallback implements ITunerCallback { mTuner.close(); } - void startProgramListUpdates(@NonNull ProgramList.Filter filter) { - mProgramListFilter.set(Objects.requireNonNull(filter)); + void startProgramListUpdates(@Nullable ProgramList.Filter filter) { + if (filter == null) filter = new ProgramList.Filter(); + mProgramListFilter.set(filter); sendProgramListUpdate(); } diff --git a/services/core/java/com/android/server/broadcastradio/hal2/Convert.java b/services/core/java/com/android/server/broadcastradio/hal2/Convert.java index 248151ca2bd3..9730c9a1a380 100644 --- a/services/core/java/com/android/server/broadcastradio/hal2/Convert.java +++ b/services/core/java/com/android/server/broadcastradio/hal2/Convert.java @@ -375,7 +375,9 @@ class Convert { ); } - static @NonNull ProgramFilter programFilterToHal(@NonNull ProgramList.Filter filter) { + static @NonNull ProgramFilter programFilterToHal(@Nullable ProgramList.Filter filter) { + if (filter == null) filter = new ProgramList.Filter(); + ProgramFilter hwFilter = new ProgramFilter(); filter.getIdentifierTypes().stream().forEachOrdered(hwFilter.identifierTypes::add); diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java index c4b2b5ed3ccf..c7ae1f4f5e50 100644 --- a/services/core/java/com/android/server/display/DisplayManagerService.java +++ b/services/core/java/com/android/server/display/DisplayManagerService.java @@ -695,6 +695,27 @@ public final class DisplayManagerService extends SystemService { } } + private void setSaturationLevelInternal(float level) { + if (level < 0 || level > 1) { + throw new IllegalArgumentException("Saturation level must be between 0 and 1"); + } + float[] matrix = (level == 1.0f ? null : computeSaturationMatrix(level)); + DisplayTransformManager dtm = LocalServices.getService(DisplayTransformManager.class); + dtm.setColorMatrix(DisplayTransformManager.LEVEL_COLOR_MATRIX_SATURATION, matrix); + } + + private static float[] computeSaturationMatrix(float saturation) { + float desaturation = 1.0f - saturation; + float[] luminance = {0.231f * desaturation, 0.715f * desaturation, 0.072f * desaturation}; + float[] matrix = { + luminance[0] + saturation, luminance[0], luminance[0], 0, + luminance[1], luminance[1] + saturation, luminance[1], 0, + luminance[2], luminance[2], luminance[2] + saturation, 0, + 0, 0, 0, 1 + }; + return matrix; + } + private int createVirtualDisplayInternal(IVirtualDisplayCallback callback, IMediaProjection projection, int callingUid, String packageName, String name, int width, int height, int densityDpi, Surface surface, int flags, String uniqueId) { @@ -1687,6 +1708,19 @@ public final class DisplayManagerService extends SystemService { } @Override // Binder call + public void setSaturationLevel(float level) { + mContext.enforceCallingOrSelfPermission( + Manifest.permission.CONTROL_DISPLAY_SATURATION, + "Permission required to set display saturation level"); + final long token = Binder.clearCallingIdentity(); + try { + setSaturationLevelInternal(level); + } finally { + Binder.restoreCallingIdentity(token); + } + } + + @Override // Binder call public int createVirtualDisplay(IVirtualDisplayCallback callback, IMediaProjection projection, String packageName, String name, int width, int height, int densityDpi, Surface surface, int flags, diff --git a/services/core/java/com/android/server/display/DisplayTransformManager.java b/services/core/java/com/android/server/display/DisplayTransformManager.java index 000fcf3e992b..a94f049f7ef8 100644 --- a/services/core/java/com/android/server/display/DisplayTransformManager.java +++ b/services/core/java/com/android/server/display/DisplayTransformManager.java @@ -17,7 +17,6 @@ package com.android.server.display; import android.app.ActivityManager; -import android.app.IActivityManager; import android.opengl.Matrix; import android.os.IBinder; import android.os.Parcel; @@ -28,7 +27,6 @@ import android.util.Log; import android.util.Slog; import android.util.SparseArray; import com.android.internal.annotations.GuardedBy; - import com.android.internal.app.ColorDisplayController; import java.util.Arrays; @@ -46,6 +44,10 @@ public class DisplayTransformManager { */ public static final int LEVEL_COLOR_MATRIX_NIGHT_DISPLAY = 100; /** + * Color transform level used to adjust the color saturation of the display. + */ + public static final int LEVEL_COLOR_MATRIX_SATURATION = 150; + /** * Color transform level used by A11y services to make the display monochromatic. */ public static final int LEVEL_COLOR_MATRIX_GRAYSCALE = 200; diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index e08ec556c68f..b0b313b80ed8 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -808,7 +808,7 @@ public class PackageManagerService extends IPackageManager.Stub } final String[] getStaticOverlayPaths(List<PackageParser.Package> overlayPackages, - String targetPath, Object installLock) { + String targetPath) { if (overlayPackages == null || overlayPackages.isEmpty()) { return null; } @@ -828,20 +828,9 @@ public class PackageManagerService extends IPackageManager.Stub // // OverlayManagerService will update each of them with a correct gid from its // target package app id. - if (installLock != null) { - synchronized (installLock) { - mInstaller.idmap(targetPath, overlayPackage.baseCodePath, - UserHandle.getSharedAppGid( - UserHandle.getUserGid(UserHandle.USER_SYSTEM))); - } - } else { - // We can call mInstaller without holding mInstallLock because mInstallLock - // is held before running parallel parsing. - // Moreover holding mInstallLock on each parsing thread causes dead-lock. - mInstaller.idmap(targetPath, overlayPackage.baseCodePath, - UserHandle.getSharedAppGid( - UserHandle.getUserGid(UserHandle.USER_SYSTEM))); - } + mInstaller.idmap(targetPath, overlayPackage.baseCodePath, + UserHandle.getSharedAppGid( + UserHandle.getUserGid(UserHandle.USER_SYSTEM))); if (overlayPathList == null) { overlayPathList = new ArrayList<String>(); } @@ -856,13 +845,15 @@ public class PackageManagerService extends IPackageManager.Stub String[] getStaticOverlayPaths(String targetPackageName, String targetPath) { List<PackageParser.Package> overlayPackages; - synchronized (mPackages) { - overlayPackages = getStaticOverlayPackages( - mPackages.values(), targetPackageName); + synchronized (mInstallLock) { + synchronized (mPackages) { + overlayPackages = getStaticOverlayPackages( + mPackages.values(), targetPackageName); + } + // It is safe to keep overlayPackages without holding mPackages because static overlay + // packages can't be uninstalled or disabled. + return getStaticOverlayPaths(overlayPackages, targetPath); } - // It is safe to keep overlayPackages without holding mPackages because static overlay - // packages can't be uninstalled or disabled. - return getStaticOverlayPaths(overlayPackages, targetPath, mInstallLock); } @Override public final String[] getOverlayApks(String targetPackageName) { @@ -895,11 +886,13 @@ public class PackageManagerService extends IPackageManager.Stub synchronized String[] getStaticOverlayPaths(String targetPackageName, String targetPath) { // We can trust mOverlayPackages without holding mPackages because package uninstall // can't happen while running parallel parsing. - // Moreover holding mPackages on each parsing thread causes dead-lock. + // And we can call mInstaller inside getStaticOverlayPaths without holding mInstallLock + // because mInstallLock is held before running parallel parsing. + // Moreover holding mPackages or mInstallLock on each parsing thread causes dead-lock. return mOverlayPackages == null ? null : getStaticOverlayPaths( getStaticOverlayPackages(mOverlayPackages, targetPackageName), - targetPath, null); + targetPath); } } diff --git a/tools/stats_log_api_gen/main.cpp b/tools/stats_log_api_gen/main.cpp index 300c701bfc80..499f2549b474 100644 --- a/tools/stats_log_api_gen/main.cpp +++ b/tools/stats_log_api_gen/main.cpp @@ -211,7 +211,7 @@ static int write_stats_log_cpp(FILE *out, const Atoms &atoms, signature != atoms.signatures.end(); signature++) { int argIndex; - fprintf(out, "void\n"); + fprintf(out, "int\n"); fprintf(out, "stats_write(int32_t code"); argIndex = 1; for (vector<java_type_t>::const_iterator arg = signature->begin(); @@ -251,7 +251,7 @@ static int write_stats_log_cpp(FILE *out, const Atoms &atoms, " diff length: %s vs %s\");\n", attributionDecl.fields.front().name.c_str(), chainField.name.c_str()); - fprintf(out, " return;\n"); + fprintf(out, " return -EINVAL;\n"); fprintf(out, " }\n"); } } @@ -284,7 +284,7 @@ static int write_stats_log_cpp(FILE *out, const Atoms &atoms, argIndex++; } - fprintf(out, " event.write(LOG_ID_STATS);\n"); + fprintf(out, " return event.write(LOG_ID_STATS);\n"); fprintf(out, "}\n"); fprintf(out, "\n"); } @@ -293,7 +293,7 @@ static int write_stats_log_cpp(FILE *out, const Atoms &atoms, signature != atoms.non_chained_signatures.end(); signature++) { int argIndex; - fprintf(out, "void\n"); + fprintf(out, "int\n"); fprintf(out, "stats_write_non_chained(int32_t code"); argIndex = 1; for (vector<java_type_t>::const_iterator arg = signature->begin(); @@ -327,7 +327,7 @@ static int write_stats_log_cpp(FILE *out, const Atoms &atoms, argIndex++; } - fprintf(out, " event.write(LOG_ID_STATS);\n"); + fprintf(out, " return event.write(LOG_ID_STATS);\n"); fprintf(out, "}\n"); fprintf(out, "\n"); } @@ -377,7 +377,7 @@ static void write_cpp_method_header( const AtomDecl &attributionDecl) { for (set<vector<java_type_t>>::const_iterator signature = signatures.begin(); signature != signatures.end(); signature++) { - fprintf(out, "void %s(int32_t code ", method_name.c_str()); + fprintf(out, "int %s(int32_t code ", method_name.c_str()); int argIndex = 1; for (vector<java_type_t>::const_iterator arg = signature->begin(); arg != signature->end(); arg++) { @@ -522,7 +522,7 @@ static void write_java_method( const AtomDecl &attributionDecl) { for (set<vector<java_type_t>>::const_iterator signature = signatures.begin(); signature != signatures.end(); signature++) { - fprintf(out, " public static native void %s(int code", method_name.c_str()); + fprintf(out, " public static native int %s(int code", method_name.c_str()); int argIndex = 1; for (vector<java_type_t>::const_iterator arg = signature->begin(); arg != signature->end(); arg++) { @@ -719,7 +719,7 @@ jni_function_signature(const vector<java_type_t>& signature, const AtomDecl &att result += java_type_signature(*arg); } } - result += ")V"; + result += ")I"; return result; } @@ -732,7 +732,7 @@ write_stats_log_jni(FILE* out, const string& java_method_name, const string& cpp signature != signatures.end(); signature++) { int argIndex; - fprintf(out, "static void\n"); + fprintf(out, "static int\n"); fprintf(out, "%s(JNIEnv* env, jobject clazz UNUSED, jint code", jni_function_name(java_method_name, *signature).c_str()); argIndex = 1; @@ -779,7 +779,7 @@ write_stats_log_jni(FILE* out, const string& java_method_name, const string& cpp "\"java/lang/IllegalArgumentException\", " "\"invalid attribution field(%s) length.\");\n", chainField.name.c_str()); - fprintf(out, " return;\n"); + fprintf(out, " return -EINVAL;\n"); fprintf(out, " }\n"); } if (chainField.javaType == JAVA_TYPE_INT) { @@ -822,7 +822,7 @@ write_stats_log_jni(FILE* out, const string& java_method_name, const string& cpp // stats_write call argIndex = 1; - fprintf(out, " android::util::%s(code", cpp_method_name.c_str()); + fprintf(out, " int ret = android::util::%s(code", cpp_method_name.c_str()); for (vector<java_type_t>::const_iterator arg = signature->begin(); arg != signature->end(); arg++) { if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) { @@ -868,6 +868,7 @@ write_stats_log_jni(FILE* out, const string& java_method_name, const string& cpp } argIndex++; } + fprintf(out, " return ret;\n"); fprintf(out, "}\n"); fprintf(out, "\n"); |