diff options
33 files changed, 222 insertions, 157 deletions
diff --git a/api/current.txt b/api/current.txt index f21d18faf9b2..227601205369 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5415,6 +5415,7 @@ package android.app { ctor public Notification.MessagingStyle.Message(java.lang.CharSequence, long, java.lang.CharSequence); method public java.lang.String getDataMimeType(); method public android.net.Uri getDataUri(); + method public android.os.Bundle getExtras(); method public java.lang.CharSequence getSender(); method public java.lang.CharSequence getText(); method public long getTimestamp(); @@ -5717,6 +5718,8 @@ package android.app { method public java.lang.CharSequence getContentDescription(); method public android.graphics.drawable.Icon getIcon(); method public java.lang.CharSequence getTitle(); + method public boolean isEnabled(); + method public void setEnabled(boolean); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR; } @@ -45089,7 +45092,7 @@ package android.view { method public android.view.ViewPropertyAnimator animate(); method public void announceForAccessibility(java.lang.CharSequence); method public boolean autofill(android.view.autofill.AutofillValue); - method public boolean autofillVirtual(int, android.view.autofill.AutofillValue); + method public boolean autofill(int, android.view.autofill.AutofillValue); method protected boolean awakenScrollBars(); method protected boolean awakenScrollBars(int); method protected boolean awakenScrollBars(int, boolean); @@ -46304,7 +46307,7 @@ package android.view { method public abstract int addChildCount(int); method public abstract void asyncCommit(); method public abstract android.view.ViewStructure asyncNewChild(int); - method public abstract android.view.ViewStructure asyncNewChildForAutofill(int, int, int); + method public abstract android.view.ViewStructure asyncNewChild(int, int, int); method public abstract int getChildCount(); method public abstract android.os.Bundle getExtras(); method public abstract java.lang.CharSequence getHint(); @@ -46313,7 +46316,7 @@ package android.view { method public abstract int getTextSelectionStart(); method public abstract boolean hasExtras(); method public abstract android.view.ViewStructure newChild(int); - method public abstract android.view.ViewStructure newChildForAutofill(int, int, int); + method public abstract android.view.ViewStructure newChild(int, int, int); method public abstract void setAccessibilityFocused(boolean); method public abstract void setActivated(boolean); method public abstract void setAlpha(float); @@ -47585,11 +47588,11 @@ package android.view.autofill { method public void commit(); method public boolean isEnabled(); method public void notifyValueChanged(android.view.View); + method public void notifyValueChanged(android.view.View, int, android.view.autofill.AutofillValue); method public void notifyViewEntered(android.view.View); + method public void notifyViewEntered(android.view.View, int, android.graphics.Rect); method public void notifyViewExited(android.view.View); - method public void notifyVirtualValueChanged(android.view.View, int, android.view.autofill.AutofillValue); - method public void notifyVirtualViewEntered(android.view.View, int, android.graphics.Rect); - method public void notifyVirtualViewExited(android.view.View, int); + method public void notifyViewExited(android.view.View, int); method public void registerCallback(android.view.autofill.AutofillManager.AutofillCallback); method public void requestAutofill(android.view.View); method public void requestAutofill(android.view.View, int, android.graphics.Rect); @@ -47602,7 +47605,7 @@ package android.view.autofill { public static abstract class AutofillManager.AutofillCallback { ctor public AutofillManager.AutofillCallback(); method public void onAutofillEvent(android.view.View, int); - method public void onAutofillEventVirtual(android.view.View, int, int); + method public void onAutofillEvent(android.view.View, int, int); field public static final int EVENT_INPUT_HIDDEN = 2; // 0x2 field public static final int EVENT_INPUT_SHOWN = 1; // 0x1 field public static final int EVENT_INPUT_UNAVAILABLE = 3; // 0x3 diff --git a/api/system-current.txt b/api/system-current.txt index 26d43e389128..00fe0b66e742 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5589,6 +5589,7 @@ package android.app { ctor public Notification.MessagingStyle.Message(java.lang.CharSequence, long, java.lang.CharSequence); method public java.lang.String getDataMimeType(); method public android.net.Uri getDataUri(); + method public android.os.Bundle getExtras(); method public java.lang.CharSequence getSender(); method public java.lang.CharSequence getText(); method public long getTimestamp(); @@ -5920,6 +5921,8 @@ package android.app { method public java.lang.CharSequence getContentDescription(); method public android.graphics.drawable.Icon getIcon(); method public java.lang.CharSequence getTitle(); + method public boolean isEnabled(); + method public void setEnabled(boolean); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR; } @@ -48552,7 +48555,7 @@ package android.view { method public android.view.ViewPropertyAnimator animate(); method public void announceForAccessibility(java.lang.CharSequence); method public boolean autofill(android.view.autofill.AutofillValue); - method public boolean autofillVirtual(int, android.view.autofill.AutofillValue); + method public boolean autofill(int, android.view.autofill.AutofillValue); method protected boolean awakenScrollBars(); method protected boolean awakenScrollBars(int); method protected boolean awakenScrollBars(int, boolean); @@ -49767,7 +49770,7 @@ package android.view { method public abstract int addChildCount(int); method public abstract void asyncCommit(); method public abstract android.view.ViewStructure asyncNewChild(int); - method public abstract android.view.ViewStructure asyncNewChildForAutofill(int, int, int); + method public abstract android.view.ViewStructure asyncNewChild(int, int, int); method public abstract int getChildCount(); method public abstract android.os.Bundle getExtras(); method public abstract java.lang.CharSequence getHint(); @@ -49776,7 +49779,7 @@ package android.view { method public abstract int getTextSelectionStart(); method public abstract boolean hasExtras(); method public abstract android.view.ViewStructure newChild(int); - method public abstract android.view.ViewStructure newChildForAutofill(int, int, int); + method public abstract android.view.ViewStructure newChild(int, int, int); method public abstract void setAccessibilityFocused(boolean); method public abstract void setActivated(boolean); method public abstract void setAlpha(float); @@ -51051,11 +51054,11 @@ package android.view.autofill { method public void commit(); method public boolean isEnabled(); method public void notifyValueChanged(android.view.View); + method public void notifyValueChanged(android.view.View, int, android.view.autofill.AutofillValue); method public void notifyViewEntered(android.view.View); + method public void notifyViewEntered(android.view.View, int, android.graphics.Rect); method public void notifyViewExited(android.view.View); - method public void notifyVirtualValueChanged(android.view.View, int, android.view.autofill.AutofillValue); - method public void notifyVirtualViewEntered(android.view.View, int, android.graphics.Rect); - method public void notifyVirtualViewExited(android.view.View, int); + method public void notifyViewExited(android.view.View, int); method public void registerCallback(android.view.autofill.AutofillManager.AutofillCallback); method public void requestAutofill(android.view.View); method public void requestAutofill(android.view.View, int, android.graphics.Rect); @@ -51068,7 +51071,7 @@ package android.view.autofill { public static abstract class AutofillManager.AutofillCallback { ctor public AutofillManager.AutofillCallback(); method public void onAutofillEvent(android.view.View, int); - method public void onAutofillEventVirtual(android.view.View, int, int); + method public void onAutofillEvent(android.view.View, int, int); field public static final int EVENT_INPUT_HIDDEN = 2; // 0x2 field public static final int EVENT_INPUT_SHOWN = 1; // 0x1 field public static final int EVENT_INPUT_UNAVAILABLE = 3; // 0x3 diff --git a/api/test-current.txt b/api/test-current.txt index 49bab6f67f81..dd25eb72c8b9 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -5425,6 +5425,7 @@ package android.app { ctor public Notification.MessagingStyle.Message(java.lang.CharSequence, long, java.lang.CharSequence); method public java.lang.String getDataMimeType(); method public android.net.Uri getDataUri(); + method public android.os.Bundle getExtras(); method public java.lang.CharSequence getSender(); method public java.lang.CharSequence getText(); method public long getTimestamp(); @@ -5728,6 +5729,8 @@ package android.app { method public java.lang.CharSequence getContentDescription(); method public android.graphics.drawable.Icon getIcon(); method public java.lang.CharSequence getTitle(); + method public boolean isEnabled(); + method public void setEnabled(boolean); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR; } @@ -45449,7 +45452,7 @@ package android.view { method public android.view.ViewPropertyAnimator animate(); method public void announceForAccessibility(java.lang.CharSequence); method public boolean autofill(android.view.autofill.AutofillValue); - method public boolean autofillVirtual(int, android.view.autofill.AutofillValue); + method public boolean autofill(int, android.view.autofill.AutofillValue); method protected boolean awakenScrollBars(); method protected boolean awakenScrollBars(int); method protected boolean awakenScrollBars(int, boolean); @@ -46671,7 +46674,7 @@ package android.view { method public abstract int addChildCount(int); method public abstract void asyncCommit(); method public abstract android.view.ViewStructure asyncNewChild(int); - method public abstract android.view.ViewStructure asyncNewChildForAutofill(int, int, int); + method public abstract android.view.ViewStructure asyncNewChild(int, int, int); method public abstract int getChildCount(); method public abstract android.os.Bundle getExtras(); method public abstract java.lang.CharSequence getHint(); @@ -46680,7 +46683,7 @@ package android.view { method public abstract int getTextSelectionStart(); method public abstract boolean hasExtras(); method public abstract android.view.ViewStructure newChild(int); - method public abstract android.view.ViewStructure newChildForAutofill(int, int, int); + method public abstract android.view.ViewStructure newChild(int, int, int); method public abstract void setAccessibilityFocused(boolean); method public abstract void setActivated(boolean); method public abstract void setAlpha(float); @@ -47954,11 +47957,11 @@ package android.view.autofill { method public void commit(); method public boolean isEnabled(); method public void notifyValueChanged(android.view.View); + method public void notifyValueChanged(android.view.View, int, android.view.autofill.AutofillValue); method public void notifyViewEntered(android.view.View); + method public void notifyViewEntered(android.view.View, int, android.graphics.Rect); method public void notifyViewExited(android.view.View); - method public void notifyVirtualValueChanged(android.view.View, int, android.view.autofill.AutofillValue); - method public void notifyVirtualViewEntered(android.view.View, int, android.graphics.Rect); - method public void notifyVirtualViewExited(android.view.View, int); + method public void notifyViewExited(android.view.View, int); method public void registerCallback(android.view.autofill.AutofillManager.AutofillCallback); method public void requestAutofill(android.view.View); method public void requestAutofill(android.view.View, int, android.graphics.Rect); @@ -47971,7 +47974,7 @@ package android.view.autofill { public static abstract class AutofillManager.AutofillCallback { ctor public AutofillManager.AutofillCallback(); method public void onAutofillEvent(android.view.View, int); - method public void onAutofillEventVirtual(android.view.View, int, int); + method public void onAutofillEvent(android.view.View, int, int); field public static final int EVENT_INPUT_HIDDEN = 2; // 0x2 field public static final int EVENT_INPUT_SHOWN = 1; // 0x1 field public static final int EVENT_INPUT_UNAVAILABLE = 3; // 0x3 diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index e65c7c815960..37a11ec6416b 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -7205,7 +7205,7 @@ public class Activity extends ContextThemeWrapper } final boolean wasApplied; if (id.isVirtual()) { - wasApplied = view.autofillVirtual(id.getVirtualChildId(), value); + wasApplied = view.autofill(id.getVirtualChildId(), value); } else { wasApplied = view.autofill(value); } diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java index 9f1a539ab240..e6452619b508 100644 --- a/core/java/android/app/ApplicationErrorReport.java +++ b/core/java/android/app/ApplicationErrorReport.java @@ -22,6 +22,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.os.Binder; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemProperties; @@ -430,7 +431,7 @@ public class ApplicationErrorReport implements Parcelable { dest.writeInt(throwLineNumber); dest.writeString(stackTrace); int total = dest.dataPosition()-start; - if (total > 20*1024) { + if (Binder.CHECK_PARCEL_SIZE && total > 20*1024) { Slog.d("Error", "ERR: exClass=" + exceptionClassName); Slog.d("Error", "ERR: exMsg=" + exceptionMessage); Slog.d("Error", "ERR: file=" + throwFileName); diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 870c41238710..aee9d38600fb 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -5657,11 +5657,13 @@ public class Notification implements Parcelable static final String KEY_SENDER = "sender"; static final String KEY_DATA_MIME_TYPE = "type"; static final String KEY_DATA_URI= "uri"; + static final String KEY_EXTRAS_BUNDLE = "extras"; private final CharSequence mText; private final long mTimestamp; private final CharSequence mSender; + private Bundle mExtras = new Bundle(); private String mDataMimeType; private Uri mDataUri; @@ -5730,6 +5732,13 @@ public class Notification implements Parcelable } /** + * Get the extras Bundle for this message. + */ + public Bundle getExtras() { + return mExtras; + } + + /** * Get the text used to display the contact's name in the messaging experience */ public CharSequence getSender() { @@ -5766,6 +5775,9 @@ public class Notification implements Parcelable if (mDataUri != null) { bundle.putParcelable(KEY_DATA_URI, mDataUri); } + if (mExtras != null) { + bundle.putBundle(KEY_EXTRAS_BUNDLE, mExtras); + } return bundle; } @@ -5800,10 +5812,12 @@ public class Notification implements Parcelable bundle.getLong(KEY_TIMESTAMP), bundle.getCharSequence(KEY_SENDER)); if (bundle.containsKey(KEY_DATA_MIME_TYPE) && bundle.containsKey(KEY_DATA_URI)) { - message.setData(bundle.getString(KEY_DATA_MIME_TYPE), (Uri) bundle.getParcelable(KEY_DATA_URI)); } + if (bundle.containsKey(KEY_EXTRAS_BUNDLE)) { + message.getExtras().putAll(bundle.getBundle(KEY_EXTRAS_BUNDLE)); + } return message; } } catch (ClassCastException e) { diff --git a/core/java/android/app/RemoteAction.java b/core/java/android/app/RemoteAction.java index 5958bc14d474..e7fe407b29b3 100644 --- a/core/java/android/app/RemoteAction.java +++ b/core/java/android/app/RemoteAction.java @@ -41,12 +41,14 @@ public final class RemoteAction implements Parcelable { private final CharSequence mTitle; private final CharSequence mContentDescription; private final PendingIntent mActionIntent; + private boolean mEnabled; RemoteAction(Parcel in) { mIcon = Icon.CREATOR.createFromParcel(in); mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); mContentDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); mActionIntent = PendingIntent.CREATOR.createFromParcel(in); + mEnabled = in.readBoolean(); } public RemoteAction(@NonNull Icon icon, @NonNull CharSequence title, @@ -59,6 +61,21 @@ public final class RemoteAction implements Parcelable { mTitle = title; mContentDescription = contentDescription; mActionIntent = intent; + mEnabled = true; + } + + /** + * Sets whether this action is enabled. + */ + public void setEnabled(boolean enabled) { + mEnabled = enabled; + } + + /** + * Return whether this action is enabled. + */ + public boolean isEnabled() { + return mEnabled; } /** @@ -91,7 +108,9 @@ public final class RemoteAction implements Parcelable { @Override public RemoteAction clone() { - return new RemoteAction(mIcon, mTitle, mContentDescription, mActionIntent); + RemoteAction action = new RemoteAction(mIcon, mTitle, mContentDescription, mActionIntent); + action.setEnabled(mEnabled); + return action; } @Override @@ -105,11 +124,13 @@ public final class RemoteAction implements Parcelable { TextUtils.writeToParcel(mTitle, out, flags); TextUtils.writeToParcel(mContentDescription, out, flags); mActionIntent.writeToParcel(out, flags); + out.writeBoolean(mEnabled); } public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("title=" + mTitle); + pw.print(" enabled=" + mEnabled); pw.print(" contentDescription=" + mContentDescription); pw.print(" icon=" + mIcon); pw.print(" action=" + mActionIntent.getIntent()); diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java index b1fbc8f18818..27bfb512f9dc 100644 --- a/core/java/android/app/assist/AssistStructure.java +++ b/core/java/android/app/assist/AssistStructure.java @@ -1612,9 +1612,8 @@ public class AssistStructure implements Parcelable { return newChild(index, false, 0, 0); } - // TODO(b/33197203, b/33802548): add CTS/unit test @Override - public ViewStructure newChildForAutofill(int index, int virtualId, int flags) { + public ViewStructure newChild(int index, int virtualId, int flags) { return newChild(index, true, virtualId, flags); } @@ -1624,7 +1623,7 @@ public class AssistStructure implements Parcelable { } @Override - public ViewStructure asyncNewChildForAutofill(int index, int virtualId, int flags) { + public ViewStructure asyncNewChild(int index, int virtualId, int flags) { return asyncNewChild(index, true, virtualId); } diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 5a28e87ac65f..be6dc05ace5f 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -4211,6 +4211,7 @@ public class PackageParser { sa.getBoolean(R.styleable.AndroidManifestActivity_visibleToInstantApps, false); if (visibleToEphemeral) { a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL; + owner.visibleToInstantApps = true; } sa.recycle(); @@ -4716,6 +4717,7 @@ public class PackageParser { sa.getBoolean(R.styleable.AndroidManifestProvider_visibleToInstantApps, false); if (visibleToEphemeral) { p.info.flags |= ProviderInfo.FLAG_VISIBLE_TO_EPHEMERAL; + owner.visibleToInstantApps = true; } sa.recycle(); @@ -5032,6 +5034,7 @@ public class PackageParser { sa.getBoolean(R.styleable.AndroidManifestService_visibleToInstantApps, false); if (visibleToEphemeral) { s.info.flags |= ServiceInfo.FLAG_VISIBLE_TO_EPHEMERAL; + owner.visibleToInstantApps = true; } sa.recycle(); @@ -5635,6 +5638,11 @@ public class PackageParser { public byte[] restrictUpdateHash; + /** + * Set if the app or any of its components are visible to Instant Apps. + */ + public boolean visibleToInstantApps; + public Package(String packageName) { this.packageName = packageName; this.manifestPackageName = packageName; diff --git a/core/java/android/hardware/radio/RadioModule.java b/core/java/android/hardware/radio/RadioModule.java index fc7d0d2afbd4..89648931fd53 100644 --- a/core/java/android/hardware/radio/RadioModule.java +++ b/core/java/android/hardware/radio/RadioModule.java @@ -16,6 +16,8 @@ package android.hardware.radio; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.SystemApi; import android.content.Context; import android.content.Intent; @@ -23,6 +25,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import java.lang.ref.WeakReference; +import java.util.List; import java.util.UUID; /** @@ -76,6 +79,8 @@ public class RadioModule extends RadioTuner { public native int getProgramInformation(RadioManager.ProgramInfo[] info); + public native @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable String filter); + public native boolean isAntennaConnected(); public native boolean hasControl(); diff --git a/core/java/android/hardware/radio/RadioTuner.java b/core/java/android/hardware/radio/RadioTuner.java index 5c82555663de..c8034eb94992 100644 --- a/core/java/android/hardware/radio/RadioTuner.java +++ b/core/java/android/hardware/radio/RadioTuner.java @@ -16,6 +16,8 @@ package android.hardware.radio; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.SystemApi; import android.content.Context; import android.content.Intent; @@ -23,6 +25,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import java.lang.ref.WeakReference; +import java.util.List; import java.util.UUID; /** @@ -209,6 +212,20 @@ public abstract class RadioTuner { public abstract int getProgramInformation(RadioManager.ProgramInfo[] info); /** + * Get the list of discovered radio stations. + * + * To get the full list, set filter to null or empty string. Otherwise, client application + * must verify vendor product/name before setting this parameter to anything else. + * + * @param filter vendor-specific selector for radio stations. + * @return a list of radio stations. + * @throws IllegalStateException if the scan is in progress or has not been started. + * @throws IllegalArgumentException if the filter argument is not valid. + * @hide FutureFeature + */ + public abstract @NonNull List<RadioManager.ProgramInfo> getProgramList(@Nullable String filter); + + /** * Get current antenna connection state for current configuration. * Only valid if a configuration has been applied. * @return {@code true} if the antenna is connected, {@code false} otherwise. diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java index 01369791fd38..7906707c0133 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -66,7 +66,8 @@ public class Binder implements IBinder { * of classes can potentially create leaks. */ private static final boolean FIND_POTENTIAL_LEAKS = false; - private static final boolean CHECK_PARCEL_SIZE = false; + /** @hide */ + public static final boolean CHECK_PARCEL_SIZE = false; static final String TAG = "Binder"; /** @hide */ diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java index caea2020244c..f503b3a2d33f 100644 --- a/core/java/android/os/StrictMode.java +++ b/core/java/android/os/StrictMode.java @@ -2638,7 +2638,7 @@ public final class StrictMode { dest.writeString(broadcastIntentAction); dest.writeStringArray(tags); int total = dest.dataPosition()-start; - if (total > 10*1024) { + if (Binder.CHECK_PARCEL_SIZE && total > 10*1024) { Slog.d(TAG, "VIO: policy=" + policy + " dur=" + durationMillis + " numLoop=" + violationNumThisLoop + " anim=" + numAnimationsRunning diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 6cddbac736af..583dad48295c 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2749,13 +2749,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * x * NO LONGER NEEDED, SHOULD BE REUSED * * 1 PFLAG3_FINGER_DOWN * 1 PFLAG3_FOCUSED_BY_DEFAULT -<<<<<<< HEAD * 11 PFLAG3_AUTO_FILL_MODE_MASK * 11 PFLAG3_IMPORTANT_FOR_AUTOFILL -======= - * 11 PFLAG3_AUTOFILL_MODE_MASK - * xx * NO LONGER NEEDED, SHOULD BE REUSED * ->>>>>>> Replaced auto-fill by autofill to keep it consistent with API style. * 1 PFLAG3_OVERLAPPING_RENDERING_FORCED_VALUE * 1 PFLAG3_HAS_OVERLAPPING_RENDERING_FORCED * 1 PFLAG3_TEMPORARY_DETACH @@ -7384,13 +7379,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * <p>When implementing this method, subclasses must follow the rules below: * * <ol> - * <li>Also implement {@link #autofillVirtual(int, AutofillValue)} to autofill the virtual + * <li>Also implement {@link #autofill(int, AutofillValue)} to autofill the virtual * children. * <li>Call - * {@link android.view.autofill.AutofillManager#notifyVirtualViewEntered} and - * {@link android.view.autofill.AutofillManager#notifyVirtualViewExited(View, int)} + * {@link android.view.autofill.AutofillManager#notifyViewEntered} and + * {@link android.view.autofill.AutofillManager#notifyViewExited(View, int)} * when the focus inside the view changed. - * <li>Call {@link android.view.autofill.AutofillManager#notifyVirtualValueChanged(View, int, + * <li>Call {@link android.view.autofill.AutofillManager#notifyValueChanged(View, int, * AutofillValue)} when the value of a child changed. * <li>Call {@link AutofillManager#commit()} when the autofill context * of the view structure changed and you want the current autofill interaction if such @@ -7463,14 +7458,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @return {@code true} if the view was successfully autofilled, {@code false} otherwise */ - public boolean autofillVirtual(@SuppressWarnings("unused") int virtualId, + public boolean autofill(@SuppressWarnings("unused") int virtualId, @SuppressWarnings("unused") AutofillValue value) { return false; } /** * Describes the autofill type that should be used on calls to - * {@link #autofill(AutofillValue)} and {@link #autofillVirtual(int, AutofillValue)}. + * {@link #autofill(AutofillValue)} and {@link #autofill(int, AutofillValue)}. * * <p>By default returns {@link #AUTOFILL_TYPE_NONE}, but views should override it (and * {@link #autofill(AutofillValue)} to support the Autofill Framework. diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 048b7c22237c..168178702ebf 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -507,7 +507,7 @@ public final class ViewRootImpl implements ViewParent, mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); if (!sCompatibilityDone) { - sAlwaysAssignFocus = mTargetSdkVersion < Build.VERSION_CODES.O; + sAlwaysAssignFocus = true; sCompatibilityDone = true; } diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java index 38c7738b4bac..4168756e04f3 100644 --- a/core/java/android/view/ViewStructure.java +++ b/core/java/android/view/ViewStructure.java @@ -275,13 +275,12 @@ public abstract class ViewStructure { * {@link #addChildCount(int)} and {@link #setChildCount(int)}. * @param virtualId an opaque ID to the Android System (although it could be meaningful to the * {@link View} creating the {@link ViewStructure}), but it's the same id used on - * {@link View#autofillVirtual(int, AutofillValue)}. + * {@link View#autofill(int, AutofillValue)}. * @param flags currently {@code 0}. * * @return Returns an fresh {@link ViewStructure} ready to be filled in. */ - // TODO(b/33197203, b/33802548): add CTS/unit test - public abstract ViewStructure newChildForAutofill(int index, int virtualId, int flags); + public abstract ViewStructure newChild(int index, int virtualId, int flags); /** * Like {@link #newChild}, but allows the caller to asynchronously populate the returned @@ -294,7 +293,7 @@ public abstract class ViewStructure { public abstract ViewStructure asyncNewChild(int index); /** - * Like {@link #newChildForAutofill(int, int, int)}, but allows the caller to asynchronously + * Like {@link #newChild(int, int, int)}, but allows the caller to asynchronously * populate the returned child. * * <p>It can transfer the returned {@link ViewStructure} to another thread for it to build its @@ -307,13 +306,12 @@ public abstract class ViewStructure { * {@link #addChildCount(int)} and {@link #setChildCount(int)}. * @param virtualId an opaque ID to the Android System (although it could be meaningful to the * {@link View} creating the {@link ViewStructure}), but it's the same id used on - * {@link View#autofillVirtual(int, AutofillValue)}. + * {@link View#autofill(int, AutofillValue)}. * @param flags currently {@code 0}. * * @return Returns an fresh {@link ViewStructure} ready to be filled in. */ - // TODO(b/33197203, b/33802548): add CTS/unit test - public abstract ViewStructure asyncNewChildForAutofill(int index, int virtualId, int flags); + public abstract ViewStructure asyncNewChild(int index, int virtualId, int flags); /** * Sets the {@link View#getAutofillType()} that can be used to autofill this node. diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index b852aabe3b3d..9ed6371404c4 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -239,14 +239,12 @@ public final class AutofillManager { * @param childId id identifying the virtual child inside the view. * @param bounds child boundaries, relative to the top window. */ - public void notifyVirtualViewEntered(@NonNull View view, int childId, - @NonNull Rect bounds) { + public void notifyViewEntered(@NonNull View view, int childId, @NonNull Rect bounds) { ensureServiceClientAddedIfNeeded(); if (!mEnabled) { if (mCallback != null) { - mCallback.onAutofillEventVirtual(view, childId, - AutofillCallback.EVENT_INPUT_UNAVAILABLE); + mCallback.onAutofillEvent(view, childId, AutofillCallback.EVENT_INPUT_UNAVAILABLE); } return; } @@ -268,7 +266,7 @@ public final class AutofillManager { * @param view the {@link View} whose descendant is the virtual view. * @param childId id identifying the virtual child inside the view. */ - public void notifyVirtualViewExited(@NonNull View view, int childId) { + public void notifyViewExited(@NonNull View view, int childId) { ensureServiceClientAddedIfNeeded(); if (mEnabled && mHasSession) { @@ -302,7 +300,7 @@ public final class AutofillManager { * @param childId id identifying the virtual child inside the parent view. * @param value new value of the child. */ - public void notifyVirtualValueChanged(View view, int childId, AutofillValue value) { + public void notifyValueChanged(View view, int childId, AutofillValue value) { if (!mEnabled || !mHasSession) { return; } @@ -510,7 +508,7 @@ public final class AutofillManager { return; } if (id.isVirtual()) { - mCallback.onAutofillEventVirtual(view, id.getVirtualChildId(), event); + mCallback.onAutofillEvent(view, id.getVirtualChildId(), event); } else { mCallback.onAutofillEvent(view, event); } @@ -561,7 +559,8 @@ public final class AutofillManager { * * @param event currently either {@link #EVENT_INPUT_SHOWN} or {@link #EVENT_INPUT_HIDDEN}. */ - public void onAutofillEvent(@NonNull View view, @AutofillEventType int event) {} + public void onAutofillEvent(@NonNull View view, @AutofillEventType int event) { + } /** * Called after a change in the autofill state associated with a virtual view. @@ -571,8 +570,8 @@ public final class AutofillManager { * * @param event currently either {@link #EVENT_INPUT_SHOWN} or {@link #EVENT_INPUT_HIDDEN}. */ - public void onAutofillEventVirtual(@NonNull View view, int childId, - @AutofillEventType int event) {} + public void onAutofillEvent(@NonNull View view, int childId, @AutofillEventType int event) { + } } private static final class AutofillManagerClient extends IAutoFillManagerClient.Stub { diff --git a/media/java/android/media/tv/TvContract.java b/media/java/android/media/tv/TvContract.java index 62fd39516b85..c28aa5ec8711 100644 --- a/media/java/android/media/tv/TvContract.java +++ b/media/java/android/media/tv/TvContract.java @@ -1807,6 +1807,9 @@ public final class TvContract { * {@link #TYPE_S_DMB}, and * {@link #TYPE_T_DMB}. * + * <p>This value cannot be changed once it's set. Trying to modify it will make the update + * fail. + * * <p>This is a required field. * * <p>Type: TEXT diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 91a4e792bbb8..1f1c18976edf 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -248,6 +248,9 @@ public class SettingsProvider extends ContentProvider { @GuardedBy("mLock") private HandlerThread mHandlerThread; + @GuardedBy("mLock") + private Handler mHandler; + // We have to call in the user manager with no lock held, private volatile UserManager mUserManager; @@ -300,10 +303,13 @@ public class SettingsProvider extends ContentProvider { mHandlerThread = new HandlerThread(LOG_TAG, Process.THREAD_PRIORITY_BACKGROUND); mHandlerThread.start(); + mHandler = new Handler(mHandlerThread.getLooper()); mSettingsRegistry = new SettingsRegistry(); } - registerBroadcastReceivers(); - startWatchingUserRestrictionChanges(); + mHandler.post(() -> { + registerBroadcastReceivers(); + startWatchingUserRestrictionChanges(); + }); ServiceManager.addService("settings", new SettingsService(this)); return true; } diff --git a/packages/SystemUI/res/layout/pip_menu_action.xml b/packages/SystemUI/res/layout/pip_menu_action.xml index 77efc9be5bc8..9150a000de00 100644 --- a/packages/SystemUI/res/layout/pip_menu_action.xml +++ b/packages/SystemUI/res/layout/pip_menu_action.xml @@ -18,4 +18,5 @@ android:layout_width="@dimen/pip_action_size" android:layout_height="@dimen/pip_action_size" android:padding="@dimen/pip_action_padding" - android:background="?android:selectableItemBackgroundBorderless" />
\ No newline at end of file + android:background="?android:selectableItemBackgroundBorderless" + android:forceHasOverlappingRendering="false" />
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/pip_menu_activity.xml b/packages/SystemUI/res/layout/pip_menu_activity.xml index c6837fa30925..44ced1736f65 100644 --- a/packages/SystemUI/res/layout/pip_menu_activity.xml +++ b/packages/SystemUI/res/layout/pip_menu_activity.xml @@ -23,7 +23,8 @@ <FrameLayout android:id="@+id/menu_container" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:forceHasOverlappingRendering="false"> <ImageView android:id="@+id/dismiss" diff --git a/packages/SystemUI/res/layout/qs_tile_label.xml b/packages/SystemUI/res/layout/qs_tile_label.xml index e714cd6606f7..9d1fb8fd4c6f 100644 --- a/packages/SystemUI/res/layout/qs_tile_label.xml +++ b/packages/SystemUI/res/layout/qs_tile_label.xml @@ -17,7 +17,8 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="48dp" + android:layout_height="wrap_content" + android:minHeight="48dp" android:paddingTop="8dp"> <LinearLayout android:id="@+id/label_group" @@ -55,6 +56,21 @@ android:visibility="gone" /> </LinearLayout> + <TextView + android:id="@+id/app_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignStart="@id/label_group" + android:layout_alignEnd="@id/label_group" + android:layout_below="@id/label_group" + android:clickable="false" + android:maxLines="1" + android:padding="0dp" + android:visibility="gone" + android:gravity="center" + android:textAppearance="@style/TextAppearance.QS.TileLabel" + android:textColor="?android:attr/textColorPrimary"/> + <View android:id="@+id/underline" android:layout_width="30dp" diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java index 0547cbb4dd92..9cb518cfe2e7 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java @@ -19,8 +19,8 @@ package com.android.systemui.pip.phone; import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_ACTIONS; import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_CONTROLLER_MESSENGER; import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_MOVEMENT_BOUNDS; -import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_STACK_BOUNDS; import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_SHOW_MENU; +import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_STACK_BOUNDS; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -33,13 +33,11 @@ import android.app.PendingIntent.CanceledException; import android.app.RemoteAction; import android.content.Intent; import android.content.pm.ParceledListSlice; -import android.content.res.Resources; import android.graphics.Color; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.graphics.drawable.Icon; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -84,6 +82,8 @@ public class PipMenuActivity extends Activity { private static final float MENU_BACKGROUND_ALPHA = 0.3f; private static final float DISMISS_BACKGROUND_ALPHA = 0.8f; + private static final float DISABLED_ACTION_ALPHA = 0.54f; + private boolean mMenuVisible; private final List<RemoteAction> mActions = new ArrayList<>(); private View mViewRoot; @@ -371,13 +371,18 @@ public class PipMenuActivity extends Activity { actionView.setImageDrawable(d); }, mHandler); actionView.setContentDescription(action.getContentDescription()); - actionView.setOnClickListener(v -> { - try { - action.getActionIntent().send(); - } catch (CanceledException e) { - Log.w(TAG, "Failed to send action", e); - } - }); + if (action.isEnabled()) { + actionView.setOnClickListener(v -> { + try { + action.getActionIntent().send(); + } catch (CanceledException e) { + Log.w(TAG, "Failed to send action", e); + } + }); + } else { + actionView.setAlpha(DISABLED_ACTION_ALPHA); + actionView.setEnabled(false); + } if (isLandscapePip && i > 0) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) actionView.getLayoutParams(); diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.java b/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.java index 0629d66767d0..b0806429df28 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.java @@ -35,19 +35,13 @@ public class CustomizeTileView extends QSTileView { protected void createLabel() { super.createLabel(); mLabelMinLines = mLabel.getMinLines(); - View view = LayoutInflater.from(mContext).inflate(R.layout.qs_tile_label, null); - mAppLabel = (TextView) view.findViewById(R.id.tile_label); + mAppLabel = findViewById(R.id.app_label); mAppLabel.setAlpha(.6f); - mAppLabel.setSingleLine(true); - addView(view); } public void setShowAppLabel(boolean showAppLabel) { mAppLabel.setVisibility(showAppLabel ? View.VISIBLE : View.GONE); mLabel.setSingleLine(showAppLabel); - if (!showAppLabel) { - mLabel.setMinLines(mLabelMinLines); - } } public void setAppLabel(CharSequence label) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java index 547bef72863f..2ac592ffe5bd 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java @@ -165,6 +165,7 @@ public class TileQueryHelper { } TileInfo info = new TileInfo(); info.state = state; + info.state.dualTarget = false; // No dual targets in edit. info.state.expandedAccessibilityClassName = Button.class.getName(); info.spec = spec; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java index 820638cb3c2d..c30bb9a2e6e8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java @@ -74,7 +74,7 @@ public class MultiUserSwitch extends FrameLayout implements View.OnClickListener if (mUserListener == null) { return false; } - return mUserListener.getUserCount() > 1; + return mUserListener.getUserCount() != 0; } public void setUserSwitcherController(UserSwitcherController userSwitcherController) { diff --git a/services/core/java/com/android/server/am/ActivityManagerConstants.java b/services/core/java/com/android/server/am/ActivityManagerConstants.java index 100d8212eacc..df250b19beba 100644 --- a/services/core/java/com/android/server/am/ActivityManagerConstants.java +++ b/services/core/java/com/android/server/am/ActivityManagerConstants.java @@ -105,16 +105,16 @@ final class ActivityManagerConstants extends ContentObserver { } private void updateConstants() { + final String setting = Settings.Global.getString(mResolver, + Settings.Global.ACTIVITY_MANAGER_CONSTANTS); synchronized (mService) { try { - mParser.setString(Settings.Global.getString(mResolver, - Settings.Global.ACTIVITY_MANAGER_CONSTANTS)); + mParser.setString(setting); } catch (IllegalArgumentException e) { // Failed to parse the settings string, log this and move on // with defaults. Slog.e("ActivityManagerConstants", "Bad activity manager config settings", e); } - ENFORCE_BG_CHECK = mParser.getBoolean(KEY_ENFORCE_BG_CHECK, DEFAULT_ENFORCE_BG_CHECK); MAX_CACHED_PROCESSES = mParser.getInt(KEY_MAX_CACHED_PROCESSES, DEFAULT_MAX_CACHED_PROCESSES); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 42efe0b5d8e0..217515b936dd 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -16,6 +16,7 @@ package com.android.server.am; +import static android.Manifest.permission.MANAGE_ACTIVITY_STACKS; import static android.Manifest.permission.START_ANY_ACTIVITY; import static android.Manifest.permission.START_TASKS_FROM_RECENTS; import static android.app.ActivityManager.LOCK_TASK_MODE_LOCKED; @@ -1612,8 +1613,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D return true; } - // Check if the caller can launch anything. - final int startAnyPerm = mService.checkPermission(START_ANY_ACTIVITY, callingPid, + // Check if the caller can manage activity stacks. + final int startAnyPerm = mService.checkPermission(MANAGE_ACTIVITY_STACKS, callingPid, callingUid); if (startAnyPerm == PERMISSION_GRANTED) { if (DEBUG_TASKS) Slog.d(TAG, "Launch on display check:" diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index fb3080b4376f..1d1bf0d195d9 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -3351,7 +3351,7 @@ public class PackageManagerService extends IPackageManager.Stub { // * The system/shell/root can see metadata for any app // * An installed app can see metadata for 1) other installed apps // and 2) ephemeral apps that have explicitly interacted with it - // * Ephemeral apps can only see their own metadata + // * Ephemeral apps can only see their own data and exposed installed apps // * Holding a signature permission allows seeing instant apps final int callingAppId = UserHandle.getAppId(Binder.getCallingUid()); if (callingAppId != Process.SYSTEM_UID @@ -3361,8 +3361,10 @@ public class PackageManagerService extends IPackageManager.Stub { Binder.getCallingUid()) != PackageManager.PERMISSION_GRANTED) { final String instantAppPackageName = getInstantAppPackageName(Binder.getCallingUid()); if (instantAppPackageName != null) { - // ephemeral apps can only get information on themselves - if (!instantAppPackageName.equals(p.packageName)) { + // ephemeral apps can only get information on themselves or + // installed apps that are exposed. + if (!instantAppPackageName.equals(p.packageName) + && (ps.getInstantApp(userId) || !p.visibleToInstantApps)) { return null; } } else { diff --git a/tools/layoutlib/bridge/src/android/graphics/BaseCanvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BaseCanvas_Delegate.java index b1e71b241f14..cc71053fced6 100644 --- a/tools/layoutlib/bridge/src/android/graphics/BaseCanvas_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/BaseCanvas_Delegate.java @@ -24,6 +24,7 @@ import com.android.layoutlib.bridge.impl.PorterDuffUtility; import com.android.ninepatch.NinePatchChunk; import com.android.tools.layoutlib.annotations.LayoutlibDelegate; +import android.annotation.Nullable; import android.text.TextUtils; import java.awt.*; @@ -31,6 +32,8 @@ import java.awt.geom.AffineTransform; import java.awt.geom.Arc2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.DataBuffer; public class BaseCanvas_Delegate { // ---- delegate manager ---- @@ -646,9 +649,15 @@ public class BaseCanvas_Delegate { forceSrcMode[0] = false; // if the bitmap config is alpha_8, then we erase all color value from it - // before drawing it. + // before drawing it or apply the texture from the shader if present. if (bitmap.getConfig() == Bitmap.Config.ALPHA_8) { - fixAlpha8Bitmap(image); + Shader_Delegate shader = paint.getShader(); + java.awt.Paint javaPaint = null; + if (shader instanceof BitmapShader_Delegate) { + javaPaint = shader.getJavaPaint(); + } + + fixAlpha8Bitmap(image, javaPaint); } else if (!bitmap.hasAlpha()) { // hasAlpha is merely a rendering hint. There can in fact be alpha values // in the bitmap but it should be ignored at drawing time. @@ -672,16 +681,37 @@ public class BaseCanvas_Delegate { return image; } - private static void fixAlpha8Bitmap(final BufferedImage image) { + /** + * This method will apply the correct color to the passed "only alpha" image. Colors on the + * passed image will be destroyed. + * If the passed javaPaint is null, the color will be set to 0. If a paint is passed, it will + * be used to obtain the color that will be applied. + * <p/> + * This will destroy the passed image color channel. + */ + private static void fixAlpha8Bitmap(final BufferedImage image, + @Nullable java.awt.Paint javaPaint) { int w = image.getWidth(); int h = image.getHeight(); + + DataBuffer texture = null; + if (javaPaint != null) { + PaintContext context = javaPaint.createContext(ColorModel.getRGBdefault(), null, null, + new AffineTransform(), null); + texture = context.getRaster(0, 0, w, h).getDataBuffer(); + } + int[] argb = new int[w * h]; image.getRGB(0, 0, image.getWidth(), image.getHeight(), argb, 0, image.getWidth()); final int length = argb.length; - for (int i = 0 ; i < length; i++) { + for (int i = 0; i < length; i++) { argb[i] &= 0xFF000000; + if (texture != null) { + argb[i] |= texture.getElem(i) & 0x00FFFFFF; + } } + image.setRGB(0, 0, w, h, argb, 0, w); } diff --git a/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java index bd934d028aff..cb013b60a06c 100644 --- a/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java @@ -66,7 +66,7 @@ public abstract class ColorFilter_Delegate { // ---- native methods ---- @LayoutlibDelegate - /*package*/ static void destroyFilter(long native_instance) { + /*package*/ static void nSafeUnref(long native_instance) { sManager.removeJavaReferenceFor(native_instance); } diff --git a/tools/layoutlib/bridge/src/android/graphics/drawable/AdaptiveIconDrawable_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/drawable/AdaptiveIconDrawable_Delegate.java deleted file mode 100644 index 7e9432dd71ef..000000000000 --- a/tools/layoutlib/bridge/src/android/graphics/drawable/AdaptiveIconDrawable_Delegate.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -package android.graphics.drawable; - -import com.android.tools.layoutlib.annotations.LayoutlibDelegate; - -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.PorterDuff.Mode; -import android.graphics.PorterDuffXfermode; -import android.graphics.Rect; -import android.graphics.drawable.AdaptiveIconDrawable.LayerState; - -/** - * Delegate used to provide new implementation of a select few methods of {@link - * AdaptiveIconDrawable} - * <p> - * Through the layoutlib_create tool, the original methods of AdaptiveIconDrawable have been - * replaced by calls to methods of the same name in this delegate class. - */ -@SuppressWarnings("unused") -public class AdaptiveIconDrawable_Delegate { - @LayoutlibDelegate - /*package*/ static void draw(AdaptiveIconDrawable thisDrawable, Canvas canvas) { - // This is a workaround for the broken BitmapShader in layoutlib. This new draw methods - // avoids the use of the shader. - - for (int i = 0; i < LayerState.N_CHILDREN; i++) { - if (thisDrawable.mLayerState.mChildren[i] == null) { - continue; - } - final Drawable dr = thisDrawable.mLayerState.mChildren[i].mDrawable; - if (dr != null) { - dr.draw(canvas); - } - } - - if (thisDrawable.mMaskBitmap != null) { - Rect bounds = thisDrawable.getBounds(); - Paint paint = new Paint(); - paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN)); - canvas.drawBitmap(thisDrawable.mMaskBitmap, bounds.left, bounds.top, paint); - } - } -} diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java index 4f226cbad01f..b0aa3c2989a5 100644 --- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java @@ -163,7 +163,6 @@ public final class CreateInfo implements ICreateInfo { "android.content.res.TypedArray#obtain", "android.graphics.BitmapFactory#finishDecode", "android.graphics.BitmapFactory#setDensityFromOptions", - "android.graphics.drawable.AdaptiveIconDrawable#draw", "android.graphics.drawable.AnimatedVectorDrawable$VectorDrawableAnimatorRT#useLastSeenTarget", "android.graphics.drawable.AnimatedVectorDrawable$VectorDrawableAnimatorRT#onDraw", "android.graphics.drawable.GradientDrawable#buildRing", @@ -333,8 +332,6 @@ public final class CreateInfo implements ICreateInfo { * needed when access from the delegate classes is needed. */ private final static String[] PROMOTED_FIELDS = new String[] { - "android.graphics.drawable.AdaptiveIconDrawable#mMaskBitmap", - "android.graphics.drawable.AdaptiveIconDrawable#mPaint", "android.graphics.drawable.VectorDrawable#mVectorState", "android.view.Choreographer#mLastFrameTimeNanos", "android.graphics.FontFamily#mBuilderPtr" |