summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt36
-rw-r--r--api/removed.txt5
-rw-r--r--api/system-current.txt22
-rw-r--r--core/java/android/app/Activity.java10
-rw-r--r--core/java/android/hardware/OWNERS2
-rw-r--r--core/java/android/hardware/camera2/CameraCharacteristics.java3
-rw-r--r--core/java/android/hardware/camera2/CaptureResult.java6
-rw-r--r--core/java/android/hardware/camera2/OWNERS7
-rw-r--r--core/java/android/os/ZygoteProcess.java15
-rw-r--r--core/java/android/provider/DeviceConfig.java87
-rw-r--r--core/java/android/provider/Settings.java57
-rw-r--r--core/java/android/view/LayoutInflater.java10
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java6
-rw-r--r--core/java/android/widget/PopupWindow.java52
-rw-r--r--core/java/com/android/internal/app/ChooserActivity.java196
-rw-r--r--core/java/com/android/internal/app/ResolverActivity.java69
-rw-r--r--core/java/com/android/internal/app/SimpleIconFactory.java609
-rw-r--r--core/java/com/android/internal/os/Zygote.java4
-rw-r--r--core/java/com/android/internal/os/ZygoteConfig.java37
-rw-r--r--core/java/com/android/internal/os/ZygoteServer.java40
-rwxr-xr-xcore/jni/android/graphics/Bitmap.cpp5
-rw-r--r--core/res/AndroidManifest.xml7
-rw-r--r--core/res/res/drawable/iconfactory_adaptive_icon_drawable_wrapper.xml (renamed from packages/SystemUI/res/layout/assistant_handle.xml)15
-rw-r--r--core/res/res/layout/chooser_grid.xml203
-rw-r--r--core/res/res/layout/chooser_grid_preview_file.xml78
-rw-r--r--core/res/res/layout/chooser_grid_preview_image.xml83
-rw-r--r--core/res/res/layout/chooser_grid_preview_text.xml91
-rw-r--r--core/res/res/layout/resolve_list_item.xml4
-rw-r--r--core/res/res/values/dimens.xml2
-rw-r--r--core/res/res/values/strings.xml4
-rw-r--r--core/res/res/values/symbols.xml8
-rw-r--r--core/tests/coretests/AndroidManifest.xml1
-rw-r--r--core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java8
-rw-r--r--graphics/java/android/graphics/Bitmap.java33
-rw-r--r--graphics/java/android/graphics/Canvas.java9
-rw-r--r--graphics/java/android/graphics/ColorFilter.java5
-rw-r--r--graphics/java/android/graphics/FontFamily.java10
-rw-r--r--graphics/java/android/graphics/Matrix.java11
-rw-r--r--graphics/java/android/graphics/Paint.java11
-rw-r--r--graphics/java/android/graphics/Path.java5
-rw-r--r--graphics/java/android/graphics/RenderNode.java5
-rw-r--r--graphics/java/android/graphics/Shader.java5
-rw-r--r--graphics/java/android/graphics/Typeface.java5
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedImageDrawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java1
-rw-r--r--graphics/java/android/graphics/fonts/Font.java18
-rw-r--r--graphics/java/android/graphics/fonts/FontFamily.java4
-rw-r--r--graphics/java/android/graphics/text/LineBreaker.java12
-rw-r--r--graphics/java/android/graphics/text/MeasuredText.java5
-rw-r--r--libs/hwui/hwui/Bitmap.cpp2
-rw-r--r--libs/hwui/hwui/Bitmap.h2
-rw-r--r--location/java/android/location/LocationManager.java6
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java28
-rw-r--r--packages/Shell/AndroidManifest.xml3
-rw-r--r--packages/SystemUI/res/layout/notification_info.xml3
-rw-r--r--packages/SystemUI/res/values/config.xml2
-rw-r--r--packages/SystemUI/res/values/dimens.xml7
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java18
-rw-r--r--packages/SystemUI/src/com/android/keyguard/clock/ImageClock.java2
-rw-r--r--packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClock.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistManager.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistSysUiChangeListener.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java143
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java173
-rw-r--r--services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java3
-rw-r--r--services/core/java/com/android/server/am/SettingsToPropertiesMapper.java2
-rw-r--r--services/core/java/com/android/server/attention/AttentionManagerService.java22
-rw-r--r--services/core/java/com/android/server/infra/AbstractMasterSystemService.java3
-rw-r--r--services/core/java/com/android/server/pm/StagingManager.java4
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java23
-rw-r--r--telephony/java/android/telephony/CellIdentityNr.java11
-rw-r--r--telephony/java/android/telephony/CellInfoNr.java3
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java26
-rw-r--r--telephony/java/android/telephony/ims/ImsException.java5
-rw-r--r--telephony/java/android/telephony/ims/ImsMmTelManager.java32
-rw-r--r--telephony/java/android/telephony/ims/ImsReasonInfo.java5
-rw-r--r--telephony/java/android/telephony/ims/ProvisioningManager.java29
-rw-r--r--tests/ActivityManagerPerfTests/test-app/Android.bp21
-rw-r--r--tests/ActivityManagerPerfTests/test-app/Android.mk31
-rw-r--r--tests/ActivityManagerPerfTests/tests/Android.bp27
-rw-r--r--tests/ActivityManagerPerfTests/tests/Android.mk36
-rw-r--r--tests/ActivityManagerPerfTests/utils/Android.bp27
-rw-r--r--tests/ActivityManagerPerfTests/utils/Android.mk32
-rw-r--r--tests/ActivityViewTest/Android.bp6
-rw-r--r--tests/ActivityViewTest/Android.mk12
-rw-r--r--tests/AppLaunch/Android.bp13
-rw-r--r--tests/AppLaunch/Android.mk22
-rw-r--r--tests/AppLaunchWear/Android.bp13
-rw-r--r--tests/AppLaunchWear/Android.mk22
-rw-r--r--tests/BackgroundDexOptServiceIntegrationTests/Android.bp24
-rw-r--r--tests/BackgroundDexOptServiceIntegrationTests/Android.mk35
-rw-r--r--tests/Compatibility/Android.bp22
-rw-r--r--tests/Compatibility/Android.mk31
-rw-r--r--tests/FlickerTests/Android.bp30
-rw-r--r--tests/FlickerTests/Android.mk35
-rw-r--r--tests/FlickerTests/lib/Android.bp44
-rw-r--r--tests/FlickerTests/lib/Android.mk48
-rw-r--r--tests/FlickerTests/lib/test/Android.bp33
-rw-r--r--tests/FlickerTests/lib/test/Android.mk36
-rw-r--r--tests/FlickerTests/test-apps/Android.bp0
-rw-r--r--tests/FlickerTests/test-apps/Android.mk15
-rw-r--r--tests/FlickerTests/test-apps/flickerapp/Android.bp26
-rw-r--r--tests/FlickerTests/test-apps/flickerapp/Android.mk31
-rw-r--r--tests/Internal/Android.bp18
-rw-r--r--tests/Internal/Android.mk24
-rw-r--r--tests/PackageWatchdog/Android.bp28
-rw-r--r--tests/PackageWatchdog/Android.mk34
-rw-r--r--tests/RcsTests/Android.bp17
-rw-r--r--tests/RcsTests/Android.mk19
-rw-r--r--tests/ServiceCrashTest/Android.bp12
-rw-r--r--tests/ServiceCrashTest/Android.mk20
-rw-r--r--tests/SurfaceComposition/Android.bp32
-rw-r--r--tests/SurfaceComposition/Android.mk38
-rw-r--r--tests/SystemMemoryTest/Android.mk17
-rw-r--r--tests/SystemMemoryTest/device/Android.bp20
-rw-r--r--tests/SystemMemoryTest/device/Android.mk24
-rw-r--r--tests/SystemMemoryTest/host/Android.bp20
-rw-r--r--tests/SystemMemoryTest/host/Android.mk23
-rw-r--r--tests/UsageReportingTest/Android.bp8
-rw-r--r--tests/UsageReportingTest/Android.mk17
-rw-r--r--tests/UsageStatsPerfTests/Android.bp26
-rw-r--r--tests/UsageStatsPerfTests/Android.mk34
-rw-r--r--tests/UsbHostExternalManagmentTest/AoapTestDevice/Android.bp27
-rw-r--r--tests/UsbHostExternalManagmentTest/AoapTestDevice/Android.mk36
-rw-r--r--tests/UsbHostExternalManagmentTest/AoapTestHost/Android.bp27
-rw-r--r--tests/UsbHostExternalManagmentTest/AoapTestHost/Android.mk36
-rw-r--r--tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/Android.bp32
-rw-r--r--tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/Android.mk38
-rw-r--r--tests/UsbTests/Android.bp34
-rw-r--r--tests/UsbTests/Android.mk45
-rw-r--r--tests/WindowAnimationJank/Android.bp25
-rw-r--r--tests/WindowAnimationJank/Android.mk36
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java29
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java3
-rw-r--r--wifi/java/android/net/wifi/WifiNetworkSpecifier.java12
-rw-r--r--wifi/java/android/net/wifi/WifiNetworkSuggestion.java33
-rwxr-xr-xwifi/tests/runtests.sh2
-rw-r--r--wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java10
-rw-r--r--wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java16
146 files changed, 2460 insertions, 1659 deletions
diff --git a/api/current.txt b/api/current.txt
index f2dc7a925f98..c753691ee0ec 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -30141,8 +30141,8 @@ package android.net.wifi {
method @NonNull public android.net.wifi.WifiNetworkSpecifier build();
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setBssid(@NonNull android.net.MacAddress);
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setBssidPattern(@NonNull android.net.MacAddress, @NonNull android.net.MacAddress);
- method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsEnhancedOpen();
- method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsHiddenSsid();
+ method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsEnhancedOpen(boolean);
+ method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsHiddenSsid(boolean);
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setSsid(@NonNull String);
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setSsidPattern(@NonNull android.os.PatternMatcher);
method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
@@ -30161,12 +30161,12 @@ package android.net.wifi {
ctor public WifiNetworkSuggestion.Builder();
method @NonNull public android.net.wifi.WifiNetworkSuggestion build();
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setBssid(@NonNull android.net.MacAddress);
- method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsAppInteractionRequired();
- method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsEnhancedOpen();
- method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsHiddenSsid();
- method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsMetered();
- method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired();
- method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPriority(int);
+ method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsAppInteractionRequired(boolean);
+ method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsEnhancedOpen(boolean);
+ method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsHiddenSsid(boolean);
+ method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsMetered(boolean);
+ method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired(boolean);
+ method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPriority(@IntRange(from=0) int);
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setSsid(@NonNull String);
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2Passphrase(@NonNull String);
@@ -39023,12 +39023,10 @@ package android.provider {
method public static long getLong(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
method public static String getString(android.content.ContentResolver, String);
method public static android.net.Uri getUriFor(String);
- method @Deprecated public static boolean isLocationProviderEnabled(android.content.ContentResolver, String);
method public static boolean putFloat(android.content.ContentResolver, String, float);
method public static boolean putInt(android.content.ContentResolver, String, int);
method public static boolean putLong(android.content.ContentResolver, String, long);
method public static boolean putString(android.content.ContentResolver, String, String);
- method @Deprecated public static void setLocationProviderEnabled(android.content.ContentResolver, String, boolean);
field public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = "accessibility_display_inversion_enabled";
field public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
field @Deprecated public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
@@ -44431,12 +44429,12 @@ package android.telephony {
}
public final class CellIdentityNr extends android.telephony.CellIdentity {
- method public String getMccString();
- method public String getMncString();
+ method @Nullable public String getMccString();
+ method @Nullable public String getMncString();
method public long getNci();
- method public int getNrarfcn();
- method public int getPci();
- method public int getTac();
+ method @IntRange(from=0, to=3279165) public int getNrarfcn();
+ method @IntRange(from=0, to=1007) public int getPci();
+ method @IntRange(from=0, to=65535) public int getTac();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityNr> CREATOR;
}
@@ -44503,8 +44501,8 @@ package android.telephony {
}
public final class CellInfoNr extends android.telephony.CellInfo {
- method public android.telephony.CellIdentity getCellIdentity();
- method public android.telephony.CellSignalStrength getCellSignalStrength();
+ method @NonNull public android.telephony.CellIdentity getCellIdentity();
+ method @NonNull public android.telephony.CellSignalStrength getCellSignalStrength();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoNr> CREATOR;
}
@@ -56416,10 +56414,12 @@ package android.widget {
method public int getWindowLayoutType();
method public boolean isAboveAnchor();
method public boolean isAttachedInDecor();
+ method @Deprecated public boolean isClipToScreenEnabled();
method public boolean isClippedToScreen();
method public boolean isClippingEnabled();
method public boolean isFocusable();
method public boolean isLaidOutInScreen();
+ method @Deprecated public boolean isLayoutInScreenEnabled();
method public boolean isOutsideTouchable();
method public boolean isShowing();
method public boolean isSplitTouchEnabled();
@@ -56428,6 +56428,7 @@ package android.widget {
method public void setAnimationStyle(int);
method public void setAttachedInDecor(boolean);
method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
+ method @Deprecated public void setClipToScreenEnabled(boolean);
method public void setClippingEnabled(boolean);
method public void setContentView(android.view.View);
method public void setElevation(float);
@@ -56440,6 +56441,7 @@ package android.widget {
method public void setInputMethodMode(int);
method public void setIsClippedToScreen(boolean);
method public void setIsLaidOutInScreen(boolean);
+ method @Deprecated public void setLayoutInScreenEnabled(boolean);
method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener);
method public void setOutsideTouchable(boolean);
method public void setOverlapAnchor(boolean);
diff --git a/api/removed.txt b/api/removed.txt
index 4fe0ed9b5313..5108dd0d8514 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -553,6 +553,11 @@ package android.provider {
field @Deprecated public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
}
+ public static final class Settings.Secure extends android.provider.Settings.NameValueTable {
+ method @Deprecated public static boolean isLocationProviderEnabled(android.content.ContentResolver, String);
+ method @Deprecated public static void setLocationProviderEnabled(android.content.ContentResolver, String, boolean);
+ }
+
public static final class Settings.System extends android.provider.Settings.NameValueTable {
field public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
field public static final String VOLUME_ALARM = "volume_alarm";
diff --git a/api/system-current.txt b/api/system-current.txt
index c1979fd038f1..cba378aff832 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5858,6 +5858,7 @@ package android.provider {
method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(@NonNull String, @NonNull String, @Nullable String, boolean);
field public static final String NAMESPACE_ACTIVITY_MANAGER = "activity_manager";
field public static final String NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT = "activity_manager_native_boot";
+ field public static final String NAMESPACE_ATTENTION_MANAGER_SERVICE = "attention_manager_service";
field public static final String NAMESPACE_AUTOFILL = "autofill";
field public static final String NAMESPACE_CONNECTIVITY = "connectivity";
field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
@@ -5867,17 +5868,13 @@ package android.provider {
field public static final String NAMESPACE_INTELLIGENCE_ATTENTION = "intelligence_attention";
field public static final String NAMESPACE_MEDIA_NATIVE = "media_native";
field public static final String NAMESPACE_NETD_NATIVE = "netd_native";
+ field public static final String NAMESPACE_RUNTIME = "runtime";
+ field public static final String NAMESPACE_RUNTIME_NATIVE = "runtime_native";
field public static final String NAMESPACE_RUNTIME_NATIVE_BOOT = "runtime_native_boot";
field public static final String NAMESPACE_SYSTEMUI = "systemui";
field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
}
- public static interface DeviceConfig.AttentionManagerService {
- field public static final String COMPONENT_NAME = "component_name";
- field public static final String NAMESPACE = "attention_manager_service";
- field public static final String SERVICE_ENABLED = "service_enabled";
- }
-
public static interface DeviceConfig.OnPropertiesChangedListener {
method public void onPropertiesChanged(@NonNull android.provider.DeviceConfig.Properties);
}
@@ -5909,15 +5906,6 @@ package android.provider {
field public static final String ROLLBACK_LIFETIME_IN_MILLIS = "rollback_lifetime_in_millis";
}
- public static interface DeviceConfig.Runtime {
- field public static final String NAMESPACE = "runtime";
- field public static final String USE_PRECOMPILED_LAYOUT = "view.precompiled_layout_enabled";
- }
-
- public static interface DeviceConfig.RuntimeNative {
- field public static final String NAMESPACE = "runtime_native";
- }
-
public static interface DeviceConfig.Scheduler {
field public static final String ENABLE_FAST_METRICS_COLLECTION = "enable_fast_metrics_collection";
field public static final String NAMESPACE = "scheduler";
@@ -8043,7 +8031,7 @@ package android.telephony {
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.util.Pair<java.lang.Integer,java.lang.Integer>> getLogicalToPhysicalSlotMapping();
method public static long getMaxNumberVerificationTimeoutMillis();
- method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmap();
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
method public int getSimApplicationState();
method public int getSimCardState();
@@ -8080,7 +8068,7 @@ package android.telephony {
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultisimCarrierRestriction(boolean);
- method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmap(long);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerState(int);
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 694f6b061375..b039a60fbab3 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -8344,7 +8344,7 @@ public class Activity extends ContextThemeWrapper
try {
ActivityTaskManager.getService().setDisablePreviewScreenshots(mToken, disable);
} catch (RemoteException e) {
- Log.e(TAG, "Failed to call setDisablePreviewScreenshots", e);
+ throw e.rethrowFromSystemServer();
}
}
@@ -8365,7 +8365,7 @@ public class Activity extends ContextThemeWrapper
try {
ActivityTaskManager.getService().setShowWhenLocked(mToken, showWhenLocked);
} catch (RemoteException e) {
- Log.e(TAG, "Failed to call setShowWhenLocked", e);
+ throw e.rethrowFromSystemServer();
}
}
@@ -8389,7 +8389,7 @@ public class Activity extends ContextThemeWrapper
ActivityTaskManager.getService().setInheritShowWhenLocked(
mToken, inheritShowWhenLocked);
} catch (RemoteException e) {
- Log.e(TAG, "Failed to call setInheritShowWhenLocked", e);
+ throw e.rethrowFromSystemServer();
}
}
@@ -8415,7 +8415,7 @@ public class Activity extends ContextThemeWrapper
try {
ActivityTaskManager.getService().setTurnScreenOn(mToken, turnScreenOn);
} catch (RemoteException e) {
- Log.e(TAG, "Failed to call setTurnScreenOn", e);
+ throw e.rethrowFromSystemServer();
}
}
@@ -8432,7 +8432,7 @@ public class Activity extends ContextThemeWrapper
try {
ActivityTaskManager.getService().registerRemoteAnimations(mToken, definition);
} catch (RemoteException e) {
- Log.e(TAG, "Failed to call registerRemoteAnimations", e);
+ throw e.rethrowFromSystemServer();
}
}
diff --git a/core/java/android/hardware/OWNERS b/core/java/android/hardware/OWNERS
index 29a339a7d286..47dbf2d960e3 100644
--- a/core/java/android/hardware/OWNERS
+++ b/core/java/android/hardware/OWNERS
@@ -1,2 +1,2 @@
# Camera
-per-file *Camera* = cychen@google.com,epeev@google.com,etalvala@google.com,shuzhenwang@google.com,yinchiayeh@google.com,zhijunhe@google.com
+per-file *Camera*=cychen@google.com,epeev@google.com,etalvala@google.com,shuzhenwang@google.com,yinchiayeh@google.com,zhijunhe@google.com,jchowdhary@google.com
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index f8b2a5bd61bf..7ae673c1eded 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -85,8 +85,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
*
* @hide
*/
- @UnsupportedAppUsage
- public Key(@NonNull String name, @NonNull String fallbackName, @NonNull Class<T> type) {
+ public Key(String name, String fallbackName, Class<T> type) {
mKey = new CameraMetadataNative.Key<T>(name, fallbackName, type);
}
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 7382ac46c2be..ba451e585d27 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -89,8 +89,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
*
* @hide
*/
- @UnsupportedAppUsage
- public Key(@NonNull String name, @NonNull String fallbackName, @NonNull Class<T> type) {
+ public Key(String name, String fallbackName, Class<T> type) {
mKey = new CameraMetadataNative.Key<T>(name, fallbackName, type);
}
@@ -4252,7 +4251,6 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* @see CaptureResult#SENSOR_TIMESTAMP
* @hide
*/
- @UnsupportedAppUsage
public static final Key<long[]> STATISTICS_OIS_TIMESTAMPS =
new Key<long[]>("android.statistics.oisTimestamps", long[].class);
@@ -4272,7 +4270,6 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
* @hide
*/
- @UnsupportedAppUsage
public static final Key<float[]> STATISTICS_OIS_X_SHIFTS =
new Key<float[]>("android.statistics.oisXShifts", float[].class);
@@ -4292,7 +4289,6 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
* @hide
*/
- @UnsupportedAppUsage
public static final Key<float[]> STATISTICS_OIS_Y_SHIFTS =
new Key<float[]>("android.statistics.oisYShifts", float[].class);
diff --git a/core/java/android/hardware/camera2/OWNERS b/core/java/android/hardware/camera2/OWNERS
index 18acfee14555..f48a95c5b3a3 100644
--- a/core/java/android/hardware/camera2/OWNERS
+++ b/core/java/android/hardware/camera2/OWNERS
@@ -1,6 +1 @@
-cychen@google.com
-epeev@google.com
-etalvala@google.com
-shuzhenwang@google.com
-yinchiayeh@google.com
-zhijunhe@google.com
+include platform/frameworks/av:/camera/OWNERS
diff --git a/core/java/android/os/ZygoteProcess.java b/core/java/android/os/ZygoteProcess.java
index b6bc95d1cb54..6f0a1f29a3cf 100644
--- a/core/java/android/os/ZygoteProcess.java
+++ b/core/java/android/os/ZygoteProcess.java
@@ -21,12 +21,12 @@ import android.annotation.Nullable;
import android.content.pm.ApplicationInfo;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
-import android.provider.DeviceConfig;
import android.util.Log;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.os.Zygote;
+import com.android.internal.os.ZygoteConfig;
import java.io.BufferedWriter;
import java.io.DataInputStream;
@@ -659,16 +659,13 @@ public class ZygoteProcess {
private boolean fetchUsapPoolEnabledProp() {
boolean origVal = mUsapPoolEnabled;
- final String propertyString =
- Zygote.getConfigurationProperty(
- DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
- USAP_POOL_ENABLED_DEFAULT);
+ final String propertyString = Zygote.getConfigurationProperty(
+ ZygoteConfig.USAP_POOL_ENABLED, USAP_POOL_ENABLED_DEFAULT);
if (!propertyString.isEmpty()) {
- mUsapPoolEnabled =
- Zygote.getConfigurationPropertyBoolean(
- DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
- Boolean.parseBoolean(USAP_POOL_ENABLED_DEFAULT));
+ mUsapPoolEnabled = Zygote.getConfigurationPropertyBoolean(
+ ZygoteConfig.USAP_POOL_ENABLED,
+ Boolean.parseBoolean(USAP_POOL_ENABLED_DEFAULT));
}
if (origVal != mUsapPoolEnabled) {
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index 038d455b510b..046ed2f9d3ad 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -78,6 +78,14 @@ public final class DeviceConfig {
"activity_manager_native_boot";
/**
+ * Namespace for AttentionManagerService related features.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String NAMESPACE_ATTENTION_MANAGER_SERVICE = "attention_manager_service";
+
+ /**
* Namespace for autofill feature that provides suggestions across all apps when
* the user interacts with input fields.
*
@@ -155,86 +163,45 @@ public final class DeviceConfig {
public static final String NAMESPACE_NETD_NATIVE = "netd_native";
/**
- * Namespace for all runtime native boot related features. Boot in this case refers to the
- * fact that the properties only take affect after rebooting the device.
+ * Namespace for all runtime related features.
*
* @hide
*/
@SystemApi
- public static final String NAMESPACE_RUNTIME_NATIVE_BOOT = "runtime_native_boot";
+ public static final String NAMESPACE_RUNTIME = "runtime";
/**
- * Namespace for System UI related features.
+ * Namespace for all runtime native related features.
*
* @hide
*/
@SystemApi
- public static final String NAMESPACE_SYSTEMUI = "systemui";
+ public static final String NAMESPACE_RUNTIME_NATIVE = "runtime_native";
/**
- * Namespace for TextClassifier related features.
+ * Namespace for all runtime native boot related features. Boot in this case refers to the
+ * fact that the properties only take affect after rebooting the device.
*
* @hide
*/
@SystemApi
- public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
+ public static final String NAMESPACE_RUNTIME_NATIVE_BOOT = "runtime_native_boot";
/**
- * Namespace for all runtime related features.
+ * Namespace for System UI related features.
*
* @hide
*/
@SystemApi
- public interface Runtime {
- String NAMESPACE = "runtime";
-
- /**
- * Whether or not we use the precompiled layout.
- */
- String USE_PRECOMPILED_LAYOUT = "view.precompiled_layout_enabled";
- }
+ public static final String NAMESPACE_SYSTEMUI = "systemui";
/**
- * Namespace for all runtime native related features.
+ * Namespace for TextClassifier related features.
*
* @hide
*/
@SystemApi
- public interface RuntimeNative {
- String NAMESPACE = "runtime_native";
-
- /**
- * Zygote flags. See {@link com.internal.os.Zygote}.
- */
-
- /**
- * If {@code true}, enables the unspecialized app process (USAP) pool feature.
- *
- * @hide for internal use only
- */
- String USAP_POOL_ENABLED = "usap_pool_enabled";
-
- /**
- * The maximum number of processes to keep in the USAP pool.
- *
- * @hide for internal use only
- */
- String USAP_POOL_SIZE_MAX = "usap_pool_size_max";
-
- /**
- * The minimum number of processes to keep in the USAP pool.
- *
- * @hide for internal use only
- */
- String USAP_POOL_SIZE_MIN = "usap_pool_size_min";
-
- /**
- * The threshold used to determine if the pool should be refilled.
- *
- * @hide for internal use only
- */
- String USAP_POOL_REFILL_THRESHOLD = "usap_refill_threshold";
- }
+ public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
/**
* Privacy related properties definitions.
@@ -291,22 +258,6 @@ public final class DeviceConfig {
}
/**
- * Namespace for {@link AttentionManagerService} related features.
- *
- * @hide
- */
- @SystemApi
- public interface AttentionManagerService {
- String NAMESPACE = "attention_manager_service";
-
- /** If {@code true}, enables {@link AttentionManagerService} features. */
- String SERVICE_ENABLED = "service_enabled";
-
- /** Allows a CTS to inject a fake implementation. */
- String COMPONENT_NAME = "component_name";
- }
-
- /**
* Namespace for Rollback.
*
* @hide
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 664978358717..df5da6c6a5e3 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -9053,27 +9053,12 @@ public final class Settings {
* @return true if the provider is enabled
*
* @deprecated use {@link LocationManager#isProviderEnabled(String)}
+ * @removed no longer supported
*/
@Deprecated
- public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
- return isLocationProviderEnabledForUser(cr, provider, cr.getUserId());
- }
-
- /**
- * Helper method for determining if a location provider is enabled.
- * @param cr the content resolver to use
- * @param provider the location provider to query
- * @param userId the userId to query
- * @return true if the provider is enabled
- *
- * @deprecated use {@link LocationManager#isProviderEnabled(String)}
- * @hide
- */
- @Deprecated
- public static final boolean isLocationProviderEnabledForUser(
- ContentResolver cr, String provider, int userId) {
+ public static boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
String allowedProviders = Settings.Secure.getStringForUser(cr,
- LOCATION_PROVIDERS_ALLOWED, userId);
+ LOCATION_PROVIDERS_ALLOWED, cr.getUserId());
return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
}
@@ -9082,42 +9067,12 @@ public final class Settings {
* @param cr the content resolver to use
* @param provider the location provider to enable or disable
* @param enabled true if the provider should be enabled
- * @deprecated This API is deprecated. It requires WRITE_SECURE_SETTINGS permission to
- * change location settings.
+ * @deprecated This API is deprecated
+ * @removed no longer supported
*/
@Deprecated
- public static final void setLocationProviderEnabled(ContentResolver cr,
+ public static void setLocationProviderEnabled(ContentResolver cr,
String provider, boolean enabled) {
- setLocationProviderEnabledForUser(cr, provider, enabled, cr.getUserId());
- }
-
- /**
- * Thread-safe method for enabling or disabling a single location provider.
- *
- * @param cr the content resolver to use
- * @param provider the location provider to enable or disable
- * @param enabled true if the provider should be enabled
- * @param userId the userId for which to enable/disable providers
- * @return true if the value was set, false on database errors
- *
- * @deprecated use {@link LocationManager#setProviderEnabledForUser(String, boolean, int)}
- * @hide
- */
- @Deprecated
- public static final boolean setLocationProviderEnabledForUser(ContentResolver cr,
- String provider, boolean enabled, int userId) {
- synchronized (mLocationSettingsLock) {
- // to ensure thread safety, we write the provider name with a '+' or '-'
- // and let the SettingsProvider handle it rather than reading and modifying
- // the list of enabled providers.
- if (enabled) {
- provider = "+" + provider;
- } else {
- provider = "-" + provider;
- }
- return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider,
- userId);
- }
}
}
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index 2e27737782fa..35cf129d81b8 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -83,6 +83,10 @@ public abstract class LayoutInflater {
private static final boolean DEBUG = false;
private static final String COMPILED_VIEW_DEX_FILE_NAME = "/compiled_view.dex";
+ /**
+ * Whether or not we use the precompiled layout.
+ */
+ private static final String USE_PRECOMPILED_LAYOUT = "view.precompiled_layout_enabled";
/** Empty stack trace used to avoid log spam in re-throw exceptions. */
private static final StackTraceElement[] EMPTY_STACK_TRACE = new StackTraceElement[0];
@@ -416,15 +420,15 @@ public abstract class LayoutInflater {
String usePrecompiledLayout = null;
try {
usePrecompiledLayout = DeviceConfig.getProperty(
- DeviceConfig.Runtime.NAMESPACE,
- DeviceConfig.Runtime.USE_PRECOMPILED_LAYOUT);
+ DeviceConfig.NAMESPACE_RUNTIME,
+ USE_PRECOMPILED_LAYOUT);
} catch (Exception e) {
// May be caused by permission errors reading the property (i.e. instant apps).
}
boolean enabled = false;
if (TextUtils.isEmpty(usePrecompiledLayout)) {
enabled = SystemProperties.getBoolean(
- DeviceConfig.Runtime.USE_PRECOMPILED_LAYOUT,
+ USE_PRECOMPILED_LAYOUT,
false);
} else {
enabled = Boolean.parseBoolean(usePrecompiledLayout);
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index e63a406411d8..5e00425407ba 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -2559,6 +2559,12 @@ public final class InputMethodManager {
mPendingEventPool.release(p);
}
+ /**
+ * Show IME picker popup window.
+ *
+ * <p>Requires the {@link PackageManager#FEATURE_INPUT_METHODS} feature which can be detected
+ * using {@link PackageManager#hasSystemFeature(String)}.
+ */
public void showInputMethodPicker() {
synchronized (mH) {
showInputMethodPickerLocked();
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 03e7e10aaf84..20fc0b1a9f0b 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -886,6 +886,32 @@ public class PopupWindow {
* containing window<p/>
*
* @return true if popup will be clipped to the screen instead of the window, false otherwise
+ * @deprecated Use {@link #isClippedToScreen()} instead
+ */
+ @Deprecated
+ public boolean isClipToScreenEnabled() {
+ return mClipToScreen;
+ }
+
+ /**
+ * <p>Clip this popup window to the screen, but not to the containing window.</p>
+ *
+ * <p>If the popup is showing, calling this method will take effect only
+ * the next time the popup is shown or through a manual call to one of
+ * the {@link #update()} methods.</p>
+ *
+ * @deprecated Use {@link #setIsClippedToScreen(boolean)} instead
+ */
+ @Deprecated
+ public void setClipToScreenEnabled(boolean enabled) {
+ mClipToScreen = enabled;
+ }
+
+ /**
+ * <p>Indicates whether this popup will be clipped to the screen and not to the
+ * containing window<p/>
+ *
+ * @return true if popup will be clipped to the screen instead of the window, false otherwise
*
* @see #setIsClippedToScreen(boolean)
*/
@@ -961,6 +987,32 @@ public class PopupWindow {
*
* @return true if the window will always be positioned in screen coordinates.
*
+ * @deprecated Use {@link #isLaidOutInScreen()} instead
+ */
+ @Deprecated
+ public boolean isLayoutInScreenEnabled() {
+ return mLayoutInScreen;
+ }
+
+ /**
+ * <p>Allows the popup window to force the flag
+ * {@link WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN}, overriding default behavior.
+ * This will cause the popup to be positioned in absolute screen coordinates.</p>
+ *
+ * @param enabled true if the popup should always be positioned in screen coordinates
+ * @deprecated Use {@link #setIsLaidOutInScreen(boolean)} instead
+ */
+ @Deprecated
+ public void setLayoutInScreenEnabled(boolean enabled) {
+ mLayoutInScreen = enabled;
+ }
+
+ /**
+ * <p>Indicates whether the popup window will be forced into using absolute screen coordinates
+ * for positioning.</p>
+ *
+ * @return true if the window will always be positioned in screen coordinates.
+ *
* @see #setIsLaidOutInScreen(boolean)
*/
public boolean isLaidOutInScreen() {
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 9c50f9b967d6..f250666012f6 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -453,29 +453,6 @@ public class ChooserActivity extends ResolverActivity {
.getUserInfo(UserHandle.myUserId()).isManagedProfile();
}
- /**
- * Override method to add content preview area, specific to the chooser activity.
- */
- @Override
- public void setHeader() {
- super.setHeader();
-
- final Intent targetIntent = getTargetIntent();
- if (!isSendAction(targetIntent)) {
- return;
- }
-
- if (mChooserListAdapter == null || mChooserListAdapter.getCount() == 0) {
- return;
- }
-
- int previewType = findPreferredContentPreview(targetIntent, getContentResolver());
-
- getMetricsLogger().write(new LogMaker(MetricsEvent.ACTION_SHARE_WITH_PREVIEW)
- .setSubtype(previewType));
- displayContentPreview(previewType, targetIntent);
- }
-
private void onCopyButtonClicked(View v) {
Intent targetIntent = getTargetIntent();
if (targetIntent == null) {
@@ -535,46 +512,56 @@ public class ChooserActivity extends ResolverActivity {
private void updateLayoutWidth(int layoutResourceId, int width) {
View view = findViewById(layoutResourceId);
- LayoutParams params = view.getLayoutParams();
- params.width = width;
- view.setLayoutParams(params);
+ if (view != null && view.getLayoutParams() != null) {
+ LayoutParams params = view.getLayoutParams();
+ params.width = width;
+ view.setLayoutParams(params);
+ }
}
- private void displayContentPreview(@ContentPreviewType int previewType, Intent targetIntent) {
+ private ViewGroup displayContentPreview(@ContentPreviewType int previewType,
+ Intent targetIntent, LayoutInflater layoutInflater, ViewGroup convertView,
+ ViewGroup parent) {
switch (previewType) {
case CONTENT_PREVIEW_TEXT:
- displayTextContentPreview(targetIntent);
- break;
+ return displayTextContentPreview(targetIntent, layoutInflater, convertView, parent);
case CONTENT_PREVIEW_IMAGE:
- displayImageContentPreview(targetIntent);
- break;
+ return displayImageContentPreview(targetIntent, layoutInflater, convertView,
+ parent);
case CONTENT_PREVIEW_FILE:
- displayFileContentPreview(targetIntent);
- break;
+ return displayFileContentPreview(targetIntent, layoutInflater, convertView, parent);
default:
Log.e(TAG, "Unexpected content preview type: " + previewType);
}
+
+ return null;
}
- private void displayTextContentPreview(Intent targetIntent) {
- ViewGroup contentPreviewLayout = findViewById(R.id.content_preview_text_area);
- contentPreviewLayout.setVisibility(View.VISIBLE);
+ private ViewGroup displayTextContentPreview(Intent targetIntent, LayoutInflater layoutInflater,
+ ViewGroup convertView, ViewGroup parent) {
+ ViewGroup contentPreviewLayout =
+ convertView != null ? convertView : (ViewGroup) layoutInflater.inflate(
+ R.layout.chooser_grid_preview_text, parent, false);
- findViewById(R.id.copy_button).setOnClickListener(this::onCopyButtonClicked);
+ contentPreviewLayout.findViewById(R.id.copy_button).setOnClickListener(
+ this::onCopyButtonClicked);
CharSequence sharingText = targetIntent.getCharSequenceExtra(Intent.EXTRA_TEXT);
if (sharingText == null) {
- findViewById(R.id.content_preview_text_layout).setVisibility(View.GONE);
+ contentPreviewLayout.findViewById(R.id.content_preview_text_layout).setVisibility(
+ View.GONE);
} else {
- TextView textView = findViewById(R.id.content_preview_text);
+ TextView textView = contentPreviewLayout.findViewById(R.id.content_preview_text);
textView.setText(sharingText);
}
String previewTitle = targetIntent.getStringExtra(Intent.EXTRA_TITLE);
if (TextUtils.isEmpty(previewTitle)) {
- findViewById(R.id.content_preview_title_layout).setVisibility(View.GONE);
+ contentPreviewLayout.findViewById(R.id.content_preview_title_layout).setVisibility(
+ View.GONE);
} else {
- TextView previewTitleView = findViewById(R.id.content_preview_title);
+ TextView previewTitleView = contentPreviewLayout.findViewById(
+ R.id.content_preview_title);
previewTitleView.setText(previewTitle);
ClipData previewData = targetIntent.getClipData();
@@ -586,7 +573,8 @@ public class ChooserActivity extends ResolverActivity {
}
}
- ImageView previewThumbnailView = findViewById(R.id.content_preview_thumbnail);
+ ImageView previewThumbnailView = contentPreviewLayout.findViewById(
+ R.id.content_preview_thumbnail);
if (previewThumbnail == null) {
previewThumbnailView.setVisibility(View.GONE);
} else {
@@ -598,16 +586,20 @@ public class ChooserActivity extends ResolverActivity {
}
}
}
+
+ return contentPreviewLayout;
}
- private void displayImageContentPreview(Intent targetIntent) {
- ViewGroup contentPreviewLayout = findViewById(R.id.content_preview_image_area);
- contentPreviewLayout.setVisibility(View.VISIBLE);
+ private ViewGroup displayImageContentPreview(Intent targetIntent, LayoutInflater layoutInflater,
+ ViewGroup convertView, ViewGroup parent) {
+ ViewGroup contentPreviewLayout =
+ convertView != null ? convertView : (ViewGroup) layoutInflater.inflate(
+ R.layout.chooser_grid_preview_image, parent, false);
String action = targetIntent.getAction();
if (Intent.ACTION_SEND.equals(action)) {
Uri uri = targetIntent.getParcelableExtra(Intent.EXTRA_STREAM);
- loadUriIntoView(R.id.content_preview_image_1_large, uri);
+ loadUriIntoView(R.id.content_preview_image_1_large, uri, contentPreviewLayout);
} else {
ContentResolver resolver = getContentResolver();
@@ -623,23 +615,28 @@ public class ChooserActivity extends ResolverActivity {
Log.i(TAG, "Attempted to display image preview area with zero"
+ " available images detected in EXTRA_STREAM list");
contentPreviewLayout.setVisibility(View.GONE);
- return;
+ return contentPreviewLayout;
}
- loadUriIntoView(R.id.content_preview_image_1_large, imageUris.get(0));
+ loadUriIntoView(R.id.content_preview_image_1_large, imageUris.get(0),
+ contentPreviewLayout);
if (imageUris.size() == 2) {
- loadUriIntoView(R.id.content_preview_image_2_large, imageUris.get(1));
+ loadUriIntoView(R.id.content_preview_image_2_large, imageUris.get(1),
+ contentPreviewLayout);
} else if (imageUris.size() > 2) {
- loadUriIntoView(R.id.content_preview_image_2_small, imageUris.get(1));
+ loadUriIntoView(R.id.content_preview_image_2_small, imageUris.get(1),
+ contentPreviewLayout);
RoundedRectImageView imageView = loadUriIntoView(
- R.id.content_preview_image_3_small, imageUris.get(2));
+ R.id.content_preview_image_3_small, imageUris.get(2), contentPreviewLayout);
if (imageUris.size() > 3) {
imageView.setExtraImageCount(imageUris.size() - 3);
}
}
}
+
+ return contentPreviewLayout;
}
private static class FileInfo {
@@ -698,18 +695,21 @@ public class ChooserActivity extends ResolverActivity {
return new FileInfo(fileName, hasThumbnail);
}
- private void displayFileContentPreview(Intent targetIntent) {
- ViewGroup contentPreviewLayout = findViewById(R.id.content_preview_file_area);
- contentPreviewLayout.setVisibility(View.VISIBLE);
+ private ViewGroup displayFileContentPreview(Intent targetIntent, LayoutInflater layoutInflater,
+ ViewGroup convertView, ViewGroup parent) {
+
+ ViewGroup contentPreviewLayout =
+ convertView != null ? convertView : (ViewGroup) layoutInflater.inflate(
+ R.layout.chooser_grid_preview_file, parent, false);
// TODO(b/120417119): Disable file copy until after moving to sysui,
// due to permissions issues
- findViewById(R.id.file_copy_button).setVisibility(View.GONE);
+ contentPreviewLayout.findViewById(R.id.file_copy_button).setVisibility(View.GONE);
String action = targetIntent.getAction();
if (Intent.ACTION_SEND.equals(action)) {
Uri uri = targetIntent.getParcelableExtra(Intent.EXTRA_STREAM);
- loadFileUriIntoView(uri);
+ loadFileUriIntoView(uri, contentPreviewLayout);
} else {
List<Uri> uris = targetIntent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
int uriCount = uris.size();
@@ -719,42 +719,46 @@ public class ChooserActivity extends ResolverActivity {
Log.i(TAG,
"Appears to be no uris available in EXTRA_STREAM, removing "
+ "preview area");
- return;
+ return contentPreviewLayout;
} else if (uriCount == 1) {
- loadFileUriIntoView(uris.get(0));
+ loadFileUriIntoView(uris.get(0), contentPreviewLayout);
} else {
FileInfo fileInfo = extractFileInfo(uris.get(0), getContentResolver());
int remUriCount = uriCount - 1;
String fileName = getResources().getQuantityString(R.plurals.file_count,
remUriCount, fileInfo.name, remUriCount);
- TextView fileNameView = findViewById(R.id.content_preview_filename);
+ TextView fileNameView = contentPreviewLayout.findViewById(
+ R.id.content_preview_filename);
fileNameView.setText(fileName);
- ImageView fileIconView = findViewById(R.id.content_preview_file_icon);
+ ImageView fileIconView = contentPreviewLayout.findViewById(
+ R.id.content_preview_file_icon);
fileIconView.setVisibility(View.VISIBLE);
fileIconView.setImageResource(R.drawable.ic_file_copy);
}
}
+
+ return contentPreviewLayout;
}
- private void loadFileUriIntoView(Uri uri) {
+ private void loadFileUriIntoView(Uri uri, View parent) {
FileInfo fileInfo = extractFileInfo(uri, getContentResolver());
- TextView fileNameView = findViewById(R.id.content_preview_filename);
+ TextView fileNameView = parent.findViewById(R.id.content_preview_filename);
fileNameView.setText(fileInfo.name);
if (fileInfo.hasThumbnail) {
- loadUriIntoView(R.id.content_preview_file_thumbnail, uri);
+ loadUriIntoView(R.id.content_preview_file_thumbnail, uri, parent);
} else {
- ImageView fileIconView = findViewById(R.id.content_preview_file_icon);
+ ImageView fileIconView = parent.findViewById(R.id.content_preview_file_icon);
fileIconView.setVisibility(View.VISIBLE);
fileIconView.setImageResource(R.drawable.ic_doc_generic);
}
}
- private RoundedRectImageView loadUriIntoView(int imageResourceId, Uri uri) {
- RoundedRectImageView imageView = findViewById(imageResourceId);
+ private RoundedRectImageView loadUriIntoView(int imageResourceId, Uri uri, View parent) {
+ RoundedRectImageView imageView = parent.findViewById(imageResourceId);
Bitmap bmp = loadThumbnail(uri, new Size(200, 200));
if (bmp != null) {
imageView.setVisibility(View.VISIBLE);
@@ -966,15 +970,15 @@ public class ChooserActivity extends ResolverActivity {
switch (mChooserListAdapter.getPositionTargetType(which)) {
case ChooserListAdapter.TARGET_CALLER:
cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET;
+ value -= mChooserListAdapter.getSelectableServiceTargetCount();
break;
case ChooserListAdapter.TARGET_SERVICE:
cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET;
- value -= mChooserListAdapter.getCallerTargetCount();
break;
case ChooserListAdapter.TARGET_STANDARD:
cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET;
value -= mChooserListAdapter.getCallerTargetCount()
- + mChooserListAdapter.getServiceTargetCount();
+ + mChooserListAdapter.getSelectableServiceTargetCount();
break;
}
@@ -2062,6 +2066,7 @@ public class ChooserActivity extends ResolverActivity {
private static final int VIEW_TYPE_DIRECT_SHARE = 0;
private static final int VIEW_TYPE_NORMAL = 1;
+ private static final int VIEW_TYPE_CONTENT_PREVIEW = 2;
public ChooserRowAdapter(ChooserListAdapter wrappedAdapter) {
mChooserListAdapter = wrappedAdapter;
@@ -2090,7 +2095,8 @@ public class ChooserActivity extends ResolverActivity {
@Override
public int getCount() {
return (int) (
- getCallerTargetRowCount()
+ getContentPreviewRowCount()
+ + getCallerTargetRowCount()
+ getServiceTargetRowCount()
+ Math.ceil(
(float) mChooserListAdapter.getStandardTargetCount()
@@ -2098,6 +2104,18 @@ public class ChooserActivity extends ResolverActivity {
);
}
+ public int getContentPreviewRowCount() {
+ if (!isSendAction(getTargetIntent())) {
+ return 0;
+ }
+
+ if (mChooserListAdapter == null || mChooserListAdapter.getCount() == 0) {
+ return 0;
+ }
+
+ return 1;
+ }
+
public int getCallerTargetRowCount() {
return (int) Math.ceil(
(float) mChooserListAdapter.getCallerTargetCount() / getMaxTargetsPerRow());
@@ -2128,20 +2146,29 @@ public class ChooserActivity extends ResolverActivity {
final RowViewHolder holder;
int viewType = getItemViewType(position);
+ if (viewType == VIEW_TYPE_CONTENT_PREVIEW) {
+ return createContentPreviewView(convertView, parent);
+ }
+
if (convertView == null) {
holder = createViewHolder(viewType, parent);
} else {
holder = (RowViewHolder) convertView.getTag();
}
- bindViewHolder(position, holder, viewType == VIEW_TYPE_DIRECT_SHARE
- ? ChooserListAdapter.MAX_SERVICE_TARGETS : getMaxTargetsPerRow());
+ bindViewHolder(position, holder,
+ viewType == VIEW_TYPE_DIRECT_SHARE
+ ? ChooserListAdapter.MAX_SERVICE_TARGETS : getMaxTargetsPerRow());
return holder.getViewGroup();
}
@Override
public int getItemViewType(int position) {
+ if (position == 0 && getContentPreviewRowCount() == 1) {
+ return VIEW_TYPE_CONTENT_PREVIEW;
+ }
+
final int start = getFirstRowPosition(position);
final int startType = mChooserListAdapter.getPositionTargetType(start);
@@ -2154,7 +2181,20 @@ public class ChooserActivity extends ResolverActivity {
@Override
public int getViewTypeCount() {
- return 2;
+ return 3;
+ }
+
+ private ViewGroup createContentPreviewView(View convertView, ViewGroup parent) {
+ Intent targetIntent = getTargetIntent();
+ int previewType = findPreferredContentPreview(targetIntent, getContentResolver());
+
+ if (convertView == null) {
+ getMetricsLogger().write(new LogMaker(MetricsEvent.ACTION_SHARE_WITH_PREVIEW)
+ .setSubtype(previewType));
+ }
+
+ return displayContentPreview(previewType, targetIntent, mLayoutInflater,
+ (ViewGroup) convertView, parent);
}
private RowViewHolder loadViewsIntoRow(RowViewHolder holder) {
@@ -2244,7 +2284,7 @@ public class ChooserActivity extends ResolverActivity {
final ViewGroup row = holder.getViewGroup();
- if (startType != lastStartType || rowPosition == 0) {
+ if (startType != lastStartType || rowPosition == getContentPreviewRowCount()) {
row.setBackground(mChooserRowLayer);
setVertPadding(row, mChooserRowServiceSpacing, 0);
} else {
@@ -2321,6 +2361,8 @@ public class ChooserActivity extends ResolverActivity {
}
int getFirstRowPosition(int row) {
+ row -= getContentPreviewRowCount();
+
final int serviceCount = mChooserListAdapter.getServiceTargetCount();
final int serviceRows = (int) Math.ceil((float) serviceCount
/ ChooserListAdapter.MAX_SERVICE_TARGETS);
@@ -2512,7 +2554,9 @@ public class ChooserActivity extends ResolverActivity {
return;
}
- ViewGroup expansionGroup = (ViewGroup) view.getChildAt(0);
+ int index = mChooserRowAdapter.getContentPreviewRowCount();
+
+ ViewGroup expansionGroup = (ViewGroup) view.getChildAt(index);
int widthSpec = MeasureSpec.makeMeasureSpec(expansionGroup.getWidth(),
MeasureSpec.EXACTLY);
int heightSpec = MeasureSpec.makeMeasureSpec(mDirectShareCurrHeight,
@@ -2525,7 +2569,7 @@ public class ChooserActivity extends ResolverActivity {
// reposition list items
int items = view.getChildCount();
- for (int i = 1; i < items; i++) {
+ for (int i = index + 1; i < items; i++) {
view.getChildAt(i).offsetTopAndBottom(yDiff);
}
}
@@ -2702,7 +2746,7 @@ public class ChooserActivity extends ResolverActivity {
final int chooserTargetRows = mChooserRowAdapter.getServiceTargetRowCount();
int offset = 0;
for (int i = 0; i < chooserTargetRows; i++) {
- final int pos = mChooserRowAdapter.getCallerTargetRowCount() + i;
+ final int pos = mChooserRowAdapter.getContentPreviewRowCount() + i;
final int vt = mChooserRowAdapter.getItemViewType(pos);
if (vt != mCachedViewType) {
mCachedView = null;
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index b55700e5985d..12942abc8159 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -42,6 +42,8 @@ import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.graphics.Color;
+import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
@@ -49,6 +51,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PatternMatcher;
+import android.os.Process;
import android.os.RemoteException;
import android.os.StrictMode;
import android.os.UserHandle;
@@ -56,7 +59,6 @@ import android.os.UserManager;
import android.provider.MediaStore;
import android.provider.Settings;
import android.text.TextUtils;
-import android.util.IconDrawableFactory;
import android.util.Log;
import android.util.Slog;
import android.view.LayoutInflater;
@@ -131,7 +133,7 @@ public class ResolverActivity extends Activity {
/** See {@link #setRetainInOnStop}. */
private boolean mRetainInOnStop;
- IconDrawableFactory mIconFactory;
+ SimpleIconFactory mSimpleIconFactory;
private final PackageMonitor mPackageMonitor = new PackageMonitor() {
@Override public void onSomePackagesChanged() {
@@ -309,7 +311,11 @@ public class ResolverActivity extends Activity {
// as to mitigate Intent Capturing vulnerability
mSupportsAlwaysUseOption = supportsAlwaysUseOption && !mUseLayoutForBrowsables;
- mIconFactory = IconDrawableFactory.newInstance(this, true);
+ final int iconSize = getResources().getDimensionPixelSize(R.dimen.resolver_icon_size);
+ final int badgeSize = getResources().getDimensionPixelSize(R.dimen.resolver_badge_size);
+ mSimpleIconFactory = new SimpleIconFactory(this, mIconDpi, iconSize, badgeSize);
+ mSimpleIconFactory.setWrapperBackgroundColor(Color.WHITE);
+
if (configureContentView(mIntents, initialIntents, rList)) {
return;
}
@@ -494,6 +500,7 @@ public class ResolverActivity extends Activity {
}
}
+ @Nullable
Drawable getIcon(Resources res, int resId) {
Drawable result;
try {
@@ -505,26 +512,52 @@ public class ResolverActivity extends Activity {
return result;
}
+ /**
+ * Loads the icon for the provided ResolveInfo. Defaults to using the application icon over
+ * any IntentFilter or Activity icon to increase user understanding, with an exception for
+ * applications that hold the right permission. Always attempts to use icon resources over
+ * PackageManager loading mechanisms so badging can be done by iconloader.
+ */
Drawable loadIconForResolveInfo(ResolveInfo ri) {
- Drawable dr;
- try {
- if (ri.resolvePackageName != null && ri.icon != 0) {
- dr = getIcon(mPm.getResourcesForApplication(ri.resolvePackageName), ri.icon);
- if (dr != null) {
- return mIconFactory.getShadowedIcon(dr);
+ Drawable dr = null;
+
+ // Allow for app icon override given the right permission
+ if (PackageManager.PERMISSION_GRANTED == mPm.checkPermission(
+ android.Manifest.permission.SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON,
+ ri.activityInfo.applicationInfo.packageName)) {
+ try {
+ if (ri.resolvePackageName != null && ri.icon != 0) {
+ dr = getIcon(mPm.getResourcesForApplication(ri.resolvePackageName), ri.icon);
}
- }
- final int iconRes = ri.getIconResource();
- if (iconRes != 0) {
- dr = getIcon(mPm.getResourcesForApplication(ri.activityInfo.packageName), iconRes);
- if (dr != null) {
- return mIconFactory.getShadowedIcon(dr);
+ if (dr == null) {
+ final int iconRes = ri.getIconResource();
+ if (iconRes != 0) {
+ dr = getIcon(mPm.getResourcesForApplication(ri.activityInfo.packageName),
+ iconRes);
+ }
}
+ } catch (NameNotFoundException e) {
+ Log.e(TAG, "SUBSTITUTE_SHARE_TARGET_APP_NAME_AND_ICON permission granted but "
+ + "couldn't find resources for package", e);
}
- } catch (NameNotFoundException e) {
- Log.e(TAG, "Couldn't find resources for package", e);
}
- return mIconFactory.getBadgedIcon(ri.activityInfo.applicationInfo);
+
+ // Use app icons for better user association
+ if (dr == null) {
+ try {
+ dr = getIcon(mPm.getResourcesForApplication(ri.activityInfo.applicationInfo),
+ ri.activityInfo.applicationInfo.icon);
+ } catch (NameNotFoundException ignore) {
+ }
+ }
+
+ // Fall back to ApplicationInfo#loadIcon if nothing has been loaded
+ if (dr == null) {
+ dr = ri.activityInfo.applicationInfo.loadIcon(mPm);
+ }
+
+ return new BitmapDrawable(this.getResources(),
+ mSimpleIconFactory.createUserBadgedIconBitmap(dr, Process.myUserHandle()));
}
@Override
diff --git a/core/java/com/android/internal/app/SimpleIconFactory.java b/core/java/com/android/internal/app/SimpleIconFactory.java
new file mode 100644
index 000000000000..eb1530e97b7f
--- /dev/null
+++ b/core/java/com/android/internal/app/SimpleIconFactory.java
@@ -0,0 +1,609 @@
+/*
+ * Copyright (C) 2019 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 com.android.internal.app;
+
+import static android.graphics.Paint.DITHER_FLAG;
+import static android.graphics.Paint.FILTER_BITMAP_FLAG;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.content.res.Resources;
+import android.content.res.Resources.Theme;
+import android.graphics.Bitmap;
+import android.graphics.BlurMaskFilter;
+import android.graphics.BlurMaskFilter.Blur;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.PaintFlagsDrawFilter;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.graphics.drawable.AdaptiveIconDrawable;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.DrawableWrapper;
+import android.os.Process;
+import android.os.UserHandle;
+import android.util.AttributeSet;
+
+import com.android.internal.R;
+
+import org.xmlpull.v1.XmlPullParser;
+
+import java.nio.ByteBuffer;
+
+
+/**
+ * @deprecated Use the Launcher3 Iconloaderlib at packages/apps/Launcher3/iconloaderlib. This class
+ * is a temporary fork of Iconloader. It combines all necessary methods to render app icons that are
+ * possibly badged. It is intended to be used only by Sharesheet for the Q release.
+ */
+@Deprecated
+public class SimpleIconFactory {
+
+ private static final int DEFAULT_WRAPPER_BACKGROUND = Color.WHITE;
+ private static final float BLUR_FACTOR = 0.5f / 48;
+
+ private Context mContext;
+ private Canvas mCanvas;
+ private PackageManager mPm;
+
+ private int mFillResIconDpi;
+ private int mIconBitmapSize;
+ private int mBadgeBitmapSize;
+ private int mWrapperBackgroundColor;
+
+ private Drawable mWrapperIcon;
+ private final Rect mOldBounds = new Rect();
+
+ /**
+ * @deprecated Do not use, functionality will be replaced by iconloader lib eventually.
+ */
+ @Deprecated
+ SimpleIconFactory(Context context, int fillResIconDpi, int iconBitmapSize,
+ int badgeBitmapSize) {
+ mContext = context.getApplicationContext();
+ mPm = mContext.getPackageManager();
+ mIconBitmapSize = iconBitmapSize;
+ mBadgeBitmapSize = badgeBitmapSize;
+ mFillResIconDpi = fillResIconDpi;
+
+ mCanvas = new Canvas();
+ mCanvas.setDrawFilter(new PaintFlagsDrawFilter(DITHER_FLAG, FILTER_BITMAP_FLAG));
+
+ // Normalizer init
+ // Use twice the icon size as maximum size to avoid scaling down twice.
+ mMaxSize = iconBitmapSize * 2;
+ mBitmap = Bitmap.createBitmap(mMaxSize, mMaxSize, Bitmap.Config.ALPHA_8);
+ mScaleCheckCanvas = new Canvas(mBitmap);
+ mPixels = new byte[mMaxSize * mMaxSize];
+ mLeftBorder = new float[mMaxSize];
+ mRightBorder = new float[mMaxSize];
+ mBounds = new Rect();
+ mAdaptiveIconBounds = new Rect();
+ mAdaptiveIconScale = SCALE_NOT_INITIALIZED;
+
+ // Shadow generator init
+ mDefaultBlurMaskFilter = new BlurMaskFilter(iconBitmapSize * BLUR_FACTOR,
+ Blur.NORMAL);
+ }
+
+ /**
+ * Sets the background color used for wrapped adaptive icon
+ *
+ * @deprecated Do not use, functionality will be replaced by iconloader lib eventually.
+ */
+ @Deprecated
+ void setWrapperBackgroundColor(int color) {
+ mWrapperBackgroundColor = (Color.alpha(color) < 255) ? DEFAULT_WRAPPER_BACKGROUND : color;
+ }
+
+ /**
+ * Creates bitmap using the source drawable and various parameters.
+ * The bitmap is visually normalized with other icons and has enough spacing to add shadow.
+ *
+ * @param icon source of the icon associated with a user that has no badge,
+ * likely user 0
+ * @param user info can be used for a badge
+ * @return a bitmap suitable for disaplaying as an icon at various system UIs.
+ *
+ * @deprecated Do not use, functionality will be replaced by iconloader lib eventually.
+ */
+ @Deprecated
+ Bitmap createUserBadgedIconBitmap(@Nullable Drawable icon, UserHandle user) {
+ float [] scale = new float[1];
+
+ // If no icon is provided use the system default
+ if (icon == null) {
+ icon = getFullResDefaultActivityIcon(mFillResIconDpi);
+ }
+ icon = normalizeAndWrapToAdaptiveIcon(icon, null, scale);
+ Bitmap bitmap = createIconBitmap(icon, scale[0]);
+ if (icon instanceof AdaptiveIconDrawable) {
+ mCanvas.setBitmap(bitmap);
+ recreateIcon(Bitmap.createBitmap(bitmap), mCanvas);
+ mCanvas.setBitmap(null);
+ }
+
+ final Bitmap result;
+ if (user != null && !Process.myUserHandle().equals(user)) {
+ BitmapDrawable drawable = new FixedSizeBitmapDrawable(bitmap);
+ Drawable badged = mPm.getUserBadgedIcon(drawable, user);
+ if (badged instanceof BitmapDrawable) {
+ result = ((BitmapDrawable) badged).getBitmap();
+ } else {
+ result = createIconBitmap(badged, 1f);
+ }
+ } else {
+ result = bitmap;
+ }
+
+ return result;
+ }
+
+ /**
+ * Creates bitmap using the source drawable and flattened pre-rendered app icon.
+ * The bitmap is visually normalized with other icons and has enough spacing to add shadow.
+ *
+ * @param icon source of the icon associated with a user that has no badge
+ * @param renderedAppIcon pre-rendered app icon to use as a badge, likely the output
+ * of createUserBadgedIconBitmap for user 0
+ * @return a bitmap suitable for disaplaying as an icon at various system UIs.
+ *
+ * @deprecated Do not use, functionality will be replaced by iconloader lib eventually.
+ */
+ @Deprecated
+ public Bitmap createAppBadgedIconBitmap(@Nullable Drawable icon, Bitmap renderedAppIcon) {
+ // Flatten the passed in icon
+ float [] scale = new float[1];
+
+ // If no icon is provided use the system default
+ if (icon == null) {
+ icon = getFullResDefaultActivityIcon(mFillResIconDpi);
+ }
+ icon = normalizeAndWrapToAdaptiveIcon(icon, null, scale);
+ Bitmap bitmap = createIconBitmap(icon, scale[0]);
+ if (icon instanceof AdaptiveIconDrawable) {
+ mCanvas.setBitmap(bitmap);
+ recreateIcon(Bitmap.createBitmap(bitmap), mCanvas);
+ mCanvas.setBitmap(null);
+ }
+
+ // Now scale down and apply the badge to the bottom right corner of the flattened icon
+ renderedAppIcon = Bitmap.createScaledBitmap(renderedAppIcon, mBadgeBitmapSize,
+ mBadgeBitmapSize, false);
+
+ // Paint the provided badge on top of the flattened icon
+ mCanvas.setBitmap(bitmap);
+ mCanvas.drawBitmap(renderedAppIcon, mIconBitmapSize - mBadgeBitmapSize,
+ mIconBitmapSize - mBadgeBitmapSize, null);
+ mCanvas.setBitmap(null);
+
+ return bitmap;
+ }
+
+ private static Drawable getFullResDefaultActivityIcon(int iconDpi) {
+ return Resources.getSystem().getDrawableForDensity(android.R.mipmap.sym_def_app_icon,
+ iconDpi);
+ }
+
+ private Bitmap createIconBitmap(Drawable icon, float scale) {
+ return createIconBitmap(icon, scale, mIconBitmapSize);
+ }
+
+ /**
+ * @param icon drawable that should be flattened to a bitmap
+ * @param scale the scale to apply before drawing {@param icon} on the canvas
+ */
+ private Bitmap createIconBitmap(Drawable icon, float scale, int size) {
+ Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
+
+ mCanvas.setBitmap(bitmap);
+ mOldBounds.set(icon.getBounds());
+
+ if (icon instanceof AdaptiveIconDrawable) {
+ int offset = Math.max((int) Math.ceil(BLUR_FACTOR * size),
+ Math.round(size * (1 - scale) / 2));
+ icon.setBounds(offset, offset, size - offset, size - offset);
+ icon.draw(mCanvas);
+ } else {
+ if (icon instanceof BitmapDrawable) {
+ BitmapDrawable bitmapDrawable = (BitmapDrawable) icon;
+ Bitmap b = bitmapDrawable.getBitmap();
+ if (bitmap != null && b.getDensity() == Bitmap.DENSITY_NONE) {
+ bitmapDrawable.setTargetDensity(mContext.getResources().getDisplayMetrics());
+ }
+ }
+ int width = size;
+ int height = size;
+
+ int intrinsicWidth = icon.getIntrinsicWidth();
+ int intrinsicHeight = icon.getIntrinsicHeight();
+ if (intrinsicWidth > 0 && intrinsicHeight > 0) {
+ // Scale the icon proportionally to the icon dimensions
+ final float ratio = (float) intrinsicWidth / intrinsicHeight;
+ if (intrinsicWidth > intrinsicHeight) {
+ height = (int) (width / ratio);
+ } else if (intrinsicHeight > intrinsicWidth) {
+ width = (int) (height * ratio);
+ }
+ }
+ final int left = (size - width) / 2;
+ final int top = (size - height) / 2;
+ icon.setBounds(left, top, left + width, top + height);
+ mCanvas.save();
+ mCanvas.scale(scale, scale, size / 2, size / 2);
+ icon.draw(mCanvas);
+ mCanvas.restore();
+
+ }
+
+ icon.setBounds(mOldBounds);
+ mCanvas.setBitmap(null);
+ return bitmap;
+ }
+
+ private Drawable normalizeAndWrapToAdaptiveIcon(Drawable icon, RectF outIconBounds,
+ float[] outScale) {
+ float scale = 1f;
+
+ if (mWrapperIcon == null) {
+ mWrapperIcon = mContext.getDrawable(
+ R.drawable.iconfactory_adaptive_icon_drawable_wrapper).mutate();
+ }
+
+ AdaptiveIconDrawable dr = (AdaptiveIconDrawable) mWrapperIcon;
+ dr.setBounds(0, 0, 1, 1);
+ scale = getScale(icon, outIconBounds);
+ if (!(icon instanceof AdaptiveIconDrawable)) {
+ FixedScaleDrawable fsd = ((FixedScaleDrawable) dr.getForeground());
+ fsd.setDrawable(icon);
+ fsd.setScale(scale);
+ icon = dr;
+ scale = getScale(icon, outIconBounds);
+
+ ((ColorDrawable) dr.getBackground()).setColor(mWrapperBackgroundColor);
+ }
+
+ outScale[0] = scale;
+ return icon;
+ }
+
+
+ /* Normalization block */
+
+ private static final float SCALE_NOT_INITIALIZED = 0;
+ // Ratio of icon visible area to full icon size for a square shaped icon
+ private static final float MAX_SQUARE_AREA_FACTOR = 375.0f / 576;
+ // Ratio of icon visible area to full icon size for a circular shaped icon
+ private static final float MAX_CIRCLE_AREA_FACTOR = 380.0f / 576;
+
+ private static final float CIRCLE_AREA_BY_RECT = (float) Math.PI / 4;
+
+ // Slope used to calculate icon visible area to full icon size for any generic shaped icon.
+ private static final float LINEAR_SCALE_SLOPE =
+ (MAX_CIRCLE_AREA_FACTOR - MAX_SQUARE_AREA_FACTOR) / (1 - CIRCLE_AREA_BY_RECT);
+
+ private static final int MIN_VISIBLE_ALPHA = 40;
+
+ private float mAdaptiveIconScale;
+ private final Rect mAdaptiveIconBounds;
+ private final Rect mBounds;
+ private final int mMaxSize;
+ private final byte[] mPixels;
+ private final float[] mLeftBorder;
+ private final float[] mRightBorder;
+ private final Bitmap mBitmap;
+ private final Canvas mScaleCheckCanvas;
+
+ /**
+ * Returns the amount by which the {@param d} should be scaled (in both dimensions) so that it
+ * matches the design guidelines for a launcher icon.
+ *
+ * We first calculate the convex hull of the visible portion of the icon.
+ * This hull then compared with the bounding rectangle of the hull to find how closely it
+ * resembles a circle and a square, by comparing the ratio of the areas. Note that this is not
+ * an ideal solution but it gives satisfactory result without affecting the performance.
+ *
+ * This closeness is used to determine the ratio of hull area to the full icon size.
+ * Refer {@link #MAX_CIRCLE_AREA_FACTOR} and {@link #MAX_SQUARE_AREA_FACTOR}
+ *
+ * @param outBounds optional rect to receive the fraction distance from each edge.
+ */
+ private synchronized float getScale(@NonNull Drawable d, @Nullable RectF outBounds) {
+ if (d instanceof AdaptiveIconDrawable) {
+ if (mAdaptiveIconScale != SCALE_NOT_INITIALIZED) {
+ if (outBounds != null) {
+ outBounds.set(mAdaptiveIconBounds);
+ }
+ return mAdaptiveIconScale;
+ }
+ }
+ int width = d.getIntrinsicWidth();
+ int height = d.getIntrinsicHeight();
+ if (width <= 0 || height <= 0) {
+ width = width <= 0 || width > mMaxSize ? mMaxSize : width;
+ height = height <= 0 || height > mMaxSize ? mMaxSize : height;
+ } else if (width > mMaxSize || height > mMaxSize) {
+ int max = Math.max(width, height);
+ width = mMaxSize * width / max;
+ height = mMaxSize * height / max;
+ }
+
+ mBitmap.eraseColor(Color.TRANSPARENT);
+ d.setBounds(0, 0, width, height);
+ d.draw(mScaleCheckCanvas);
+
+ ByteBuffer buffer = ByteBuffer.wrap(mPixels);
+ buffer.rewind();
+ mBitmap.copyPixelsToBuffer(buffer);
+
+ // Overall bounds of the visible icon.
+ int topY = -1;
+ int bottomY = -1;
+ int leftX = mMaxSize + 1;
+ int rightX = -1;
+
+ // Create border by going through all pixels one row at a time and for each row find
+ // the first and the last non-transparent pixel. Set those values to mLeftBorder and
+ // mRightBorder and use -1 if there are no visible pixel in the row.
+
+ // buffer position
+ int index = 0;
+ // buffer shift after every row, width of buffer = mMaxSize
+ int rowSizeDiff = mMaxSize - width;
+ // first and last position for any row.
+ int firstX, lastX;
+
+ for (int y = 0; y < height; y++) {
+ firstX = lastX = -1;
+ for (int x = 0; x < width; x++) {
+ if ((mPixels[index] & 0xFF) > MIN_VISIBLE_ALPHA) {
+ if (firstX == -1) {
+ firstX = x;
+ }
+ lastX = x;
+ }
+ index++;
+ }
+ index += rowSizeDiff;
+
+ mLeftBorder[y] = firstX;
+ mRightBorder[y] = lastX;
+
+ // If there is at least one visible pixel, update the overall bounds.
+ if (firstX != -1) {
+ bottomY = y;
+ if (topY == -1) {
+ topY = y;
+ }
+
+ leftX = Math.min(leftX, firstX);
+ rightX = Math.max(rightX, lastX);
+ }
+ }
+
+ if (topY == -1 || rightX == -1) {
+ // No valid pixels found. Do not scale.
+ return 1;
+ }
+
+ convertToConvexArray(mLeftBorder, 1, topY, bottomY);
+ convertToConvexArray(mRightBorder, -1, topY, bottomY);
+
+ // Area of the convex hull
+ float area = 0;
+ for (int y = 0; y < height; y++) {
+ if (mLeftBorder[y] <= -1) {
+ continue;
+ }
+ area += mRightBorder[y] - mLeftBorder[y] + 1;
+ }
+
+ // Area of the rectangle required to fit the convex hull
+ float rectArea = (bottomY + 1 - topY) * (rightX + 1 - leftX);
+ float hullByRect = area / rectArea;
+
+ float scaleRequired;
+ if (hullByRect < CIRCLE_AREA_BY_RECT) {
+ scaleRequired = MAX_CIRCLE_AREA_FACTOR;
+ } else {
+ scaleRequired = MAX_SQUARE_AREA_FACTOR + LINEAR_SCALE_SLOPE * (1 - hullByRect);
+ }
+ mBounds.left = leftX;
+ mBounds.right = rightX;
+
+ mBounds.top = topY;
+ mBounds.bottom = bottomY;
+
+ if (outBounds != null) {
+ outBounds.set(((float) mBounds.left) / width, ((float) mBounds.top) / height,
+ 1 - ((float) mBounds.right) / width,
+ 1 - ((float) mBounds.bottom) / height);
+ }
+ float areaScale = area / (width * height);
+ // Use sqrt of the final ratio as the images is scaled across both width and height.
+ float scale = areaScale > scaleRequired ? (float) Math.sqrt(scaleRequired / areaScale) : 1;
+ if (d instanceof AdaptiveIconDrawable && mAdaptiveIconScale == SCALE_NOT_INITIALIZED) {
+ mAdaptiveIconScale = scale;
+ mAdaptiveIconBounds.set(mBounds);
+ }
+ return scale;
+ }
+
+ /**
+ * Modifies {@param xCoordinates} to represent a convex border. Fills in all missing values
+ * (except on either ends) with appropriate values.
+ * @param xCoordinates map of x coordinate per y.
+ * @param direction 1 for left border and -1 for right border.
+ * @param topY the first Y position (inclusive) with a valid value.
+ * @param bottomY the last Y position (inclusive) with a valid value.
+ */
+ private static void convertToConvexArray(
+ float[] xCoordinates, int direction, int topY, int bottomY) {
+ int total = xCoordinates.length;
+ // The tangent at each pixel.
+ float[] angles = new float[total - 1];
+
+ int first = topY; // First valid y coordinate
+ int last = -1; // Last valid y coordinate which didn't have a missing value
+
+ float lastAngle = Float.MAX_VALUE;
+
+ for (int i = topY + 1; i <= bottomY; i++) {
+ if (xCoordinates[i] <= -1) {
+ continue;
+ }
+ int start;
+
+ if (lastAngle == Float.MAX_VALUE) {
+ start = first;
+ } else {
+ float currentAngle = (xCoordinates[i] - xCoordinates[last]) / (i - last);
+ start = last;
+ // If this position creates a concave angle, keep moving up until we find a
+ // position which creates a convex angle.
+ if ((currentAngle - lastAngle) * direction < 0) {
+ while (start > first) {
+ start--;
+ currentAngle = (xCoordinates[i] - xCoordinates[start]) / (i - start);
+ if ((currentAngle - angles[start]) * direction >= 0) {
+ break;
+ }
+ }
+ }
+ }
+
+ // Reset from last check
+ lastAngle = (xCoordinates[i] - xCoordinates[start]) / (i - start);
+ // Update all the points from start.
+ for (int j = start; j < i; j++) {
+ angles[j] = lastAngle;
+ xCoordinates[j] = xCoordinates[start] + lastAngle * (j - start);
+ }
+ last = i;
+ }
+ }
+
+ /* Shadow generator block */
+
+ private static final float KEY_SHADOW_DISTANCE = 1f / 48;
+ private static final int KEY_SHADOW_ALPHA = 61;
+ private static final int AMBIENT_SHADOW_ALPHA = 30;
+
+ private Paint mBlurPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
+ private Paint mDrawPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
+ private BlurMaskFilter mDefaultBlurMaskFilter;
+
+ private synchronized void recreateIcon(Bitmap icon, Canvas out) {
+ recreateIcon(icon, mDefaultBlurMaskFilter, AMBIENT_SHADOW_ALPHA, KEY_SHADOW_ALPHA, out);
+ }
+
+ private synchronized void recreateIcon(Bitmap icon, BlurMaskFilter blurMaskFilter,
+ int ambientAlpha, int keyAlpha, Canvas out) {
+ int[] offset = new int[2];
+ mBlurPaint.setMaskFilter(blurMaskFilter);
+ Bitmap shadow = icon.extractAlpha(mBlurPaint, offset);
+
+ // Draw ambient shadow
+ mDrawPaint.setAlpha(ambientAlpha);
+ out.drawBitmap(shadow, offset[0], offset[1], mDrawPaint);
+
+ // Draw key shadow
+ mDrawPaint.setAlpha(keyAlpha);
+ out.drawBitmap(shadow, offset[0], offset[1] + KEY_SHADOW_DISTANCE * mIconBitmapSize,
+ mDrawPaint);
+
+ // Draw the icon
+ mDrawPaint.setAlpha(255); // TODO if b/128609682 not fixed by launch use .setAlpha(254)
+ out.drawBitmap(icon, 0, 0, mDrawPaint);
+ }
+
+ /* Classes */
+
+ /**
+ * Extension of {@link DrawableWrapper} which scales the child drawables by a fixed amount.
+ */
+ public static class FixedScaleDrawable extends DrawableWrapper {
+
+ private static final float LEGACY_ICON_SCALE = .7f * .6667f;
+ private float mScaleX, mScaleY;
+
+ public FixedScaleDrawable() {
+ super(new ColorDrawable());
+ mScaleX = LEGACY_ICON_SCALE;
+ mScaleY = LEGACY_ICON_SCALE;
+ }
+
+ @Override
+ public void draw(@NonNull Canvas canvas) {
+ int saveCount = canvas.save();
+ canvas.scale(mScaleX, mScaleY,
+ getBounds().exactCenterX(), getBounds().exactCenterY());
+ super.draw(canvas);
+ canvas.restoreToCount(saveCount);
+ }
+
+ @Override
+ public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) { }
+
+ @Override
+ public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme) { }
+
+ /**
+ * Sets the scale associated with this drawable
+ * @param scale
+ */
+ public void setScale(float scale) {
+ float h = getIntrinsicHeight();
+ float w = getIntrinsicWidth();
+ mScaleX = scale * LEGACY_ICON_SCALE;
+ mScaleY = scale * LEGACY_ICON_SCALE;
+ if (h > w && w > 0) {
+ mScaleX *= w / h;
+ } else if (w > h && h > 0) {
+ mScaleY *= h / w;
+ }
+ }
+ }
+
+ /**
+ * An extension of {@link BitmapDrawable} which returns the bitmap pixel size as intrinsic size.
+ * This allows the badging to be done based on the action bitmap size rather than
+ * the scaled bitmap size.
+ */
+ private static class FixedSizeBitmapDrawable extends BitmapDrawable {
+
+ FixedSizeBitmapDrawable(Bitmap bitmap) {
+ super(null, bitmap);
+ }
+
+ @Override
+ public int getIntrinsicHeight() {
+ return getBitmap().getWidth();
+ }
+
+ @Override
+ public int getIntrinsicWidth() {
+ return getBitmap().getWidth();
+ }
+ }
+
+}
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 3655748c83e1..992ddd8f1525 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -412,7 +412,7 @@ public final class Zygote {
return SystemProperties.get(
String.join(".",
"persist.device_config",
- DeviceConfig.RuntimeNative.NAMESPACE,
+ DeviceConfig.NAMESPACE_RUNTIME_NATIVE,
propertyName),
defaultValue);
}
@@ -440,7 +440,7 @@ public final class Zygote {
return SystemProperties.getBoolean(
String.join(".",
"persist.device_config",
- DeviceConfig.RuntimeNative.NAMESPACE,
+ DeviceConfig.NAMESPACE_RUNTIME_NATIVE,
propertyName),
defaultValue);
}
diff --git a/core/java/com/android/internal/os/ZygoteConfig.java b/core/java/com/android/internal/os/ZygoteConfig.java
new file mode 100644
index 000000000000..c8ff51e77866
--- /dev/null
+++ b/core/java/com/android/internal/os/ZygoteConfig.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 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 com.android.internal.os;
+
+/**
+ * Flag names for configuring the zygote.
+ *
+ * @hide
+ */
+public class ZygoteConfig {
+
+ /** If {@code true}, enables the unspecialized app process (USAP) pool feature */
+ public static final String USAP_POOL_ENABLED = "blastula_pool_enabled";
+
+ /** The threshold used to determine if the pool should be refilled */
+ public static final String USAP_POOL_REFILL_THRESHOLD = "blastula_refill_threshold";
+
+ /** The maximum number of processes to keep in the USAP pool */
+ public static final String USAP_POOL_SIZE_MAX = "blastula_pool_size_max";
+
+ /** The minimum number of processes to keep in the USAP pool */
+ public static final String USAP_POOL_SIZE_MIN = "blastula_pool_size_min";
+}
diff --git a/core/java/com/android/internal/os/ZygoteServer.java b/core/java/com/android/internal/os/ZygoteServer.java
index 7abfd85c4f42..3f3aba9b6682 100644
--- a/core/java/com/android/internal/os/ZygoteServer.java
+++ b/core/java/com/android/internal/os/ZygoteServer.java
@@ -22,7 +22,6 @@ import android.net.LocalServerSocket;
import android.net.LocalSocket;
import android.os.SystemClock;
import android.os.Trace;
-import android.provider.DeviceConfig;
import android.system.ErrnoException;
import android.system.Os;
import android.system.StructPollfd;
@@ -242,44 +241,33 @@ class ZygoteServer {
private void fetchUsapPoolPolicyProps() {
if (mUsapPoolSupported) {
- final String usapPoolSizeMaxPropString =
- Zygote.getConfigurationProperty(
- DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MAX,
- USAP_POOL_SIZE_MAX_DEFAULT);
+ final String usapPoolSizeMaxPropString = Zygote.getConfigurationProperty(
+ ZygoteConfig.USAP_POOL_SIZE_MAX, USAP_POOL_SIZE_MAX_DEFAULT);
if (!usapPoolSizeMaxPropString.isEmpty()) {
- mUsapPoolSizeMax =
- Integer.min(
- Integer.parseInt(usapPoolSizeMaxPropString),
- USAP_POOL_SIZE_MAX_LIMIT);
+ mUsapPoolSizeMax = Integer.min(Integer.parseInt(
+ usapPoolSizeMaxPropString), USAP_POOL_SIZE_MAX_LIMIT);
}
- final String usapPoolSizeMinPropString =
- Zygote.getConfigurationProperty(
- DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MIN,
- USAP_POOL_SIZE_MIN_DEFAULT);
+ final String usapPoolSizeMinPropString = Zygote.getConfigurationProperty(
+ ZygoteConfig.USAP_POOL_SIZE_MIN, USAP_POOL_SIZE_MIN_DEFAULT);
if (!usapPoolSizeMinPropString.isEmpty()) {
- mUsapPoolSizeMin =
- Integer.max(
- Integer.parseInt(usapPoolSizeMinPropString),
- USAP_POOL_SIZE_MIN_LIMIT);
+ mUsapPoolSizeMin = Integer.max(
+ Integer.parseInt(usapPoolSizeMinPropString), USAP_POOL_SIZE_MIN_LIMIT);
}
- final String usapPoolRefillThresholdPropString =
- Zygote.getConfigurationProperty(
- DeviceConfig.RuntimeNative.USAP_POOL_REFILL_THRESHOLD,
- Integer.toString(mUsapPoolSizeMax / 2));
+ final String usapPoolRefillThresholdPropString = Zygote.getConfigurationProperty(
+ ZygoteConfig.USAP_POOL_REFILL_THRESHOLD,
+ Integer.toString(mUsapPoolSizeMax / 2));
if (!usapPoolRefillThresholdPropString.isEmpty()) {
- mUsapPoolRefillThreshold =
- Integer.min(
- Integer.parseInt(usapPoolRefillThresholdPropString),
- mUsapPoolSizeMax);
+ mUsapPoolRefillThreshold = Integer.min(
+ Integer.parseInt(usapPoolRefillThresholdPropString),
+ mUsapPoolSizeMax);
}
// Sanity check
-
if (mUsapPoolSizeMin >= mUsapPoolSizeMax) {
Log.w(TAG, "The max size of the USAP pool must be greater than the minimum size."
+ " Restoring default values.");
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index 8f007594dd67..e0b7629013fb 100755
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -206,13 +206,14 @@ jobject createBitmap(JNIEnv* env, Bitmap* bitmap,
// The caller needs to have already set the alpha type properly, so the
// native SkBitmap stays in sync with the Java Bitmap.
assert_premultiplied(bitmap->info(), isPremultiplied);
+ bool fromMalloc = bitmap->pixelStorageType() == PixelStorageType::Heap;
BitmapWrapper* bitmapWrapper = new BitmapWrapper(bitmap);
if (!isMutable) {
bitmapWrapper->bitmap().setImmutable();
}
jobject obj = env->NewObject(gBitmap_class, gBitmap_constructorMethodID,
reinterpret_cast<jlong>(bitmapWrapper), bitmap->width(), bitmap->height(), density,
- isPremultiplied, ninePatchChunk, ninePatchInsets);
+ isPremultiplied, ninePatchChunk, ninePatchInsets, fromMalloc);
if (env->ExceptionCheck() != 0) {
ALOGE("*** Uncaught exception returned from Java call!\n");
@@ -1224,7 +1225,7 @@ int register_android_graphics_Bitmap(JNIEnv* env)
{
gBitmap_class = MakeGlobalRefOrDie(env, FindClassOrDie(env, "android/graphics/Bitmap"));
gBitmap_nativePtr = GetFieldIDOrDie(env, gBitmap_class, "mNativePtr", "J");
- gBitmap_constructorMethodID = GetMethodIDOrDie(env, gBitmap_class, "<init>", "(JIIIZ[BLandroid/graphics/NinePatch$InsetStruct;)V");
+ gBitmap_constructorMethodID = GetMethodIDOrDie(env, gBitmap_class, "<init>", "(JIIIZ[BLandroid/graphics/NinePatch$InsetStruct;Z)V");
gBitmap_reinitMethodID = GetMethodIDOrDie(env, gBitmap_class, "reinit", "(IIZ)V");
gBitmap_getAllocationByteCountMethodID = GetMethodIDOrDie(env, gBitmap_class, "getAllocationByteCount", "()I");
return android::RegisterMethodsOrDie(env, "android/graphics/Bitmap", gBitmapMethods,
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 587d6772abb6..c7417bffb790 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -1517,6 +1517,13 @@
<permission android:name="android.permission.MANAGE_IPSEC_TUNNELS"
android:protectionLevel="signature|appop" />
+ <!-- @hide Allows apps to create and manage Test Networks.
+ <p>Granted only to shell. CTS tests will use
+ UiAutomation.AdoptShellPermissionIdentity() to gain access.
+ -->
+ <permission android:name="android.permission.MANAGE_TEST_NETWORKS"
+ android:protectionLevel="signature" />
+
<!-- @SystemApi @hide Allows applications to read Wi-Fi credential.
<p>Not for use by third-party applications. -->
<permission android:name="android.permission.READ_WIFI_CREDENTIAL"
diff --git a/packages/SystemUI/res/layout/assistant_handle.xml b/core/res/res/drawable/iconfactory_adaptive_icon_drawable_wrapper.xml
index a952ca5e596f..3dd276dfdaac 100644
--- a/packages/SystemUI/res/layout/assistant_handle.xml
+++ b/core/res/res/drawable/iconfactory_adaptive_icon_drawable_wrapper.xml
@@ -15,11 +15,10 @@
~ limitations under the License
-->
-<com.android.systemui.statusbar.phone.NavigationHandle
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/assistant_handle"
- android:layout_width="@dimen/navigation_assistant_handle_width"
- android:layout_height="match_parent"
- android:layout_weight="0"
-/>
-
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@color/white"/>
+ <foreground>
+ <drawable
+ class="com.android.internal.app.SimpleIconFactory$FixedScaleDrawable"/>
+ </foreground>
+</adaptive-icon> \ No newline at end of file
diff --git a/core/res/res/layout/chooser_grid.xml b/core/res/res/layout/chooser_grid.xml
index 10798ad51792..2860ee478db8 100644
--- a/core/res/res/layout/chooser_grid.xml
+++ b/core/res/res/layout/chooser_grid.xml
@@ -70,209 +70,6 @@
android:layout_centerHorizontal="true"/>
</RelativeLayout>
- <!-- The following 3 layouts are mutually exclusive. One of them will be
- set VISIBLE programatically, when the optimal preview type can be
- determined by inspecting the data being shared. This path was chosen
- b/c inflating layouts in code had sizing problems with this widget. -->
-
- <!-- Layout Option 1: Supporting up to 3 images for preview -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:background="?attr/colorBackgroundFloating">
- <RelativeLayout
- android:id="@+id/content_preview_image_area"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:paddingBottom="@dimen/chooser_view_spacing"
- android:visibility="gone"
- android:background="?attr/colorBackgroundFloating">
-
- <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
- android:id="@+id/content_preview_image_1_large"
- android:visibility="gone"
- android:layout_width="120dp"
- android:layout_height="140dp"
- android:layout_alignParentTop="true"
- android:adjustViewBounds="true"
- android:gravity="center"
- android:scaleType="centerCrop"/>
-
- <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
- android:id="@+id/content_preview_image_2_large"
- android:visibility="gone"
- android:layout_width="120dp"
- android:layout_height="140dp"
- android:layout_alignParentTop="true"
- android:layout_toRightOf="@id/content_preview_image_1_large"
- android:layout_marginLeft="10dp"
- android:adjustViewBounds="true"
- android:gravity="center"
- android:scaleType="centerCrop"/>
-
- <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
- android:id="@+id/content_preview_image_2_small"
- android:visibility="gone"
- android:layout_width="120dp"
- android:layout_height="65dp"
- android:layout_alignParentTop="true"
- android:layout_toRightOf="@id/content_preview_image_1_large"
- android:layout_marginLeft="10dp"
- android:adjustViewBounds="true"
- android:gravity="center"
- android:scaleType="centerCrop"/>
-
- <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
- android:id="@+id/content_preview_image_3_small"
- android:visibility="gone"
- android:layout_width="120dp"
- android:layout_height="65dp"
- android:layout_below="@id/content_preview_image_2_small"
- android:layout_toRightOf="@id/content_preview_image_1_large"
- android:layout_marginLeft="10dp"
- android:layout_marginTop="10dp"
- android:adjustViewBounds="true"
- android:gravity="center"
- android:scaleType="centerCrop"/>
-
- </RelativeLayout>
- </LinearLayout>
-
- <!-- Layout Option 2: Text preview, with optional title and thumbnail -->
- <LinearLayout
- android:id="@+id/content_preview_text_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingBottom="@dimen/chooser_view_spacing"
- android:visibility="gone"
- android:background="?attr/colorBackgroundFloating">
-
- <LinearLayout
- android:layout_width="@dimen/chooser_preview_width"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="horizontal"
- android:paddingLeft="@dimen/chooser_edge_margin_normal"
- android:paddingRight="@dimen/chooser_edge_margin_normal"
- android:layout_marginBottom="@dimen/chooser_view_spacing"
- android:id="@+id/content_preview_text_layout">
- <TextView
- android:id="@+id/content_preview_text"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:ellipsize="end"
- android:gravity="start|top"
- android:paddingRight="24dp"
- android:maxLines="2"/>
- <Button
- android:id="@+id/copy_button"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:gravity="center"
- android:layout_gravity="center_vertical"
- android:background="@drawable/ic_content_copy_gm2"/>
- </LinearLayout>
-
- <!-- Required sub-layout so we can get the nice rounded corners-->
- <!-- around this section -->
- <LinearLayout
- android:layout_width="@dimen/chooser_preview_width"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="horizontal"
- android:layout_marginLeft="@dimen/chooser_edge_margin_thin"
- android:layout_marginRight="@dimen/chooser_edge_margin_thin"
- android:minHeight="80dp"
- android:background="@drawable/chooser_content_preview_rounded"
- android:id="@+id/content_preview_title_layout">
-
- <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
- android:id="@+id/content_preview_thumbnail"
- android:layout_width="75dp"
- android:layout_height="75dp"
- android:layout_marginRight="16dp"
- android:adjustViewBounds="true"
- android:layout_gravity="center_vertical"
- android:gravity="center"
- android:scaleType="centerCrop"/>
-
- <TextView
- android:id="@+id/content_preview_title"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:ellipsize="end"
- android:maxLines="2"
- android:textAppearance="?attr/textAppearanceMedium"/>
- </LinearLayout>
- </LinearLayout>
-
- <!-- Layout Option 3: File preview, icon, filename, copy-->
- <LinearLayout
- android:id="@+id/content_preview_file_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingBottom="@dimen/chooser_view_spacing"
- android:visibility="gone"
- android:background="?attr/colorBackgroundFloating">
-
- <LinearLayout
- android:layout_width="@dimen/chooser_preview_width"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="horizontal"
- android:paddingLeft="@dimen/chooser_edge_margin_normal"
- android:paddingRight="@dimen/chooser_edge_margin_normal"
- android:layout_marginBottom="@dimen/chooser_view_spacing"
- android:id="@+id/content_preview_file_layout">
-
- <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
- android:id="@+id/content_preview_file_thumbnail"
- android:layout_width="75dp"
- android:layout_height="75dp"
- android:layout_marginRight="16dp"
- android:adjustViewBounds="true"
- android:layout_gravity="center_vertical"
- android:gravity="center"
- android:scaleType="centerCrop"
- android:visibility="gone"/>
- <ImageView
- android:id="@+id/content_preview_file_icon"
- android:layout_width="36dp"
- android:layout_height="36dp"
- android:layout_marginRight="16dp"
- android:adjustViewBounds="true"
- android:layout_gravity="center_vertical"
- android:gravity="center"
- android:scaleType="fitCenter"
- android:visibility="gone"/>
- <TextView
- android:id="@+id/content_preview_filename"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:ellipsize="middle"
- android:gravity="start|top"
- android:paddingRight="24dp"
- android:singleLine="true"/>
- <Button
- android:id="@+id/file_copy_button"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:gravity="center"
- android:layout_gravity="center_vertical"
- android:background="@drawable/ic_content_copy_gm2"/>
- </LinearLayout>
- </LinearLayout>
-
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/core/res/res/layout/chooser_grid_preview_file.xml b/core/res/res/layout/chooser_grid_preview_file.xml
new file mode 100644
index 000000000000..27c6041ba257
--- /dev/null
+++ b/core/res/res/layout/chooser_grid_preview_file.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright 2019, 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.
+*/
+-->
+<!-- Layout Option: File preview, icon, filename, copy-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/content_preview_file_area"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/chooser_view_spacing"
+ android:background="?attr/colorBackgroundFloating">
+
+ <LinearLayout
+ android:layout_width="@dimen/chooser_preview_width"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:orientation="horizontal"
+ android:paddingLeft="@dimen/chooser_edge_margin_normal"
+ android:paddingRight="@dimen/chooser_edge_margin_normal"
+ android:layout_marginBottom="@dimen/chooser_view_spacing"
+ android:id="@+id/content_preview_file_layout">
+
+ <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
+ android:id="@+id/content_preview_file_thumbnail"
+ android:layout_width="75dp"
+ android:layout_height="75dp"
+ android:layout_marginRight="16dp"
+ android:adjustViewBounds="true"
+ android:layout_gravity="center_vertical"
+ android:gravity="center"
+ android:scaleType="centerCrop"
+ android:visibility="gone"/>
+ <ImageView
+ android:id="@+id/content_preview_file_icon"
+ android:layout_width="36dp"
+ android:layout_height="36dp"
+ android:layout_marginRight="16dp"
+ android:adjustViewBounds="true"
+ android:layout_gravity="center_vertical"
+ android:gravity="center"
+ android:scaleType="fitCenter"
+ android:visibility="gone"/>
+ <TextView
+ android:id="@+id/content_preview_filename"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:ellipsize="middle"
+ android:gravity="start|top"
+ android:paddingRight="24dp"
+ android:singleLine="true"/>
+ <Button
+ android:id="@+id/file_copy_button"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:gravity="center"
+ android:layout_gravity="center_vertical"
+ android:background="@drawable/ic_content_copy_gm2"/>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/core/res/res/layout/chooser_grid_preview_image.xml b/core/res/res/layout/chooser_grid_preview_image.xml
new file mode 100644
index 000000000000..ad31e0d0c194
--- /dev/null
+++ b/core/res/res/layout/chooser_grid_preview_image.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright 2019, 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.
+*/
+-->
+<!-- Layout Option: Supporting up to 3 images for preview -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:background="?attr/colorBackgroundFloating">
+ <RelativeLayout
+ android:id="@+id/content_preview_image_area"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:paddingBottom="@dimen/chooser_view_spacing"
+ android:background="?attr/colorBackgroundFloating">
+
+ <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
+ android:id="@+id/content_preview_image_1_large"
+ android:visibility="gone"
+ android:layout_width="120dp"
+ android:layout_height="140dp"
+ android:layout_alignParentTop="true"
+ android:adjustViewBounds="true"
+ android:gravity="center"
+ android:scaleType="centerCrop"/>
+
+ <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
+ android:id="@+id/content_preview_image_2_large"
+ android:visibility="gone"
+ android:layout_width="120dp"
+ android:layout_height="140dp"
+ android:layout_alignParentTop="true"
+ android:layout_toRightOf="@id/content_preview_image_1_large"
+ android:layout_marginLeft="10dp"
+ android:adjustViewBounds="true"
+ android:gravity="center"
+ android:scaleType="centerCrop"/>
+
+ <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
+ android:id="@+id/content_preview_image_2_small"
+ android:visibility="gone"
+ android:layout_width="120dp"
+ android:layout_height="65dp"
+ android:layout_alignParentTop="true"
+ android:layout_toRightOf="@id/content_preview_image_1_large"
+ android:layout_marginLeft="10dp"
+ android:adjustViewBounds="true"
+ android:gravity="center"
+ android:scaleType="centerCrop"/>
+
+ <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
+ android:id="@+id/content_preview_image_3_small"
+ android:visibility="gone"
+ android:layout_width="120dp"
+ android:layout_height="65dp"
+ android:layout_below="@id/content_preview_image_2_small"
+ android:layout_toRightOf="@id/content_preview_image_1_large"
+ android:layout_marginLeft="10dp"
+ android:layout_marginTop="10dp"
+ android:adjustViewBounds="true"
+ android:gravity="center"
+ android:scaleType="centerCrop"/>
+
+ </RelativeLayout>
+</LinearLayout>
+
diff --git a/core/res/res/layout/chooser_grid_preview_text.xml b/core/res/res/layout/chooser_grid_preview_text.xml
new file mode 100644
index 000000000000..7cfbb1b2a9a4
--- /dev/null
+++ b/core/res/res/layout/chooser_grid_preview_text.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright 2019, 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.
+*/
+-->
+<!-- Layout Option: Text preview, with optional title and thumbnail -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/content_preview_text_area"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/chooser_view_spacing"
+ android:background="?attr/colorBackgroundFloating">
+
+ <LinearLayout
+ android:layout_width="@dimen/chooser_preview_width"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:orientation="horizontal"
+ android:paddingLeft="@dimen/chooser_edge_margin_normal"
+ android:paddingRight="@dimen/chooser_edge_margin_normal"
+ android:layout_marginBottom="@dimen/chooser_view_spacing"
+ android:id="@+id/content_preview_text_layout">
+ <TextView
+ android:id="@+id/content_preview_text"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:ellipsize="end"
+ android:gravity="start|top"
+ android:paddingRight="24dp"
+ android:maxLines="2"/>
+ <Button
+ android:id="@+id/copy_button"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:gravity="center"
+ android:layout_gravity="center_vertical"
+ android:background="@drawable/ic_content_copy_gm2"/>
+ </LinearLayout>
+
+ <!-- Required sub-layout so we can get the nice rounded corners-->
+ <!-- around this section -->
+ <LinearLayout
+ android:layout_width="@dimen/chooser_preview_width"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:orientation="horizontal"
+ android:layout_marginLeft="@dimen/chooser_edge_margin_thin"
+ android:layout_marginRight="@dimen/chooser_edge_margin_thin"
+ android:minHeight="80dp"
+ android:background="@drawable/chooser_content_preview_rounded"
+ android:id="@+id/content_preview_title_layout">
+
+ <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView"
+ android:id="@+id/content_preview_thumbnail"
+ android:layout_width="75dp"
+ android:layout_height="75dp"
+ android:layout_marginRight="16dp"
+ android:adjustViewBounds="true"
+ android:layout_gravity="center_vertical"
+ android:gravity="center"
+ android:scaleType="centerCrop"/>
+
+ <TextView
+ android:id="@+id/content_preview_title"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:ellipsize="end"
+ android:maxLines="2"
+ android:textAppearance="?attr/textAppearanceMedium"/>
+ </LinearLayout>
+</LinearLayout>
+
diff --git a/core/res/res/layout/resolve_list_item.xml b/core/res/res/layout/resolve_list_item.xml
index 5d5283296f4b..0bdb25a8d307 100644
--- a/core/res/res/layout/resolve_list_item.xml
+++ b/core/res/res/layout/resolve_list_item.xml
@@ -29,8 +29,8 @@
<!-- Activity icon when presenting dialog
Size will be filled in by ResolverActivity -->
<ImageView android:id="@+id/icon"
- android:layout_width="24dp"
- android:layout_height="24dp"
+ android:layout_width="@dimen/resolver_icon_size"
+ android:layout_height="@dimen/resolver_icon_size"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="?attr/listPreferredItemPaddingStart"
android:layout_marginTop="12dp"
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index fafd8fe29f8c..7134eed8dde8 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -723,4 +723,6 @@
<dimen name="chooser_edge_margin_normal">24dp</dimen>
<dimen name="chooser_preview_image_font_size">20sp</dimen>
<dimen name="chooser_preview_width">-1px</dimen>
+ <dimen name="resolver_icon_size">42dp</dimen>
+ <dimen name="resolver_badge_size">18dp</dimen>
</resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 30a11b1efaf2..f9532081f86a 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3374,9 +3374,9 @@
<string name="wifi_available_action_all_networks">All networks</string>
<!-- Notification title for a connection to a app suggested wireless network.-->
- <string name="wifi_suggestion_title">A Wi\u2011Fi network proposed by <xliff:g id="name" example="App123">%s</xliff:g> is available</string>
+ <string name="wifi_suggestion_title">Connect to Wi\u2011Fi networks?</string>
<!-- Notification content for a connection to a app suggested wireless network.-->
- <string name="wifi_suggestion_content">Do you want to connect to networks proposed by <xliff:g id="name" example="App123">%s</xliff:g>?</string>
+ <string name="wifi_suggestion_content">Suggested by <xliff:g id="name" example="App123">%s</xliff:g></string>
<!-- Notification action for allowing app specified in the notification body.-->
<string name="wifi_suggestion_action_allow_app">Yes</string>
<!-- Notification action for disallowing app specified in the notification body.-->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 9cb9dbbddf21..6629b4c7f585 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2762,6 +2762,9 @@
<java-symbol type="dimen" name="chooser_preview_image_font_size"/>
<java-symbol type="dimen" name="chooser_preview_width" />
<java-symbol type="layout" name="chooser_grid" />
+ <java-symbol type="layout" name="chooser_grid_preview_text" />
+ <java-symbol type="layout" name="chooser_grid_preview_image" />
+ <java-symbol type="layout" name="chooser_grid_preview_file" />
<java-symbol type="id" name="chooser_row_text_option" />
<java-symbol type="dimen" name="chooser_row_text_option_translate" />
<java-symbol type="layout" name="resolve_grid_item" />
@@ -3701,4 +3704,9 @@
<!-- For Auto-Brightness -->
<java-symbol type="string" name="config_displayLightSensorType" />
+
+ <java-symbol type="drawable" name="iconfactory_adaptive_icon_drawable_wrapper"/>
+ <java-symbol type="dimen" name="resolver_icon_size"/>
+ <java-symbol type="dimen" name="resolver_badge_size"/>
+
</resources>
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml
index 37913056fe8d..9955c512686a 100644
--- a/core/tests/coretests/AndroidManifest.xml
+++ b/core/tests/coretests/AndroidManifest.xml
@@ -55,6 +55,7 @@
<uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INJECT_EVENTS" />
+ <uses-permission android:name="android.permission.MANAGE_APP_PREDICTIONS"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
<uses-permission android:name="android.permission.READ_DREAM_STATE" />
diff --git a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
index 4277b5a918f7..185fa0750ff1 100644
--- a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
+++ b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
@@ -599,7 +599,7 @@ public class ChooserActivityTest {
mActivityRule.launchActivity(Intent.createChooser(sendIntent, null));
waitForIdle();
- verify(mockLogger, Mockito.times(3)).write(logMakerCaptor.capture());
+ verify(mockLogger, Mockito.times(2)).write(logMakerCaptor.capture());
// First invocation is from onCreate
assertThat(logMakerCaptor.getAllValues().get(1).getCategory(),
is(MetricsEvent.ACTION_SHARE_WITH_PREVIEW));
@@ -629,16 +629,12 @@ public class ChooserActivityTest {
ArgumentCaptor<LogMaker> logMakerCaptor = ArgumentCaptor.forClass(LogMaker.class);
mActivityRule.launchActivity(Intent.createChooser(sendIntent, null));
waitForIdle();
- verify(mockLogger, Mockito.times(3)).write(logMakerCaptor.capture());
+ verify(mockLogger, Mockito.times(2)).write(logMakerCaptor.capture());
// First invocation is from onCreate
assertThat(logMakerCaptor.getAllValues().get(1).getCategory(),
is(MetricsEvent.ACTION_SHARE_WITH_PREVIEW));
assertThat(logMakerCaptor.getAllValues().get(1).getSubtype(),
is(CONTENT_PREVIEW_IMAGE));
- assertThat(logMakerCaptor.getAllValues().get(2).getCategory(),
- is(MetricsEvent.ACTION_SHARE_WITH_PREVIEW));
- assertThat(logMakerCaptor.getAllValues().get(2).getSubtype(),
- is(CONTENT_PREVIEW_IMAGE));
}
@Test
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 2e56e09522e9..4bd344f1964f 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -122,13 +122,22 @@ public final class Bitmap implements Parcelable {
}
/**
- * Private constructor that must received an already allocated native bitmap
+ * Private constructor that must receive an already allocated native bitmap
* int (pointer).
*/
- // called from JNI
- @UnsupportedAppUsage
- Bitmap(long nativeBitmap, int width, int height, int density, boolean requestPremultiplied,
- byte[] ninePatchChunk, NinePatch.InsetStruct ninePatchInsets) {
+ // JNI now calls the version below this one. This is preserved due to UnsupportedAppUsage.
+ @UnsupportedAppUsage(maxTargetSdk = 28)
+ Bitmap(long nativeBitmap, int width, int height, int density,
+ boolean requestPremultiplied, byte[] ninePatchChunk,
+ NinePatch.InsetStruct ninePatchInsets) {
+ this(nativeBitmap, width, height, density, requestPremultiplied, ninePatchChunk,
+ ninePatchInsets, true);
+ }
+
+ // called from JNI and Bitmap_Delegate.
+ Bitmap(long nativeBitmap, int width, int height, int density,
+ boolean requestPremultiplied, byte[] ninePatchChunk,
+ NinePatch.InsetStruct ninePatchInsets, boolean fromMalloc) {
if (nativeBitmap == 0) {
throw new RuntimeException("internal error: native bitmap is 0");
}
@@ -144,13 +153,21 @@ public final class Bitmap implements Parcelable {
}
mNativePtr = nativeBitmap;
- long nativeSize = NATIVE_ALLOCATION_SIZE + getAllocationByteCount();
- NativeAllocationRegistry registry = new NativeAllocationRegistry(
- Bitmap.class.getClassLoader(), nativeGetNativeFinalizer(), nativeSize);
+
+ final int allocationByteCount = getAllocationByteCount();
+ NativeAllocationRegistry registry;
+ if (fromMalloc) {
+ registry = NativeAllocationRegistry.createMalloced(
+ Bitmap.class.getClassLoader(), nativeGetNativeFinalizer(), allocationByteCount);
+ } else {
+ registry = NativeAllocationRegistry.createNonmalloced(
+ Bitmap.class.getClassLoader(), nativeGetNativeFinalizer(), allocationByteCount);
+ }
registry.registerNativeAllocation(this, nativeBitmap);
if (ResourcesImpl.TRACE_FOR_DETAILED_PRELOAD) {
sPreloadTracingNumInstantiatedBitmaps++;
+ long nativeSize = NATIVE_ALLOCATION_SIZE + allocationByteCount;
sPreloadTracingTotalBitmapsSize += nativeSize;
}
}
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 8f46e1acc2ba..7b3f3da111d5 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -76,14 +76,11 @@ public class Canvas extends BaseCanvas {
// (see SkCanvas.cpp, SkDraw.cpp)
private static final int MAXMIMUM_BITMAP_SIZE = 32766;
- // The approximate size of the native allocation associated with
- // a Canvas object.
- private static final long NATIVE_ALLOCATION_SIZE = 525;
-
// Use a Holder to allow static initialization of Canvas in the boot image.
private static class NoImagePreloadHolder {
- public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- Canvas.class.getClassLoader(), nGetNativeFinalizer(), NATIVE_ALLOCATION_SIZE);
+ public static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ Canvas.class.getClassLoader(), nGetNativeFinalizer());
}
// This field is used to finalize the native Canvas properly
diff --git a/graphics/java/android/graphics/ColorFilter.java b/graphics/java/android/graphics/ColorFilter.java
index b24b9885d1b0..4c2ef84404e2 100644
--- a/graphics/java/android/graphics/ColorFilter.java
+++ b/graphics/java/android/graphics/ColorFilter.java
@@ -26,8 +26,9 @@ import libcore.util.NativeAllocationRegistry;
public class ColorFilter {
private static class NoImagePreloadHolder {
- public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- ColorFilter.class.getClassLoader(), nativeGetFinalizer(), 50);
+ public static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ ColorFilter.class.getClassLoader(), nativeGetFinalizer());
}
/**
diff --git a/graphics/java/android/graphics/FontFamily.java b/graphics/java/android/graphics/FontFamily.java
index 5d8ba938f6d5..5af0da85bb39 100644
--- a/graphics/java/android/graphics/FontFamily.java
+++ b/graphics/java/android/graphics/FontFamily.java
@@ -44,13 +44,15 @@ public class FontFamily {
private static String TAG = "FontFamily";
- private static final NativeAllocationRegistry sBuilderRegistry = new NativeAllocationRegistry(
- FontFamily.class.getClassLoader(), nGetBuilderReleaseFunc(), 64);
+ private static final NativeAllocationRegistry sBuilderRegistry =
+ NativeAllocationRegistry.createMalloced(
+ FontFamily.class.getClassLoader(), nGetBuilderReleaseFunc());
private @Nullable Runnable mNativeBuilderCleaner;
- private static final NativeAllocationRegistry sFamilyRegistry = new NativeAllocationRegistry(
- FontFamily.class.getClassLoader(), nGetFamilyReleaseFunc(), 64);
+ private static final NativeAllocationRegistry sFamilyRegistry =
+ NativeAllocationRegistry.createMalloced(
+ FontFamily.class.getClassLoader(), nGetFamilyReleaseFunc());
/**
* @hide
diff --git a/graphics/java/android/graphics/Matrix.java b/graphics/java/android/graphics/Matrix.java
index f8cb366c7b92..22b6401fdc2e 100644
--- a/graphics/java/android/graphics/Matrix.java
+++ b/graphics/java/android/graphics/Matrix.java
@@ -16,12 +16,13 @@
package android.graphics;
+import android.annotation.UnsupportedAppUsage;
+
import dalvik.annotation.optimization.CriticalNative;
import dalvik.annotation.optimization.FastNative;
import libcore.util.NativeAllocationRegistry;
-import android.annotation.UnsupportedAppUsage;
import java.io.PrintWriter;
/**
@@ -222,12 +223,10 @@ public class Matrix {
}
};
- // sizeof(SkMatrix) is 9 * sizeof(float) + uint32_t
- private static final long NATIVE_ALLOCATION_SIZE = 40;
-
private static class NoImagePreloadHolder {
- public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- Matrix.class.getClassLoader(), nGetNativeFinalizer(), NATIVE_ALLOCATION_SIZE);
+ public static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ Matrix.class.getClassLoader(), nGetNativeFinalizer());
}
/**
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 452f7c93f8aa..650865d442c2 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -58,13 +58,11 @@ public class Paint {
private long mNativeShader;
private long mNativeColorFilter;
- // The approximate size of a native paint object.
- private static final long NATIVE_PAINT_SIZE = 98;
-
// Use a Holder to allow static initialization of Paint in the boot image.
private static class NoImagePreloadHolder {
- public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- Paint.class.getClassLoader(), nGetNativeFinalizer(), NATIVE_PAINT_SIZE);
+ public static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ Paint.class.getClassLoader(), nGetNativeFinalizer());
}
@ColorLong private long mColor;
@@ -231,7 +229,8 @@ public class Paint {
public static final int VERTICAL_TEXT_FLAG = 0x1000;
// These flags are always set on a new/reset paint, even if flags 0 is passed.
- static final int HIDDEN_DEFAULT_PAINT_FLAGS = DEV_KERN_TEXT_FLAG | EMBEDDED_BITMAP_TEXT_FLAG;
+ static final int HIDDEN_DEFAULT_PAINT_FLAGS = DEV_KERN_TEXT_FLAG | EMBEDDED_BITMAP_TEXT_FLAG
+ | FILTER_BITMAP_FLAG;
/**
* Font hinter option that disables font hinting.
diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java
index 405ab0bbcb34..7282d52d6e23 100644
--- a/graphics/java/android/graphics/Path.java
+++ b/graphics/java/android/graphics/Path.java
@@ -36,8 +36,9 @@ import libcore.util.NativeAllocationRegistry;
*/
public class Path {
- private static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- Path.class.getClassLoader(), nGetFinalizer(), 48 /* dummy size */);
+ private static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ Path.class.getClassLoader(), nGetFinalizer());
/**
* @hide
diff --git a/graphics/java/android/graphics/RenderNode.java b/graphics/java/android/graphics/RenderNode.java
index 611111056263..9b4f2c1b51d5 100644
--- a/graphics/java/android/graphics/RenderNode.java
+++ b/graphics/java/android/graphics/RenderNode.java
@@ -195,8 +195,9 @@ public final class RenderNode {
// Use a Holder to allow static initialization in the boot image.
private static class NoImagePreloadHolder {
- public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- RenderNode.class.getClassLoader(), nGetNativeFinalizer(), 1024);
+ public static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ RenderNode.class.getClassLoader(), nGetNativeFinalizer());
}
/**
diff --git a/graphics/java/android/graphics/Shader.java b/graphics/java/android/graphics/Shader.java
index d555128d0bba..3050d1dae5e4 100644
--- a/graphics/java/android/graphics/Shader.java
+++ b/graphics/java/android/graphics/Shader.java
@@ -33,8 +33,9 @@ import libcore.util.NativeAllocationRegistry;
public class Shader {
private static class NoImagePreloadHolder {
- public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- Shader.class.getClassLoader(), nativeGetFinalizer(), 50);
+ public static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ Shader.class.getClassLoader(), nativeGetFinalizer());
}
/**
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index 86f658b4a48e..64f75913f8de 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -74,8 +74,9 @@ public class Typeface {
private static String TAG = "Typeface";
- private static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- Typeface.class.getClassLoader(), nativeGetReleaseFunc(), 64);
+ private static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ Typeface.class.getClassLoader(), nativeGetReleaseFunc());
/** The default NORMAL typeface object */
public static final Typeface DEFAULT;
diff --git a/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java b/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java
index bb6bf243bc76..82f587086428 100644
--- a/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java
@@ -313,7 +313,7 @@ public class AnimatedImageDrawable extends Drawable implements Animatable2 {
extended, cropRect), inputStream, afd);
final long nativeSize = nNativeByteSize(mState.mNativePtr);
- NativeAllocationRegistry registry = new NativeAllocationRegistry(
+ NativeAllocationRegistry registry = NativeAllocationRegistry.createMalloced(
AnimatedImageDrawable.class.getClassLoader(), nGetNativeFinalizer(), nativeSize);
registry.registerNativeAllocation(mState, mState.mNativePtr);
}
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
index d7aee7767524..d9dab98c2be1 100644
--- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
@@ -1253,7 +1253,6 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable2 {
private boolean mInitialized = false;
private boolean mIsReversible = false;
private boolean mIsInfinite = false;
- // TODO: Consider using NativeAllocationRegistery to track native allocation
private final VirtualRefBasePtr mSetRefBasePtr;
private WeakReference<RenderNode> mLastSeenTarget = null;
private int mLastListenerId = 0;
diff --git a/graphics/java/android/graphics/fonts/Font.java b/graphics/java/android/graphics/fonts/Font.java
index c788f324a23f..b8574654e95a 100644
--- a/graphics/java/android/graphics/fonts/Font.java
+++ b/graphics/java/android/graphics/fonts/Font.java
@@ -54,13 +54,13 @@ public final class Font {
* A builder class for creating new Font.
*/
public static final class Builder {
- private static final NativeAllocationRegistry sAssetByteBufferRegistroy =
- new NativeAllocationRegistry(ByteBuffer.class.getClassLoader(),
- nGetReleaseNativeAssetFunc(), 64);
+ private static final NativeAllocationRegistry sAssetByteBufferRegistry =
+ NativeAllocationRegistry.createMalloced(ByteBuffer.class.getClassLoader(),
+ nGetReleaseNativeAssetFunc());
- private static final NativeAllocationRegistry sFontRegistory =
- new NativeAllocationRegistry(Font.class.getClassLoader(),
- nGetReleaseNativeFont(), 64);
+ private static final NativeAllocationRegistry sFontRegistry =
+ NativeAllocationRegistry.createMalloced(Font.class.getClassLoader(),
+ nGetReleaseNativeFont());
private @Nullable ByteBuffer mBuffer;
private @Nullable File mFile;
@@ -171,7 +171,7 @@ public final class Font {
return;
}
final ByteBuffer b = nGetAssetBuffer(nativeAsset);
- sAssetByteBufferRegistroy.registerNativeAllocation(b, nativeAsset);
+ sAssetByteBufferRegistry.registerNativeAllocation(b, nativeAsset);
if (b == null) {
mException = new FileNotFoundException(path + " not found");
return;
@@ -206,7 +206,7 @@ public final class Font {
return;
}
final ByteBuffer b = nGetAssetBuffer(nativeAsset);
- sAssetByteBufferRegistroy.registerNativeAllocation(b, nativeAsset);
+ sAssetByteBufferRegistry.registerNativeAllocation(b, nativeAsset);
if (b == null) {
mException = new FileNotFoundException(str + " not found");
return;
@@ -395,7 +395,7 @@ public final class Font {
mTtcIndex);
final Font font = new Font(ptr, readonlyBuffer, mFile,
new FontStyle(mWeight, slant), mTtcIndex, mAxes, mLocaleList);
- sFontRegistory.registerNativeAllocation(font, ptr);
+ sFontRegistry.registerNativeAllocation(font, ptr);
return font;
}
diff --git a/graphics/java/android/graphics/fonts/FontFamily.java b/graphics/java/android/graphics/fonts/FontFamily.java
index 4772c1cff7eb..75ea12062929 100644
--- a/graphics/java/android/graphics/fonts/FontFamily.java
+++ b/graphics/java/android/graphics/fonts/FontFamily.java
@@ -63,8 +63,8 @@ public final class FontFamily {
*/
public static final class Builder {
private static final NativeAllocationRegistry sFamilyRegistory =
- new NativeAllocationRegistry(FontFamily.class.getClassLoader(),
- nGetReleaseNativeFamily(), 64);
+ NativeAllocationRegistry.createMalloced(FontFamily.class.getClassLoader(),
+ nGetReleaseNativeFamily());
private final ArrayList<Font> mFonts = new ArrayList<>();
private final HashSet<Integer> mStyleHashSet = new HashSet<>();
diff --git a/graphics/java/android/graphics/text/LineBreaker.java b/graphics/java/android/graphics/text/LineBreaker.java
index 2a3627617c07..54622c5e74df 100644
--- a/graphics/java/android/graphics/text/LineBreaker.java
+++ b/graphics/java/android/graphics/text/LineBreaker.java
@@ -69,7 +69,7 @@ import java.lang.annotation.RetentionPolicy;
* }
*
* // Draw text to the canvas
- * Bitmap bmp = new Bitmap.createBitmap(240, totalHeight, Bitmap.Config.ARGB_8888);
+ * Bitmap bmp = Bitmap.createBitmap(240, totalHeight, Bitmap.Config.ARGB_8888);
* Canvas c = new Canvas(bmp);
* float yOffset = 0f;
* int prevOffset = 0;
@@ -349,8 +349,9 @@ public class LineBreaker {
private static final int END_HYPHEN_MASK = 0x7; // 0b00111
private static final int START_HYPHEN_BITS_SHIFT = 3;
- private static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- Result.class.getClassLoader(), nGetReleaseResultFunc(), 32);
+ private static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ Result.class.getClassLoader(), nGetReleaseResultFunc());
private final long mPtr;
private Result(long ptr) {
@@ -444,8 +445,9 @@ public class LineBreaker {
}
}
- private static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- LineBreaker.class.getClassLoader(), nGetReleaseFunc(), 64);
+ private static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ LineBreaker.class.getClassLoader(), nGetReleaseFunc());
private final long mNativePtr;
diff --git a/graphics/java/android/graphics/text/MeasuredText.java b/graphics/java/android/graphics/text/MeasuredText.java
index 480aff289dfc..66bcd8650b95 100644
--- a/graphics/java/android/graphics/text/MeasuredText.java
+++ b/graphics/java/android/graphics/text/MeasuredText.java
@@ -169,8 +169,9 @@ public class MeasuredText {
* Note: The appendStyle and appendReplacementRun should be called to cover the text length.
*/
public static final class Builder {
- private static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
- MeasuredText.class.getClassLoader(), nGetReleaseFunc(), 1024);
+ private static final NativeAllocationRegistry sRegistry =
+ NativeAllocationRegistry.createMalloced(
+ MeasuredText.class.getClassLoader(), nGetReleaseFunc());
private long mNativePtr;
diff --git a/libs/hwui/hwui/Bitmap.cpp b/libs/hwui/hwui/Bitmap.cpp
index 3bbee18c6dd1..219d04055eae 100644
--- a/libs/hwui/hwui/Bitmap.cpp
+++ b/libs/hwui/hwui/Bitmap.cpp
@@ -287,6 +287,8 @@ size_t Bitmap::getAllocationByteCount() const {
switch (mPixelStorageType) {
case PixelStorageType::Heap:
return mPixelStorage.heap.size;
+ case PixelStorageType::Ashmem:
+ return mPixelStorage.ashmem.size;
default:
return rowBytes() * height();
}
diff --git a/libs/hwui/hwui/Bitmap.h b/libs/hwui/hwui/Bitmap.h
index 01e45166e0a3..dd98b25ac7e8 100644
--- a/libs/hwui/hwui/Bitmap.h
+++ b/libs/hwui/hwui/Bitmap.h
@@ -103,6 +103,8 @@ public:
bool isHardware() const { return mPixelStorageType == PixelStorageType::Hardware; }
+ PixelStorageType pixelStorageType() const { return mPixelStorageType; }
+
GraphicBuffer* graphicBuffer();
/**
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 9491ac2d0adc..dd179f3e9bab 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -1360,10 +1360,10 @@ public class LocationManager {
@NonNull String provider, boolean enabled, @NonNull UserHandle userHandle) {
checkProvider(provider);
- return Settings.Secure.setLocationProviderEnabledForUser(
+ return Settings.Secure.putStringForUser(
mContext.getContentResolver(),
- provider,
- enabled,
+ Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
+ (enabled ? "+" : "-") + provider,
userHandle.getIdentifier());
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java
index 274acad2b1e4..36bb8ef62320 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java
@@ -16,10 +16,6 @@
package com.android.providers.settings;
-import android.os.Process;
-import com.android.internal.app.LocalePicker;
-import com.android.internal.annotations.VisibleForTesting;
-
import android.annotation.NonNull;
import android.app.ActivityManager;
import android.app.IActivityManager;
@@ -30,7 +26,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.icu.util.ULocale;
-import android.location.LocationManager;
import android.media.AudioManager;
import android.media.RingtoneManager;
import android.net.Uri;
@@ -38,13 +33,14 @@ import android.os.LocaleList;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.os.UserManager;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.ArraySet;
-import java.lang.IllegalArgumentException;
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.app.LocalePicker;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
@@ -145,9 +141,6 @@ public class SettingsHelper {
if (Settings.System.SOUND_EFFECTS_ENABLED.equals(name)) {
setSoundEffects(Integer.parseInt(value) == 1);
// fall through to the ordinary write to settings
- } else if (Settings.Secure.LOCATION_PROVIDERS_ALLOWED.equals(name)) {
- setGpsLocation(value);
- return;
} else if (Settings.Secure.BACKUP_AUTO_RESTORE.equals(name)) {
setAutoRestore(Integer.parseInt(value) == 1);
} else if (isAlreadyConfiguredCriticalAccessibilitySetting(name)) {
@@ -297,21 +290,6 @@ public class SettingsHelper {
} catch (RemoteException e) {}
}
- private void setGpsLocation(String value) {
- UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
- if (um.hasUserRestriction(UserManager.DISALLOW_SHARE_LOCATION)) {
- return;
- }
- final String GPS = LocationManager.GPS_PROVIDER;
- boolean enabled =
- GPS.equals(value) ||
- value.startsWith(GPS + ",") ||
- value.endsWith("," + GPS) ||
- value.contains("," + GPS + ",");
- LocationManager lm = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
- lm.setProviderEnabledForUser(GPS, enabled, Process.myUserHandle());
- }
-
private void setSoundEffects(boolean enable) {
if (enable) {
mAudioManager.loadSoundEffects();
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index fc6ef2bcede2..d639e5eca43d 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -175,6 +175,9 @@
<uses-permission android:name="android.permission.MANAGE_APPOPS" />
+ <!-- Permission needed to run network tests in CTS -->
+ <uses-permission android:name="android.permission.MANAGE_TEST_NETWORKS" />
+
<application android:label="@string/app_label"
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true">
diff --git a/packages/SystemUI/res/layout/notification_info.xml b/packages/SystemUI/res/layout/notification_info.xml
index 725ace403ba3..0d44931463bd 100644
--- a/packages/SystemUI/res/layout/notification_info.xml
+++ b/packages/SystemUI/res/layout/notification_info.xml
@@ -255,6 +255,7 @@ asked for it -->
android:layout_width="40dp"
android:layout_height="40dp"
android:clickable="false"
+ android:contentDescription="@string/inline_block_button"
android:tint="@color/GM2_grey_400"
style="@style/TextAppearance.NotificationInfo.Button"/>
</FrameLayout>
@@ -289,6 +290,7 @@ asked for it -->
android:layout_width="40dp"
android:layout_height="40dp"
android:clickable="false"
+ android:contentDescription="@string/inline_silent_button_silent"
android:tint="@color/GM2_grey_400"
style="@style/TextAppearance.NotificationInfo.Button"/>
</FrameLayout>
@@ -322,6 +324,7 @@ asked for it -->
android:layout_gravity="center"
android:layout_width="40dp"
android:layout_height="40dp"
+ android:contentDescription="@string/inline_silent_button_alert"
android:clickable="false"
android:tint="@color/GM2_grey_400"
style="@style/TextAppearance.NotificationInfo.Button"/>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 8b4f66de2f92..f8295ebff027 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -330,7 +330,7 @@
<!-- Nav bar button default ordering/layout -->
<string name="config_navBarLayout" translatable="false">left[.5W],back[1WC];home;recent[1WC],right[.5W]</string>
<string name="config_navBarLayoutQuickstep" translatable="false">back[1.7WC];home;contextual[1.7WC]</string>
- <string name="config_navBarLayoutHandle" translatable="false">";home_handle;assistant_handle[.18WC]"</string>
+ <string name="config_navBarLayoutHandle" translatable="false">";home_handle;"</string>
<bool name="quick_settings_show_full_alarm">false</bool>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 521d1eaa54a6..30cbaaad33df 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -34,11 +34,10 @@
<dimen name="navigation_bar_deadzone_size_max">32dp</dimen>
<!-- dimensions for the navigation bar handle -->
- <dimen name="navigation_handle_radius">2dp</dimen>
- <dimen name="navigation_handle_bottom">8dp</dimen>
+ <dimen name="navigation_handle_radius">1dp</dimen>
+ <dimen name="navigation_handle_bottom">6dp</dimen>
<dimen name="navigation_handle_horizontal_margin">30dp</dimen>
- <dimen name="navigation_home_handle_width">180dp</dimen>
- <dimen name="navigation_assistant_handle_width">36dp</dimen>
+ <dimen name="navigation_home_handle_width">280dp</dimen>
<!-- Height of notification icons in the status bar -->
<dimen name="status_bar_icon_size">@*android:dimen/status_bar_icon_size</dimen>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 97160b6a6f2c..63f8cd6d2025 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -105,11 +105,6 @@ import java.util.function.Consumer;
* Watches for updates that may be interesting to the keyguard, and provides
* the up to date information as well as a registration for callbacks that care
* to be updated.
- *
- * Note: under time crunch, this has been extended to include some stuff that
- * doesn't really belong here. see {@link #handleBatteryUpdate} where it shutdowns
- * the device, and {@link #getFailedUnlockAttempts()}, {@link #reportFailedAttempt()}
- * and {@link #clearFailedUnlockAttempts()}. Maybe we should rename this 'KeyguardContext'...
*/
public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
@@ -1568,6 +1563,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
updateFaceListeningState();
}
+ /**
+ * Requests face authentication if we're on a state where it's allowed.
+ * This will re-trigger auth in case it fails.
+ */
+ public void requestFaceAuth() {
+ if (DEBUG) Log.d(TAG, "requestFaceAuth()");
+ updateFaceListeningState();
+ }
+
private void updateFaceListeningState() {
// If this message exists, we should not authenticate again until this message is
// consumed by the handler
@@ -1629,7 +1633,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
return;
}
if (DEBUG) Log.v(TAG, "startListeningForFingerprint()");
- int userId = ActivityManager.getCurrentUser();
+ int userId = getCurrentUser();
if (isUnlockWithFingerprintPossible(userId)) {
if (mFingerprintCancelSignal != null) {
mFingerprintCancelSignal.cancel();
@@ -1647,7 +1651,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
return;
}
if (DEBUG) Log.v(TAG, "startListeningForFace()");
- int userId = ActivityManager.getCurrentUser();
+ int userId = getCurrentUser();
if (isUnlockWithFacePossible(userId)) {
if (mFaceCancelSignal != null) {
mFaceCancelSignal.cancel();
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/ImageClock.java b/packages/SystemUI/src/com/android/keyguard/clock/ImageClock.java
index 22753805c95e..95f100433137 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/ImageClock.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/ImageClock.java
@@ -59,7 +59,7 @@ public class ImageClock extends FrameLayout {
*/
public void onTimeChanged() {
mTime.setTimeInMillis(System.currentTimeMillis());
- final float hourAngle = mTime.get(Calendar.HOUR) * 30f;
+ final float hourAngle = mTime.get(Calendar.HOUR) * 30f + mTime.get(Calendar.MINUTE) * 0.5f;
mHourHand.setRotation(hourAngle);
final float minuteAngle = mTime.get(Calendar.MINUTE) * 6f;
mMinuteHand.setRotation(minuteAngle);
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClock.java b/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClock.java
index 34c855bc33d3..8cdd6325638e 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClock.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/StretchAnalogClock.java
@@ -103,7 +103,8 @@ public class StretchAnalogClock extends View {
final float centerY = getHeight() / 2f;
final float minutesRotation = mTime.get(Calendar.MINUTE) * 6f;
- final float hoursRotation = (mTime.get(Calendar.HOUR) * 30);
+ final float hoursRotation = mTime.get(Calendar.HOUR) * 30
+ + mTime.get(Calendar.MINUTE) * 0.5f;
// Compute length of clock hands. Hour hand is 60% the length from center to edge
// and minute hand is twice the length to make sure it extends past screen edge.
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index ff68d2be087e..97a277b5236a 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -14,6 +14,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.PixelFormat;
+import android.graphics.Rect;
import android.os.AsyncTask;
import android.os.Binder;
import android.os.Bundle;
@@ -173,6 +174,26 @@ public class AssistManager implements ConfigurationChangedReceiver {
startAssistInternal(args, assistComponent, isService);
}
+ /**
+ * Returns a {@code Rect} containing system UI presented on behalf of the assistant that
+ * consumes touches.
+ */
+ @Nullable
+ public Rect getTouchableRegion() {
+ // intentional no-op, vendor's AssistManager implementation should override if needed.
+ return null;
+ }
+
+ /** Registers a listener for changes to system UI presented on behalf of the assistant. */
+ public void setAssistSysUiChangeListener(AssistSysUiChangeListener listener) {
+ // intentional no-op, vendor's AssistManager implementation should override if needed.
+ }
+
+ /** Returns {@code true} if the system UI is showing UI for the assistant. */
+ public boolean hasAssistUi() {
+ return false;
+ }
+
public void hideAssist() {
mAssistUtils.hideCurrentSession();
}
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistSysUiChangeListener.java b/packages/SystemUI/src/com/android/systemui/assist/AssistSysUiChangeListener.java
new file mode 100644
index 000000000000..d03afb6e4ebd
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistSysUiChangeListener.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.assist;
+
+/**
+ * Used to notify when system UI is showing UI for the assistant.
+ */
+public interface AssistSysUiChangeListener {
+
+ /** Called when the visibility of system UI for the assistant has changed. */
+ void onChange(boolean isVisible);
+
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index dfbb32e451d6..8faeb155b1e6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -664,6 +664,9 @@ public class KeyguardIndicationController implements StateListener {
public void onBiometricRunningStateChanged(boolean running,
BiometricSourceType biometricSourceType) {
if (running) {
+ // Let's hide any previous messages when authentication starts, otherwise
+ // multiple auth attempts would overlap.
+ hideTransientIndication();
mMessageToShowOnScreenOn = null;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
index fea01ef61df9..54bdaa23ea1d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
@@ -122,11 +122,22 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
}
/**
- * Sends an intent to open the app settings for a particular package and optional
+ * Sends an intent to open the notification settings for a particular package and optional
* channel.
*/
private void startAppNotificationSettingsActivity(String packageName, final int appUid,
final NotificationChannel channel, ExpandableNotificationRow row) {
+ final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
+ intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName);
+ intent.putExtra(Settings.EXTRA_APP_UID, appUid);
+ if (channel != null) {
+ intent.putExtra(EXTRA_FRAGMENT_ARG_KEY, channel.getId());
+ }
+ mNotificationActivityStarter.startNotificationGutsIntent(intent, appUid, row);
+ }
+
+ private void startAppDetailsSettingsActivity(String packageName, final int appUid,
+ final NotificationChannel channel, ExpandableNotificationRow row) {
final Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.fromParts("package", packageName, null));
intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName);
@@ -141,7 +152,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
ExpandableNotificationRow row) {
if (ops.contains(OP_SYSTEM_ALERT_WINDOW)) {
if (ops.contains(OP_CAMERA) || ops.contains(OP_RECORD_AUDIO)) {
- startAppNotificationSettingsActivity(pkg, uid, null, row);
+ startAppDetailsSettingsActivity(pkg, uid, null, row);
} else {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
intent.setData(Uri.fromParts("package", pkg, null));
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index de0e194ef90c..9844d8e5a67a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -37,7 +37,6 @@ import com.android.systemui.Dependency;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.ScreenDecorations;
-import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.statusbar.StatusBarState;
@@ -57,14 +56,14 @@ import java.util.Stack;
* A implementation of HeadsUpManager for phone and car.
*/
public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
- ViewTreeObserver.OnComputeInternalInsetsListener, VisualStabilityManager.Callback,
- OnHeadsUpChangedListener, ConfigurationController.ConfigurationListener, StateListener {
+ VisualStabilityManager.Callback, OnHeadsUpChangedListener,
+ ConfigurationController.ConfigurationListener, StateListener {
private static final String TAG = "HeadsUpManagerPhone";
private final View mStatusBarWindowView;
private final NotificationGroupManager mGroupManager;
- private final StatusBar mBar;
private final VisualStabilityManager mVisualStabilityManager;
+ private final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
private boolean mReleaseOnExpandFinish;
private int mStatusBarHeight;
@@ -78,13 +77,9 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
private boolean mIsExpanded;
private int[] mTmpTwoArray = new int[2];
private boolean mHeadsUpGoingAway;
- private boolean mWaitingOnCollapseWhenGoingAway;
- private boolean mBubbleGoingAway;
- private boolean mIsObserving;
private int mStatusBarState;
private AnimationStateHandler mAnimationStateHandler;
- private BubbleController mBubbleController = Dependency.get(BubbleController.class);
private final Pools.Pool<HeadsUpEntryPhone> mEntryPool = new Pools.Pool<HeadsUpEntryPhone>() {
private Stack<HeadsUpEntryPhone> mPoolObjects = new Stack<>();
@@ -107,14 +102,17 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
///////////////////////////////////////////////////////////////////////////////////////////////
// Constructor:
- public HeadsUpManagerPhone(@NonNull final Context context, @NonNull View statusBarWindowView,
- @NonNull NotificationGroupManager groupManager, @NonNull StatusBar bar,
- @NonNull VisualStabilityManager visualStabilityManager) {
+ public HeadsUpManagerPhone(@NonNull final Context context,
+ @NonNull View statusBarWindowView,
+ @NonNull NotificationGroupManager groupManager,
+ @NonNull StatusBar bar,
+ @NonNull VisualStabilityManager visualStabilityManager) {
super(context);
mStatusBarWindowView = statusBarWindowView;
+ mStatusBarTouchableRegionManager = new StatusBarTouchableRegionManager(context, this, bar,
+ statusBarWindowView);
mGroupManager = groupManager;
- mBar = bar;
mVisualStabilityManager = visualStabilityManager;
initResources();
@@ -125,16 +123,10 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "onHeadsUpPinnedModeChanged");
}
- updateTouchableRegionListener();
+ mStatusBarTouchableRegionManager.updateTouchableRegion();
}
});
Dependency.get(StatusBarStateController.class).addCallback(this);
- mBubbleController.setBubbleStateChangeListener((hasBubbles) -> {
- if (!hasBubbles) {
- mBubbleGoingAway = true;
- }
- updateTouchableRegionListener();
- });
}
public void setAnimationStateHandler(AnimationStateHandler handler) {
@@ -209,14 +201,10 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
if (isExpanded != mIsExpanded) {
mIsExpanded = isExpanded;
if (isExpanded) {
- // make sure our state is sane
- mWaitingOnCollapseWhenGoingAway = false;
mHeadsUpGoingAway = false;
- updateTouchableRegionListener();
- }
- if (mBubbleController.hasBubbles() || !mIsExpanded) {
- updateTouchableRegionListener();
}
+ mStatusBarTouchableRegionManager.setIsStatusBarExpanded(isExpanded);
+ mStatusBarTouchableRegionManager.updateTouchableRegion();
}
}
@@ -233,15 +221,21 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
if (headsUpGoingAway != mHeadsUpGoingAway) {
mHeadsUpGoingAway = headsUpGoingAway;
if (!headsUpGoingAway) {
- waitForStatusBarLayout();
+ mStatusBarTouchableRegionManager.updateTouchableRegionAfterLayout();
+ } else {
+ mStatusBarTouchableRegionManager.updateTouchableRegion();
}
- updateTouchableRegionListener();
}
}
+ public boolean isHeadsUpGoingAway() {
+ return mHeadsUpGoingAway;
+ }
+
/**
* Notifies that a remote input textbox in notification gets active or inactive.
- * @param entry The entry of the target notification.
+ *
+ * @param entry The entry of the target notification.
* @param remoteInputActive True to notify active, False to notify inactive.
*/
public void setRemoteInputActive(
@@ -295,23 +289,23 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
dumpInternal(fd, pw, args);
}
- ///////////////////////////////////////////////////////////////////////////////////////////////
- // ViewTreeObserver.OnComputeInternalInsetsListener overrides:
-
/**
- * Overridden from TreeObserver.
+ * Update touch insets to include any area needed for touching a heads up notification.
+ *
+ * @param info Insets that will include heads up notification touch area after execution.
*/
- @Override
- public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) {
- if (mIsExpanded || mBar.isBouncerShowing()) {
- // The touchable region is always the full area when expanded
- return;
- }
- if (hasPinnedHeadsUp()) {
+ @Nullable
+ public void updateTouchableRegion(ViewTreeObserver.InternalInsetsInfo info) {
+ info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
+
+ if (!hasPinnedHeadsUp()) {
+ info.touchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
+ updateRegionForNotch(info.touchableRegion);
+ } else {
NotificationEntry topEntry = getTopEntry();
if (topEntry.isChildInGroup()) {
- final NotificationEntry groupSummary
- = mGroupManager.getGroupSummary(topEntry.notification);
+ final NotificationEntry groupSummary =
+ mGroupManager.getGroupSummary(topEntry.notification);
if (groupSummary != null) {
topEntry = groupSummary;
}
@@ -321,23 +315,8 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
int minX = mTmpTwoArray[0];
int maxX = mTmpTwoArray[0] + topRow.getWidth();
int height = topRow.getIntrinsicHeight();
-
- info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
info.touchableRegion.set(minX, 0, maxX, mHeadsUpInset + height);
- } else {
- setCollapsedTouchableInsets(info);
}
- Rect r = mBubbleController.getTouchableRegion();
- if (r != null) {
- info.touchableRegion.union(r);
- }
- mBubbleGoingAway = false;
- }
-
- private void setCollapsedTouchableInsets(ViewTreeObserver.InternalInsetsInfo info) {
- info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
- info.touchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
- updateRegionForNotch(info.touchableRegion);
}
private void updateRegionForNotch(Region region) {
@@ -364,9 +343,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
@Override
public void onConfigChanged(Configuration newConfig) {
- Resources resources = mContext.getResources();
- mStatusBarHeight = resources.getDimensionPixelSize(
- com.android.internal.R.dimen.status_bar_height);
+ initResources();
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -401,14 +378,15 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
@Override
protected boolean shouldHeadsUpBecomePinned(NotificationEntry entry) {
- return mStatusBarState != StatusBarState.KEYGUARD && !mIsExpanded
- || super.shouldHeadsUpBecomePinned(entry);
+ return mStatusBarState != StatusBarState.KEYGUARD && !mIsExpanded
+ || super.shouldHeadsUpBecomePinned(entry);
}
@Override
protected void dumpInternal(FileDescriptor fd, PrintWriter pw, String[] args) {
super.dumpInternal(fd, pw, args);
- pw.print(" mBarState="); pw.println(mStatusBarState);
+ pw.print(" mBarState=");
+ pw.println(mStatusBarState);
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -438,45 +416,6 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
return headsUpEntry == null || headsUpEntry != topEntry || super.canRemoveImmediately(key);
}
- /**
- * We need to wait on the whole panel to collapse, before we can remove the touchable region
- * listener.
- */
- private void waitForStatusBarLayout() {
- mWaitingOnCollapseWhenGoingAway = true;
- mStatusBarWindowView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft,
- int oldTop, int oldRight, int oldBottom) {
- if (mStatusBarWindowView.getHeight() <= mStatusBarHeight) {
- mStatusBarWindowView.removeOnLayoutChangeListener(this);
- mWaitingOnCollapseWhenGoingAway = false;
- updateTouchableRegionListener();
- }
- }
- });
- }
-
- // TODO: some kind of TouchableRegionManager to deal with this, HeadsUpManager is not really
- // the right place
- private void updateTouchableRegionListener() {
- boolean shouldObserve = hasPinnedHeadsUp() || mHeadsUpGoingAway
- || mBubbleController.hasBubbles() || mBubbleGoingAway
- || mWaitingOnCollapseWhenGoingAway
- || mStatusBarWindowView.getRootWindowInsets().getDisplayCutout() != null;
- if (shouldObserve == mIsObserving) {
- return;
- }
- if (shouldObserve) {
- mStatusBarWindowView.getViewTreeObserver().addOnComputeInternalInsetsListener(this);
- mStatusBarWindowView.requestLayout();
- } else {
- mStatusBarWindowView.getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
- }
- mIsObserving = shouldObserve;
- }
-
///////////////////////////////////////////////////////////////////////////////////////////////
// HeadsUpEntryPhone:
@@ -490,7 +429,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
}
public void setEntry(@NonNull final NotificationEntry entry) {
- Runnable removeHeadsUpRunnable = () -> {
+ Runnable removeHeadsUpRunnable = () -> {
if (!mVisualStabilityManager.isReorderingAllowed()) {
mEntriesToRemoveWhenReorderingAllowed.add(entry);
mVisualStabilityManager.addReorderingAllowedCallback(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index b7d1fc697f2a..df3a66b18381 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -236,7 +236,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
return com.android.internal.R.anim.lock_lock;
} else if (newState == STATE_SCANNING_FACE) {
return com.android.internal.R.anim.lock_scanning;
- } else if (!wasPulsing && pulsing) {
+ } else if (!wasPulsing && pulsing && newState != STATE_LOCK_OPEN) {
return com.android.internal.R.anim.lock_in;
}
return -1;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
index 2a38f771e921..faa2ab105816 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
@@ -63,7 +63,6 @@ public class NavigationBarInflaterView extends FrameLayout
public static final String NAVSPACE = "space";
public static final String CLIPBOARD = "clipboard";
public static final String HOME_HANDLE = "home_handle";
- public static final String ASSISTANT_HANDLE = "assistant_handle";
public static final String KEY = "key";
public static final String LEFT = "left";
public static final String RIGHT = "right";
@@ -399,8 +398,6 @@ public class NavigationBarInflaterView extends FrameLayout
v = inflater.inflate(R.layout.contextual, parent, false);
} else if (HOME_HANDLE.equals(button)) {
v = inflater.inflate(R.layout.home_handle, parent, false);
- } else if (ASSISTANT_HANDLE.equals(button)) {
- v = inflater.inflate(R.layout.assistant_handle, parent, false);
} else if (button.startsWith(KEY)) {
String uri = extractImage(button);
int code = extractKeycode(button);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index a64ff0fce73c..18612c359dae 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -434,7 +434,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
mButtonDispatchers.put(R.id.back, new ButtonDispatcher(R.id.back));
mButtonDispatchers.put(R.id.home, new ButtonDispatcher(R.id.home));
mButtonDispatchers.put(R.id.home_handle, new ButtonDispatcher(R.id.home_handle));
- mButtonDispatchers.put(R.id.assistant_handle, new ButtonDispatcher(R.id.assistant_handle));
mButtonDispatchers.put(R.id.recent_apps, new ButtonDispatcher(R.id.recent_apps));
mButtonDispatchers.put(R.id.menu, menuButton);
mButtonDispatchers.put(R.id.ime_switcher, imeSwitcherButton);
@@ -638,10 +637,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
return mButtonDispatchers.get(R.id.home_handle);
}
- public ButtonDispatcher getAssistantHandle() {
- return mButtonDispatchers.get(R.id.assistant_handle);
- }
-
public SparseArray<ButtonDispatcher> getButtonDispatchers() {
return mButtonDispatchers;
}
@@ -1008,7 +1003,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
// TODO(b/112934365): move this back to NavigationBarFragment when prototype is removed
private void updateAssistantAvailability() {
boolean available = mAssistantAvailable && mPrototypeController.isAssistantGestureEnabled();
- getAssistantHandle().setVisibility(available ? View.VISIBLE : View.GONE);
if (mOverviewProxyService.getProxy() != null) {
try {
mOverviewProxyService.getProxy().onAssistantAvailable(available);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 4df6aeea8ec8..babee5393e8c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -1235,6 +1235,12 @@ public class NotificationPanelView extends PanelView implements
setQsExpansion(height);
requestPanelHeightUpdate();
mNotificationStackScroller.checkSnoozeLeavebehind();
+
+ // When expanding QS, let's authenticate the user if possible,
+ // this will speed up notification actions.
+ if (height == 0) {
+ mStatusBar.requestFaceAuth();
+ }
}
private void setQsExpanded(boolean expanded) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index fc5cbeb7af3d..8db08221ef73 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1315,6 +1315,15 @@ public class StatusBar extends SystemUI implements DemoMode,
mEntryManager.updateNotifications();
}
+ /**
+ * Asks {@link KeyguardUpdateMonitor} to run face auth.
+ */
+ public void requestFaceAuth() {
+ if (!mUnlockMethodCache.canSkipBouncer()) {
+ mKeyguardUpdateMonitor.requestFaceAuth();
+ }
+ }
+
public void updateAreThereNotifications() {
if (SPEW) {
final boolean clearable = hasActiveNotifications() &&
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
new file mode 100644
index 000000000000..603c969a9de9
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2019 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 com.android.systemui.statusbar.phone;
+
+import android.annotation.NonNull;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.graphics.Rect;
+import android.view.View;
+import android.view.ViewTreeObserver;
+import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
+
+import com.android.systemui.Dependency;
+import com.android.systemui.assist.AssistManager;
+import com.android.systemui.bubbles.BubbleController;
+import com.android.systemui.statusbar.policy.ConfigurationController;
+import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
+
+/**
+ * Manages what parts of the status bar are touchable. Clients are primarily UI that displays in the
+ * status bar even though the UI doesn't look like part of the status bar.
+ */
+public final class StatusBarTouchableRegionManager implements
+ OnComputeInternalInsetsListener, ConfigurationListener {
+
+ private final AssistManager mAssistManager = Dependency.get(AssistManager.class);
+ private final BubbleController mBubbleController = Dependency.get(BubbleController.class);
+ private final Context mContext;
+ private final HeadsUpManagerPhone mHeadsUpManager;
+ private boolean mIsStatusBarExpanded = false;
+ private boolean mShouldAdjustInsets = false;
+ private final StatusBar mStatusBar;
+ private int mStatusBarHeight;
+ private final View mStatusBarWindowView;
+ private boolean mForceCollapsedUntilLayout = false;
+
+ public StatusBarTouchableRegionManager(@NonNull Context context,
+ HeadsUpManagerPhone headsUpManager,
+ @NonNull StatusBar statusBar,
+ @NonNull View statusBarWindowView) {
+ mContext = context;
+ mHeadsUpManager = headsUpManager;
+ mStatusBar = statusBar;
+ mStatusBarWindowView = statusBarWindowView;
+
+ initResources();
+
+ mAssistManager.setAssistSysUiChangeListener((isVisible) -> {
+ updateTouchableRegion();
+ });
+ mBubbleController.setBubbleStateChangeListener((hasBubbles) -> {
+ updateTouchableRegion();
+ });
+ Dependency.get(ConfigurationController.class).addCallback(this);
+ }
+
+ /**
+ * Set the touchable portion of the status bar based on what elements are visible.
+ */
+ public void updateTouchableRegion() {
+ boolean hasCutoutInset = (mStatusBarWindowView != null)
+ && (mStatusBarWindowView.getRootWindowInsets() != null)
+ && (mStatusBarWindowView.getRootWindowInsets().getDisplayCutout() != null);
+ boolean shouldObserve =
+ mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpManager.isHeadsUpGoingAway()
+ || mBubbleController.hasBubbles()
+ || mAssistManager.hasAssistUi()
+ || mForceCollapsedUntilLayout
+ || hasCutoutInset;
+ if (shouldObserve == mShouldAdjustInsets) {
+ return;
+ }
+
+ if (shouldObserve) {
+ mStatusBarWindowView.getViewTreeObserver().addOnComputeInternalInsetsListener(this);
+ mStatusBarWindowView.requestLayout();
+ } else {
+ mStatusBarWindowView.getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
+ }
+ mShouldAdjustInsets = shouldObserve;
+ }
+
+ /**
+ * Calls {@code updateTouchableRegion()} after a layout pass completes.
+ */
+ public void updateTouchableRegionAfterLayout() {
+ mForceCollapsedUntilLayout = true;
+ mStatusBarWindowView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft,
+ int oldTop, int oldRight, int oldBottom) {
+ if (mStatusBarWindowView.getHeight() <= mStatusBarHeight) {
+ mStatusBarWindowView.removeOnLayoutChangeListener(this);
+ mForceCollapsedUntilLayout = false;
+ updateTouchableRegion();
+ }
+ }
+ });
+ }
+
+ /**
+ * Notify that the status bar panel gets expanded or collapsed.
+ *
+ * @param isExpanded True to notify expanded, false to notify collapsed.
+ */
+ public void setIsStatusBarExpanded(boolean isExpanded) {
+ if (isExpanded != mIsStatusBarExpanded) {
+ mIsStatusBarExpanded = isExpanded;
+ if (isExpanded) {
+ // make sure our state is sane
+ mForceCollapsedUntilLayout = false;
+ }
+ updateTouchableRegion();
+ }
+ }
+
+ @Override
+ public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) {
+ if (mIsStatusBarExpanded || mStatusBar.isBouncerShowing()) {
+ // The touchable region is always the full area when expanded
+ return;
+ }
+
+ mHeadsUpManager.updateTouchableRegion(info);
+
+ Rect bubbleRect = mBubbleController.getTouchableRegion();
+ if (bubbleRect != null) {
+ info.touchableRegion.union(bubbleRect);
+ }
+
+ Rect assistRect = mAssistManager.getTouchableRegion();
+ if (assistRect != null) {
+ info.touchableRegion.union(assistRect);
+ }
+ }
+
+ @Override
+ public void onConfigChanged(Configuration newConfig) {
+ initResources();
+ }
+
+ @Override
+ public void onDensityOrFontScaleChanged() {
+ initResources();
+ }
+
+ @Override
+ public void onOverlayChanged() {
+ initResources();
+ }
+
+ private void initResources() {
+ Resources resources = mContext.getResources();
+ mStatusBarHeight = resources.getDimensionPixelSize(
+ com.android.internal.R.dimen.status_bar_height);
+ }
+}
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
index 304ddb292f64..c423f9c87d29 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
@@ -427,6 +427,9 @@ final class ContentCapturePerUserService
@GuardedBy("mLock")
public void destroyLocked() {
if (mMaster.debug) Slog.d(TAG, "destroyLocked()");
+ if (mRemoteService != null) {
+ mRemoteService.destroy();
+ }
destroySessionsLocked();
}
diff --git a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
index 194549f15ecf..99380c94b869 100644
--- a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
+++ b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
@@ -83,8 +83,8 @@ public class SettingsToPropertiesMapper {
DeviceConfig.NAMESPACE_INPUT_NATIVE_BOOT,
DeviceConfig.NAMESPACE_MEDIA_NATIVE,
DeviceConfig.NAMESPACE_NETD_NATIVE,
+ DeviceConfig.NAMESPACE_RUNTIME_NATIVE,
DeviceConfig.NAMESPACE_RUNTIME_NATIVE_BOOT,
- DeviceConfig.RuntimeNative.NAMESPACE,
};
private final String[] mGlobalSettings;
diff --git a/services/core/java/com/android/server/attention/AttentionManagerService.java b/services/core/java/com/android/server/attention/AttentionManagerService.java
index 5965d592cf4f..7da848c12e83 100644
--- a/services/core/java/com/android/server/attention/AttentionManagerService.java
+++ b/services/core/java/com/android/server/attention/AttentionManagerService.java
@@ -16,9 +16,7 @@
package com.android.server.attention;
-import static android.provider.DeviceConfig.AttentionManagerService.COMPONENT_NAME;
-import static android.provider.DeviceConfig.AttentionManagerService.NAMESPACE;
-import static android.provider.DeviceConfig.AttentionManagerService.SERVICE_ENABLED;
+import static android.provider.DeviceConfig.NAMESPACE_ATTENTION_MANAGER_SERVICE;
import android.Manifest;
import android.annotation.Nullable;
@@ -80,6 +78,12 @@ public class AttentionManagerService extends SystemService {
/** If the check attention called within that period - cached value will be returned. */
private static final long STALE_AFTER_MILLIS = 5_000;
+ /** DeviceConfig flag name, if {@code true}, enables AttentionManagerService features. */
+ private static final String SERVICE_ENABLED = "service_enabled";
+
+ /** DeviceConfig flag name, allows a CTS to inject a fake implementation. */
+ private static final String COMPONENT_NAME = "component_name";
+
private final Context mContext;
private final PowerManager mPowerManager;
private final Object mLock;
@@ -122,12 +126,13 @@ public class AttentionManagerService extends SystemService {
/**
* Returns {@code true} if attention service is supported on this device.
*/
- public boolean isAttentionServiceSupported() {
+ private boolean isAttentionServiceSupported() {
return isServiceEnabled() && isServiceAvailable();
}
private boolean isServiceEnabled() {
- return DeviceConfig.getBoolean(NAMESPACE, SERVICE_ENABLED, DEFAULT_SERVICE_ENABLED);
+ return DeviceConfig.getBoolean(NAMESPACE_ATTENTION_MANAGER_SERVICE, SERVICE_ENABLED,
+ DEFAULT_SERVICE_ENABLED);
}
/**
@@ -135,7 +140,7 @@ public class AttentionManagerService extends SystemService {
*
* @return {@code true} if the framework was able to send the provided callback to the service
*/
- public boolean checkAttention(int requestCode, long timeout,
+ private boolean checkAttention(int requestCode, long timeout,
AttentionCallbackInternal callback) {
Preconditions.checkNotNull(callback);
@@ -213,7 +218,7 @@ public class AttentionManagerService extends SystemService {
}
/** Cancels the specified attention check. */
- public void cancelAttentionCheck(int requestCode) {
+ private void cancelAttentionCheck(int requestCode) {
synchronized (mLock) {
final UserState userState = peekCurrentUserStateLocked();
if (userState == null) {
@@ -283,7 +288,8 @@ public class AttentionManagerService extends SystemService {
* system.
*/
private static ComponentName resolveAttentionService(Context context) {
- final String flag = DeviceConfig.getProperty(NAMESPACE, COMPONENT_NAME);
+ final String flag = DeviceConfig.getProperty(NAMESPACE_ATTENTION_MANAGER_SERVICE,
+ COMPONENT_NAME);
final String componentNameString = flag != null ? flag : context.getString(
R.string.config_defaultAttentionService);
diff --git a/services/core/java/com/android/server/infra/AbstractMasterSystemService.java b/services/core/java/com/android/server/infra/AbstractMasterSystemService.java
index 4cafd4ba40c1..3c27bf240570 100644
--- a/services/core/java/com/android/server/infra/AbstractMasterSystemService.java
+++ b/services/core/java/com/android/server/infra/AbstractMasterSystemService.java
@@ -322,9 +322,6 @@ public abstract class AbstractMasterSystemService<M extends AbstractMasterSystem
oldService.removeSelfFromCacheLocked();
}
mServiceNameResolver.setTemporaryService(userId, componentName, durationMs);
-
- // Must update the service on cache so its initialization code is triggered
- updateCachedServiceLocked(userId);
}
}
diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java
index 4a4a8e3b5880..fce9bb101b5d 100644
--- a/services/core/java/com/android/server/pm/StagingManager.java
+++ b/services/core/java/com/android/server/pm/StagingManager.java
@@ -526,8 +526,8 @@ public class StagingManager {
}
void abortCommittedSession(@NonNull PackageInstallerSession session) {
- if (session.isStagedSessionApplied() || session.isStagedSessionFailed()) {
- Slog.w(TAG, "Cannot abort already finalized session : " + session.sessionId);
+ if (session.isStagedSessionApplied()) {
+ Slog.w(TAG, "Cannot abort applied session : " + session.sessionId);
return;
}
abortSession(session);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index b973ed598cac..a6c92571bc03 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -7472,13 +7472,26 @@ public class WindowManagerService extends IWindowManager.Stub
@Override
public boolean injectInputAfterTransactionsApplied(InputEvent ev, int mode) {
- waitForAnimationsToComplete();
-
- synchronized (mGlobalLock) {
- mWindowPlacerLocked.performSurfacePlacementIfScheduled();
+ boolean shouldWaitForAnimComplete = false;
+ if (ev instanceof KeyEvent) {
+ KeyEvent keyEvent = (KeyEvent) ev;
+ shouldWaitForAnimComplete = keyEvent.getSource() == InputDevice.SOURCE_MOUSE
+ || keyEvent.getAction() == KeyEvent.ACTION_DOWN;
+ } else if (ev instanceof MotionEvent) {
+ MotionEvent motionEvent = (MotionEvent) ev;
+ shouldWaitForAnimComplete = motionEvent.getSource() == InputDevice.SOURCE_MOUSE
+ || motionEvent.getAction() == MotionEvent.ACTION_DOWN;
}
- new SurfaceControl.Transaction().syncInputWindows().apply(true);
+ if (shouldWaitForAnimComplete) {
+ waitForAnimationsToComplete();
+
+ synchronized (mGlobalLock) {
+ mWindowPlacerLocked.performSurfacePlacementIfScheduled();
+ }
+
+ new SurfaceControl.Transaction().syncInputWindows().apply(true);
+ }
return LocalServices.getService(InputManagerInternal.class).injectInputEvent(ev, mode);
}
diff --git a/telephony/java/android/telephony/CellIdentityNr.java b/telephony/java/android/telephony/CellIdentityNr.java
index 5a89ae83fbb6..4be52a322c03 100644
--- a/telephony/java/android/telephony/CellIdentityNr.java
+++ b/telephony/java/android/telephony/CellIdentityNr.java
@@ -16,13 +16,15 @@
package android.telephony;
+import android.annotation.IntRange;
+import android.annotation.Nullable;
import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation;
import java.util.Objects;
/**
- * Information to represent a unique 5G NR cell.
+ * Information to represent a unique NR(New Radio 5G) cell.
*/
public final class CellIdentityNr extends CellIdentity {
private static final String TAG = "CellIdentityNr";
@@ -79,7 +81,7 @@ public final class CellIdentityNr extends CellIdentity {
}
/**
- * Get the NR Cell Identity.
+ * Get the NR(New Radio 5G) Cell Identity.
*
* @return The 36-bit NR Cell Identity in range [0, 68719476735] or
* {@link CellInfo#UNAVAILABLE_LONG} if unknown.
@@ -96,6 +98,7 @@ public final class CellIdentityNr extends CellIdentity {
*
* @return Integer value in range [0, 3279165] or {@link CellInfo#UNAVAILABLE} if unknown.
*/
+ @IntRange(from = 0, to = 3279165)
public int getNrarfcn() {
return mNrArfcn;
}
@@ -104,6 +107,7 @@ public final class CellIdentityNr extends CellIdentity {
* Get the physical cell id.
* @return Integer value in range [0, 1007] or {@link CellInfo#UNAVAILABLE} if unknown.
*/
+ @IntRange(from = 0, to = 1007)
public int getPci() {
return mPci;
}
@@ -112,6 +116,7 @@ public final class CellIdentityNr extends CellIdentity {
* Get the tracking area code.
* @return a 16 bit integer or {@link CellInfo#UNAVAILABLE} if unknown.
*/
+ @IntRange(from = 0, to = 65535)
public int getTac() {
return mTac;
}
@@ -119,6 +124,7 @@ public final class CellIdentityNr extends CellIdentity {
/**
* @return Mobile Country Code in string format, or {@code null} if unknown.
*/
+ @Nullable
public String getMccString() {
return mMccStr;
}
@@ -126,6 +132,7 @@ public final class CellIdentityNr extends CellIdentity {
/**
* @return Mobile Network Code in string fomrat, or {@code null} if unknown.
*/
+ @Nullable
public String getMncString() {
return mMncStr;
}
diff --git a/telephony/java/android/telephony/CellInfoNr.java b/telephony/java/android/telephony/CellInfoNr.java
index fb147ce7b4e9..0227610024a4 100644
--- a/telephony/java/android/telephony/CellInfoNr.java
+++ b/telephony/java/android/telephony/CellInfoNr.java
@@ -16,6 +16,7 @@
package android.telephony;
+import android.annotation.NonNull;
import android.os.Parcel;
import java.util.Objects;
@@ -36,11 +37,13 @@ public final class CellInfoNr extends CellInfo {
}
@Override
+ @NonNull
public CellIdentity getCellIdentity() {
return mCellIdentity;
}
@Override
+ @NonNull
public CellSignalStrength getCellSignalStrength() {
return mCellSignalStrength;
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index f07ac5a4f0e1..3dee114c1688 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -6774,14 +6774,12 @@ public class TelephonyManager {
}
} catch (RemoteException ex) {
Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex);
- } catch (NullPointerException ex) {
- Rlog.e(TAG, "getPreferredNetworkType NPE", ex);
}
return -1;
}
/**
- * Get the preferred network type bitmap.
+ * Get the preferred network type bitmask.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
* given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
@@ -6790,13 +6788,13 @@ public class TelephonyManager {
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
* or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
*
- * @return The bitmap of preferred network types.
+ * @return The bitmask of preferred network types.
*
* @hide
*/
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@SystemApi
- public @NetworkTypeBitMask long getPreferredNetworkTypeBitmap() {
+ public @NetworkTypeBitMask long getPreferredNetworkTypeBitmask() {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
@@ -6804,9 +6802,7 @@ public class TelephonyManager {
telephony.getPreferredNetworkType(getSubId()));
}
} catch (RemoteException ex) {
- Rlog.e(TAG, "getPreferredNetworkTypeBitmap RemoteException", ex);
- } catch (NullPointerException ex) {
- Rlog.e(TAG, "getPreferredNetworkTypeBitmap NPE", ex);
+ Rlog.e(TAG, "getPreferredNetworkTypeBitmask RemoteException", ex);
}
return 0;
}
@@ -7031,14 +7027,12 @@ public class TelephonyManager {
}
} catch (RemoteException ex) {
Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex);
- } catch (NullPointerException ex) {
- Rlog.e(TAG, "setPreferredNetworkType NPE", ex);
}
return false;
}
/**
- * Set the preferred network type bitmap.
+ * Set the preferred network type bitmask.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
* given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
@@ -7047,24 +7041,22 @@ public class TelephonyManager {
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling
* app has carrier privileges (see {@link #hasCarrierPrivileges}).
*
- * @param networkTypeBitmap The bitmap of preferred network types.
+ * @param networkTypeBitmask The bitmask of preferred network types.
* @return true on success; false on any failure.
* @hide
*/
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
@SystemApi
- public boolean setPreferredNetworkTypeBitmap(@NetworkTypeBitMask long networkTypeBitmap) {
+ public boolean setPreferredNetworkTypeBitmask(@NetworkTypeBitMask long networkTypeBitmask) {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.setPreferredNetworkType(
getSubId(), RadioAccessFamily.getNetworkTypeFromRaf(
- (int) networkTypeBitmap));
+ (int) networkTypeBitmask));
}
} catch (RemoteException ex) {
- Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex);
- } catch (NullPointerException ex) {
- Rlog.e(TAG, "setPreferredNetworkType NPE", ex);
+ Rlog.e(TAG, "setPreferredNetworkTypeBitmask RemoteException", ex);
}
return false;
}
diff --git a/telephony/java/android/telephony/ims/ImsException.java b/telephony/java/android/telephony/ims/ImsException.java
index bdaad5bffe5e..02eddf67e25b 100644
--- a/telephony/java/android/telephony/ims/ImsException.java
+++ b/telephony/java/android/telephony/ims/ImsException.java
@@ -19,6 +19,7 @@ package android.telephony.ims;
import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.SystemApi;
+import android.content.pm.PackageManager;
import android.text.TextUtils;
import java.lang.annotation.Retention;
@@ -48,7 +49,9 @@ public class ImsException extends Exception {
/**
* This device or carrier configuration does not support IMS for this subscription.
* <p>
- * This is a permanent configuration error and there should be no retry.
+ * This is a permanent configuration error and there should be no retry. Usually this is
+ * because {@link PackageManager#FEATURE_TELEPHONY_IMS} is not available
+ * or the device has no ImsService implementation to service this request.
*/
public static final int CODE_ERROR_UNSUPPORTED_OPERATION = 2;
diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java
index 58ddf21888fc..12e80062747c 100644
--- a/telephony/java/android/telephony/ims/ImsMmTelManager.java
+++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java
@@ -25,6 +25,8 @@ import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.content.Context;
+import android.content.pm.IPackageManager;
+import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Binder;
import android.os.RemoteException;
@@ -314,7 +316,7 @@ public class ImsMmTelManager {
private int mSubId;
/**
- * Create an instance of ImsManager for the subscription id specified.
+ * Create an instance of {@link ImsMmTelManager} for the subscription id specified.
*
* @param subId The ID of the subscription that this ImsMmTelManager will use.
* @see android.telephony.SubscriptionManager#getActiveSubscriptionInfoList()
@@ -366,12 +368,14 @@ public class ImsMmTelManager {
if (executor == null) {
throw new IllegalArgumentException("Must include a non-null Executor.");
}
+ if (!isImsAvailableOnDevice()) {
+ throw new ImsException("IMS not available on device.",
+ ImsException.CODE_ERROR_UNSUPPORTED_OPERATION);
+ }
c.setExecutor(executor);
try {
getITelephony().registerImsRegistrationCallback(mSubId, c.getBinder());
- } catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
- } catch (IllegalStateException e) {
+ } catch (RemoteException | IllegalStateException e) {
throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
}
@@ -434,6 +438,10 @@ public class ImsMmTelManager {
if (executor == null) {
throw new IllegalArgumentException("Must include a non-null Executor.");
}
+ if (!isImsAvailableOnDevice()) {
+ throw new ImsException("IMS not available on device.",
+ ImsException.CODE_ERROR_UNSUPPORTED_OPERATION);
+ }
c.setExecutor(executor);
try {
getITelephony().registerMmTelCapabilityCallback(mSubId, c.getBinder());
@@ -800,6 +808,22 @@ public class ImsMmTelManager {
}
}
+ private static boolean isImsAvailableOnDevice() {
+ IPackageManager pm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
+ if (pm == null) {
+ // For some reason package manger is not available.. This will fail internally anyways,
+ // so do not throw error and allow.
+ return true;
+ }
+ try {
+ return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS, 0);
+ } catch (RemoteException e) {
+ // For some reason package manger is not available.. This will fail internally anyways,
+ // so do not throw error and allow.
+ }
+ return true;
+ }
+
private static ITelephony getITelephony() {
ITelephony binder = ITelephony.Stub.asInterface(
ServiceManager.getService(Context.TELEPHONY_SERVICE));
diff --git a/telephony/java/android/telephony/ims/ImsReasonInfo.java b/telephony/java/android/telephony/ims/ImsReasonInfo.java
index b0184916ff70..a478606da22a 100644
--- a/telephony/java/android/telephony/ims/ImsReasonInfo.java
+++ b/telephony/java/android/telephony/ims/ImsReasonInfo.java
@@ -142,6 +142,11 @@ public final class ImsReasonInfo implements Parcelable {
* Call was disconnected because a handover is not feasible due to network conditions.
*/
public static final int CODE_LOCAL_HO_NOT_FEASIBLE = 149;
+ /**
+ * This device does not support IMS.
+ * @hide
+ */
+ public static final int CODE_LOCAL_IMS_NOT_SUPPORTED_ON_DEVICE = 150;
/*
* TIMEOUT (IMS -> Telephony)
diff --git a/telephony/java/android/telephony/ims/ProvisioningManager.java b/telephony/java/android/telephony/ims/ProvisioningManager.java
index d12cda8a30a4..8cdf6a235749 100644
--- a/telephony/java/android/telephony/ims/ProvisioningManager.java
+++ b/telephony/java/android/telephony/ims/ProvisioningManager.java
@@ -24,6 +24,8 @@ import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.WorkerThread;
import android.content.Context;
+import android.content.pm.IPackageManager;
+import android.content.pm.PackageManager;
import android.os.Binder;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -209,12 +211,14 @@ public class ProvisioningManager {
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public void registerProvisioningChangedCallback(@NonNull @CallbackExecutor Executor executor,
@NonNull Callback callback) throws ImsException {
+ if (!isImsAvailableOnDevice()) {
+ throw new ImsException("IMS not available on device.",
+ ImsException.CODE_ERROR_UNSUPPORTED_OPERATION);
+ }
callback.setExecutor(executor);
try {
getITelephony().registerImsProvisioningChangedCallback(mSubId, callback.getBinder());
- } catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
- } catch (IllegalStateException e) {
+ } catch (RemoteException | IllegalStateException e) {
throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
}
@@ -232,8 +236,7 @@ public class ProvisioningManager {
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public void unregisterProvisioningChangedCallback(@NonNull Callback callback) {
try {
- getITelephony().unregisterImsProvisioningChangedCallback(mSubId,
- callback.getBinder());
+ getITelephony().unregisterImsProvisioningChangedCallback(mSubId, callback.getBinder());
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
@@ -373,6 +376,22 @@ public class ProvisioningManager {
}
}
+ private static boolean isImsAvailableOnDevice() {
+ IPackageManager pm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
+ if (pm == null) {
+ // For some reason package manger is not available.. This will fail internally anyways,
+ // so do not throw error and allow.
+ return true;
+ }
+ try {
+ return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS, 0);
+ } catch (RemoteException e) {
+ // For some reason package manger is not available.. This will fail internally anyways,
+ // so do not throw error and allow.
+ }
+ return true;
+ }
+
private static ITelephony getITelephony() {
ITelephony binder = ITelephony.Stub.asInterface(
ServiceManager.getService(Context.TELEPHONY_SERVICE));
diff --git a/tests/ActivityManagerPerfTests/test-app/Android.bp b/tests/ActivityManagerPerfTests/test-app/Android.bp
new file mode 100644
index 000000000000..ef9d587581c4
--- /dev/null
+++ b/tests/ActivityManagerPerfTests/test-app/Android.bp
@@ -0,0 +1,21 @@
+// 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.
+
+android_test {
+ name: "ActivityManagerPerfTestsTestApp",
+ srcs: ["src/**/*.java"],
+ static_libs: ["ActivityManagerPerfTestsUtils"],
+ min_sdk_version: "25",
+ sdk_version: "current",
+}
diff --git a/tests/ActivityManagerPerfTests/test-app/Android.mk b/tests/ActivityManagerPerfTests/test-app/Android.mk
deleted file mode 100644
index 33d15d2a3387..000000000000
--- a/tests/ActivityManagerPerfTests/test-app/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- ActivityManagerPerfTestsUtils
-
-LOCAL_MIN_SDK_VERSION := 25
-
-LOCAL_PACKAGE_NAME := ActivityManagerPerfTestsTestApp
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/tests/ActivityManagerPerfTests/tests/Android.bp b/tests/ActivityManagerPerfTests/tests/Android.bp
new file mode 100644
index 000000000000..2ae2cc49bb7a
--- /dev/null
+++ b/tests/ActivityManagerPerfTests/tests/Android.bp
@@ -0,0 +1,27 @@
+// 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.
+
+android_test {
+ name: "ActivityManagerPerfTests",
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "androidx.test.rules",
+ "apct-perftests-utils",
+ "ActivityManagerPerfTestsUtils",
+ ],
+ platform_apis: true,
+ min_sdk_version: "25",
+ // For android.permission.FORCE_STOP_PACKAGES permission
+ certificate: "platform",
+}
diff --git a/tests/ActivityManagerPerfTests/tests/Android.mk b/tests/ActivityManagerPerfTests/tests/Android.mk
deleted file mode 100644
index e1f56b8ba55f..000000000000
--- a/tests/ActivityManagerPerfTests/tests/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
- apct-perftests-utils \
- ActivityManagerPerfTestsUtils
-
-LOCAL_PACKAGE_NAME := ActivityManagerPerfTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MIN_SDK_VERSION := 25
-
-# For android.permission.FORCE_STOP_PACKAGES permission
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/ActivityManagerPerfTests/utils/Android.bp b/tests/ActivityManagerPerfTests/utils/Android.bp
new file mode 100644
index 000000000000..300b7ea998fa
--- /dev/null
+++ b/tests/ActivityManagerPerfTests/utils/Android.bp
@@ -0,0 +1,27 @@
+// 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.
+
+java_test {
+ name: "ActivityManagerPerfTestsUtils",
+ sdk_version: "current",
+ srcs: [
+ "src/**/*.java",
+ "src/com/android/frameworks/perftests/am/util/ITimeReceiverCallback.aidl",
+ ],
+ static_libs: [
+ "androidx.test.rules",
+ "junit",
+ "ub-uiautomator",
+ ],
+}
diff --git a/tests/ActivityManagerPerfTests/utils/Android.mk b/tests/ActivityManagerPerfTests/utils/Android.mk
deleted file mode 100644
index 7a7471dd6cd8..000000000000
--- a/tests/ActivityManagerPerfTests/utils/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src) \
- src/com/android/frameworks/perftests/am/util/ITimeReceiverCallback.aidl
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
- junit \
- ub-uiautomator
-
-LOCAL_MODULE := ActivityManagerPerfTestsUtils
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/ActivityViewTest/Android.bp b/tests/ActivityViewTest/Android.bp
new file mode 100644
index 000000000000..e7b8c8e1d058
--- /dev/null
+++ b/tests/ActivityViewTest/Android.bp
@@ -0,0 +1,6 @@
+android_test {
+ name: "ActivityViewTest",
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ certificate: "platform",
+}
diff --git a/tests/ActivityViewTest/Android.mk b/tests/ActivityViewTest/Android.mk
deleted file mode 100644
index 9c7ca7eb5d00..000000000000
--- a/tests/ActivityViewTest/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := ActivityViewTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/AppLaunch/Android.bp b/tests/AppLaunch/Android.bp
new file mode 100644
index 000000000000..f90f26f00e6d
--- /dev/null
+++ b/tests/AppLaunch/Android.bp
@@ -0,0 +1,13 @@
+android_test {
+ name: "AppLaunch",
+ // Only compile source java files in this apk.
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ certificate: "platform",
+ libs: [
+ "android.test.base",
+ "android.test.runner",
+ ],
+ static_libs: ["androidx.test.rules"],
+ test_suites: ["device-tests"],
+}
diff --git a/tests/AppLaunch/Android.mk b/tests/AppLaunch/Android.mk
deleted file mode 100644
index f50bca560f83..000000000000
--- a/tests/AppLaunch/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := AppLaunch
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-LOCAL_JAVA_LIBRARIES := android.test.base android.test.runner
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/AppLaunchWear/Android.bp b/tests/AppLaunchWear/Android.bp
new file mode 100644
index 000000000000..8d34b6eb9c0f
--- /dev/null
+++ b/tests/AppLaunchWear/Android.bp
@@ -0,0 +1,13 @@
+android_test {
+ name: "AppLaunchWear",
+ // Only compile source java files in this apk.
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ certificate: "platform",
+ libs: [
+ "android.test.base",
+ "android.test.runner",
+ ],
+ static_libs: ["androidx.test.rules"],
+ test_suites: ["device-tests"],
+}
diff --git a/tests/AppLaunchWear/Android.mk b/tests/AppLaunchWear/Android.mk
deleted file mode 100644
index 332b6808ace8..000000000000
--- a/tests/AppLaunchWear/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := AppLaunchWear
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-LOCAL_JAVA_LIBRARIES := android.test.base android.test.runner
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/BackgroundDexOptServiceIntegrationTests/Android.bp b/tests/BackgroundDexOptServiceIntegrationTests/Android.bp
new file mode 100644
index 000000000000..a85d129b013a
--- /dev/null
+++ b/tests/BackgroundDexOptServiceIntegrationTests/Android.bp
@@ -0,0 +1,24 @@
+//
+// 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.
+//
+
+android_test {
+ name: "BackgroundDexOptServiceIntegrationTests",
+ srcs: ["src/**/*.java"],
+ static_libs: ["androidx.test.rules"],
+ platform_apis: true,
+ test_suites: ["device-tests"],
+ certificate: "platform",
+}
diff --git a/tests/BackgroundDexOptServiceIntegrationTests/Android.mk b/tests/BackgroundDexOptServiceIntegrationTests/Android.mk
deleted file mode 100644
index f47cf96446ba..000000000000
--- a/tests/BackgroundDexOptServiceIntegrationTests/Android.mk
+++ /dev/null
@@ -1,35 +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.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
-
-LOCAL_PACKAGE_NAME := BackgroundDexOptServiceIntegrationTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/Compatibility/Android.bp b/tests/Compatibility/Android.bp
new file mode 100644
index 000000000000..4ca406eba3cf
--- /dev/null
+++ b/tests/Compatibility/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2012 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.
+
+android_test {
+ name: "AppCompatibilityTest",
+ static_libs: ["androidx.test.rules"],
+ // Include all test java files.
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ certificate: "platform",
+}
diff --git a/tests/Compatibility/Android.mk b/tests/Compatibility/Android.mk
deleted file mode 100644
index 643f9ebd5f15..000000000000
--- a/tests/Compatibility/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2012 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-# Include all test java files.
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-
-LOCAL_PACKAGE_NAME := AppCompatibilityTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_CERTIFICATE := platform
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/FlickerTests/Android.bp b/tests/FlickerTests/Android.bp
new file mode 100644
index 000000000000..05f0a8e7921d
--- /dev/null
+++ b/tests/FlickerTests/Android.bp
@@ -0,0 +1,30 @@
+//
+// 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.
+//
+
+android_test {
+ name: "FlickerTests",
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ certificate: "platform",
+ test_suites: ["device-tests"],
+ libs: ["android.test.runner"],
+ static_libs: [
+ "flickertestapplib",
+ "flickerlib",
+ "truth-prebuilt",
+ "app-helpers-core",
+ ],
+}
diff --git a/tests/FlickerTests/Android.mk b/tests/FlickerTests/Android.mk
deleted file mode 100644
index 3c70f8bc2d72..000000000000
--- a/tests/FlickerTests/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := FlickerTests
-LOCAL_MODULE_TAGS := tests optional
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_CERTIFICATE := platform
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := \
- flickertestapplib \
- flickerlib \
- truth-prebuilt \
- app-helpers-core
-
-include $(BUILD_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH)) \ No newline at end of file
diff --git a/tests/FlickerTests/lib/Android.bp b/tests/FlickerTests/lib/Android.bp
new file mode 100644
index 000000000000..982fcbadddf7
--- /dev/null
+++ b/tests/FlickerTests/lib/Android.bp
@@ -0,0 +1,44 @@
+//
+// 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.
+//
+
+java_test {
+ name: "flickerlib",
+ platform_apis: true,
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "androidx.test.janktesthelper",
+ "cts-amwm-util",
+ "platformprotosnano",
+ "layersprotosnano",
+ "truth-prebuilt",
+ "sysui-helper",
+ "launcher-helper-lib",
+ ],
+}
+
+java_library {
+ name: "flickerautomationhelperlib",
+ sdk_version: "test_current",
+ srcs: [
+ "src/com/android/server/wm/flicker/AutomationUtils.java",
+ "src/com/android/server/wm/flicker/WindowUtils.java",
+ ],
+ static_libs: [
+ "sysui-helper",
+ "launcher-helper-lib",
+ "compatibility-device-util-axt",
+ ],
+}
diff --git a/tests/FlickerTests/lib/Android.mk b/tests/FlickerTests/lib/Android.mk
deleted file mode 100644
index e438822a6f32..000000000000
--- a/tests/FlickerTests/lib/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := flickerlib
-LOCAL_MODULE_TAGS := tests optional
-# sign this with platform cert, so this test is allowed to call private platform apis
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.janktesthelper \
- cts-amwm-util \
- platformprotosnano \
- layersprotosnano \
- truth-prebuilt \
- sysui-helper \
- launcher-helper-lib \
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := flickerautomationhelperlib
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := src/com/android/server/wm/flicker/AutomationUtils.java \
- src/com/android/server/wm/flicker/WindowUtils.java
-LOCAL_STATIC_JAVA_LIBRARIES := sysui-helper \
- launcher-helper-lib \
- compatibility-device-util-axt
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/FlickerTests/lib/test/Android.bp b/tests/FlickerTests/lib/test/Android.bp
new file mode 100644
index 000000000000..bfeb75b23469
--- /dev/null
+++ b/tests/FlickerTests/lib/test/Android.bp
@@ -0,0 +1,33 @@
+//
+// 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.
+//
+
+android_test {
+ name: "FlickerLibTest",
+ // sign this with platform cert, so this test is allowed to call private platform apis
+ certificate: "platform",
+ platform_apis: true,
+ test_suites: ["tests"],
+ srcs: ["src/**/*.java"],
+ libs: ["android.test.runner"],
+ static_libs: [
+ "androidx.test.rules",
+ "platform-test-annotations",
+ "truth-prebuilt",
+ "platformprotosnano",
+ "layersprotosnano",
+ "flickerlib",
+ ],
+}
diff --git a/tests/FlickerTests/lib/test/Android.mk b/tests/FlickerTests/lib/test/Android.mk
deleted file mode 100644
index 5be89ba624e6..000000000000
--- a/tests/FlickerTests/lib/test/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := FlickerLibTest
-LOCAL_MODULE_TAGS := tests optional
-# sign this with platform cert, so this test is allowed to call private platform apis
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := tests
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
- platform-test-annotations \
- truth-prebuilt \
- platformprotosnano \
- layersprotosnano \
- flickerlib
-
-include $(BUILD_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH)) \ No newline at end of file
diff --git a/tests/FlickerTests/test-apps/Android.bp b/tests/FlickerTests/test-apps/Android.bp
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/tests/FlickerTests/test-apps/Android.bp
diff --git a/tests/FlickerTests/test-apps/Android.mk b/tests/FlickerTests/test-apps/Android.mk
deleted file mode 100644
index 9af9f444ca59..000000000000
--- a/tests/FlickerTests/test-apps/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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.
-
-include $(call all-subdir-makefiles)
diff --git a/tests/FlickerTests/test-apps/flickerapp/Android.bp b/tests/FlickerTests/test-apps/flickerapp/Android.bp
new file mode 100644
index 000000000000..0bea209a757a
--- /dev/null
+++ b/tests/FlickerTests/test-apps/flickerapp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test {
+ name: "FlickerTestApp",
+ srcs: ["**/*.java"],
+ sdk_version: "current",
+ test_suites: ["device-tests"],
+}
+
+java_test {
+ name: "flickertestapplib",
+ sdk_version: "current",
+ srcs: ["src/com/android/server/wm/flicker/testapp/ActivityOptions.java"],
+}
diff --git a/tests/FlickerTests/test-apps/flickerapp/Android.mk b/tests/FlickerTests/test-apps/flickerapp/Android.mk
deleted file mode 100644
index b916900a7504..000000000000
--- a/tests/FlickerTests/test-apps/flickerapp/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := FlickerTestApp
-LOCAL_MODULE_TAGS := tests optional
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_SDK_VERSION := current
-LOCAL_COMPATIBILITY_SUITE := device-tests
-include $(BUILD_PACKAGE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := flickertestapplib
-LOCAL_MODULE_TAGS := tests optional
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := src/com/android/server/wm/flicker/testapp/ActivityOptions.java
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH)) \ No newline at end of file
diff --git a/tests/Internal/Android.bp b/tests/Internal/Android.bp
new file mode 100644
index 000000000000..4cb9f8d5e1e6
--- /dev/null
+++ b/tests/Internal/Android.bp
@@ -0,0 +1,18 @@
+android_test {
+ name: "InternalTests",
+ proto: {
+ type: "nano",
+ },
+ // Include some source files directly to be able to access package members
+ srcs: ["src/**/*.java"],
+ libs: ["android.test.runner"],
+ static_libs: [
+ "junit",
+ "androidx.test.rules",
+ "mockito-target-minus-junit4",
+ ],
+ java_resource_dirs: ["res"],
+ certificate: "platform",
+ platform_apis: true,
+ test_suites: ["device-tests"],
+}
diff --git a/tests/Internal/Android.mk b/tests/Internal/Android.mk
deleted file mode 100644
index 2e26ef103794..000000000000
--- a/tests/Internal/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_USE_AAPT2 := true
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-
-# Include some source files directly to be able to access package members
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := junit \
- androidx.test.rules \
- mockito-target-minus-junit4
-
-LOCAL_JAVA_RESOURCE_DIRS := res
-LOCAL_CERTIFICATE := platform
-
-LOCAL_PACKAGE_NAME := InternalTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/PackageWatchdog/Android.bp b/tests/PackageWatchdog/Android.bp
new file mode 100644
index 000000000000..b07996568839
--- /dev/null
+++ b/tests/PackageWatchdog/Android.bp
@@ -0,0 +1,28 @@
+// Copyright (C) 2019 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.
+
+// PackageWatchdogTest
+android_test {
+ name: "PackageWatchdogTest",
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "junit",
+ "frameworks-base-testutils",
+ "androidx.test.rules",
+ "services.core",
+ ],
+ libs: ["android.test.runner"],
+ platform_apis: true,
+ test_suites: ["device-tests"],
+}
diff --git a/tests/PackageWatchdog/Android.mk b/tests/PackageWatchdog/Android.mk
deleted file mode 100644
index 1e4aacce1613..000000000000
--- a/tests/PackageWatchdog/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2019 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-# PackageWatchdogTest
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PACKAGE_NAME := PackageWatchdogTest
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- junit \
- frameworks-base-testutils \
- androidx.test.rules \
- services.core
-
-LOCAL_JAVA_LIBRARIES := \
- android.test.runner
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RcsTests/Android.bp b/tests/RcsTests/Android.bp
new file mode 100644
index 000000000000..8ee496066bb3
--- /dev/null
+++ b/tests/RcsTests/Android.bp
@@ -0,0 +1,17 @@
+android_test {
+ name: "RcsTests",
+ // Only compile source java files in this apk.
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ certificate: "platform",
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ ],
+ static_libs: [
+ "junit",
+ "androidx.test.rules",
+ "mockito-target-minus-junit4",
+ "truth-prebuilt",
+ ],
+}
diff --git a/tests/RcsTests/Android.mk b/tests/RcsTests/Android.mk
deleted file mode 100644
index a276584530f4..000000000000
--- a/tests/RcsTests/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := RcsTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_STATIC_JAVA_LIBRARIES := junit androidx.test.rules mockito-target-minus-junit4 truth-prebuilt
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/ServiceCrashTest/Android.bp b/tests/ServiceCrashTest/Android.bp
new file mode 100644
index 000000000000..40a377de852f
--- /dev/null
+++ b/tests/ServiceCrashTest/Android.bp
@@ -0,0 +1,12 @@
+android_test {
+ name: "ServiceCrashTest",
+ // Only compile source java files in this apk.
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ certificate: "platform",
+ libs: ["android.test.base"],
+ static_libs: [
+ "compatibility-device-util-axt",
+ "androidx.test.rules",
+ ],
+}
diff --git a/tests/ServiceCrashTest/Android.mk b/tests/ServiceCrashTest/Android.mk
deleted file mode 100644
index 617ee7caf139..000000000000
--- a/tests/ServiceCrashTest/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := ServiceCrashTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-LOCAL_JAVA_LIBRARIES := android.test.base
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt androidx.test.rules
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/SurfaceComposition/Android.bp b/tests/SurfaceComposition/Android.bp
new file mode 100644
index 000000000000..53e4d52b2efd
--- /dev/null
+++ b/tests/SurfaceComposition/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 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.
+
+android_test {
+ name: "SurfaceComposition",
+ // Don't include this package in any target
+ // When built, explicitly put it in the data partition.
+ dex_preopt: {
+ enabled: false,
+ },
+ optimize: {
+ enabled: false,
+ },
+ srcs: ["src/**/*.java"],
+ static_libs: ["junit"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ sdk_version: "current",
+}
diff --git a/tests/SurfaceComposition/Android.mk b/tests/SurfaceComposition/Android.mk
deleted file mode 100644
index f59458d48c68..000000000000
--- a/tests/SurfaceComposition/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2015 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_PACKAGE_NAME := SurfaceComposition
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/tests/SystemMemoryTest/Android.mk b/tests/SystemMemoryTest/Android.mk
deleted file mode 100644
index 09a1618c6ad1..000000000000
--- a/tests/SystemMemoryTest/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/SystemMemoryTest/device/Android.bp b/tests/SystemMemoryTest/device/Android.bp
new file mode 100644
index 000000000000..2bf0fec0fd1f
--- /dev/null
+++ b/tests/SystemMemoryTest/device/Android.bp
@@ -0,0 +1,20 @@
+// 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.
+
+android_test_helper_app {
+ name: "SystemMemoryTestDevice",
+ sdk_version: "current",
+ srcs: ["src/**/*.java"],
+ test_suites: ["general-tests"],
+}
diff --git a/tests/SystemMemoryTest/device/Android.mk b/tests/SystemMemoryTest/device/Android.mk
deleted file mode 100644
index 75408df4b295..000000000000
--- a/tests/SystemMemoryTest/device/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_PACKAGE_NAME := SystemMemoryTestDevice
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_COMPATIBILITY_SUITE := general-tests
-include $(BUILD_PACKAGE)
diff --git a/tests/SystemMemoryTest/host/Android.bp b/tests/SystemMemoryTest/host/Android.bp
new file mode 100644
index 000000000000..3bb5489dab6c
--- /dev/null
+++ b/tests/SystemMemoryTest/host/Android.bp
@@ -0,0 +1,20 @@
+// 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.
+
+java_test_host {
+ name: "system-memory-test",
+ srcs: ["src/**/*.java"],
+ libs: ["tradefed"],
+ test_suites: ["general-tests"],
+}
diff --git a/tests/SystemMemoryTest/host/Android.mk b/tests/SystemMemoryTest/host/Android.mk
deleted file mode 100644
index a516e38adfec..000000000000
--- a/tests/SystemMemoryTest/host/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE := system-memory-test
-LOCAL_MODULE_TAGS := optional
-LOCAL_JAVA_LIBRARIES := tradefed
-LOCAL_COMPATIBILITY_SUITE := general-tests
-include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tests/UsageReportingTest/Android.bp b/tests/UsageReportingTest/Android.bp
new file mode 100644
index 000000000000..0bac5a224b26
--- /dev/null
+++ b/tests/UsageReportingTest/Android.bp
@@ -0,0 +1,8 @@
+android_test {
+ name: "UsageReportingTest",
+ // Only compile source java files in this apk.
+ srcs: ["src/**/*.java"],
+ static_libs: ["androidx.legacy_legacy-support-v4"],
+ certificate: "platform",
+ platform_apis: true,
+}
diff --git a/tests/UsageReportingTest/Android.mk b/tests/UsageReportingTest/Android.mk
deleted file mode 100644
index afb6e16b1fdf..000000000000
--- a/tests/UsageReportingTest/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_USE_AAPT2 := true
-LOCAL_STATIC_ANDROID_LIBRARIES := androidx.legacy_legacy-support-v4
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_PACKAGE_NAME := UsageReportingTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/tests/UsageStatsPerfTests/Android.bp b/tests/UsageStatsPerfTests/Android.bp
new file mode 100644
index 000000000000..3991fb8366ac
--- /dev/null
+++ b/tests/UsageStatsPerfTests/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test {
+ name: "UsageStatsPerfTests",
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "androidx.test.rules",
+ "apct-perftests-utils",
+ "services.usage",
+ ],
+ platform_apis: true,
+ // For android.permission.FORCE_STOP_PACKAGES permission
+ certificate: "platform",
+}
diff --git a/tests/UsageStatsPerfTests/Android.mk b/tests/UsageStatsPerfTests/Android.mk
deleted file mode 100644
index 4304fb0d8e9e..000000000000
--- a/tests/UsageStatsPerfTests/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
- apct-perftests-utils \
- services.usage
-
-LOCAL_PACKAGE_NAME := UsageStatsPerfTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-# For android.permission.FORCE_STOP_PACKAGES permission
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/tests/UsbHostExternalManagmentTest/AoapTestDevice/Android.bp b/tests/UsbHostExternalManagmentTest/AoapTestDevice/Android.bp
new file mode 100644
index 000000000000..c7e9df0fe9cf
--- /dev/null
+++ b/tests/UsbHostExternalManagmentTest/AoapTestDevice/Android.bp
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+
+//#################################################
+
+android_test {
+ name: "AoapTestDeviceApp",
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ platform_apis: true,
+ optimize: {
+ enabled: false,
+ },
+}
diff --git a/tests/UsbHostExternalManagmentTest/AoapTestDevice/Android.mk b/tests/UsbHostExternalManagmentTest/AoapTestDevice/Android.mk
deleted file mode 100644
index cd7aaedf2bb1..000000000000
--- a/tests/UsbHostExternalManagmentTest/AoapTestDevice/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-##################################################
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := AoapTestDeviceApp
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/UsbHostExternalManagmentTest/AoapTestHost/Android.bp b/tests/UsbHostExternalManagmentTest/AoapTestHost/Android.bp
new file mode 100644
index 000000000000..6fa58cb5c682
--- /dev/null
+++ b/tests/UsbHostExternalManagmentTest/AoapTestHost/Android.bp
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+
+//#################################################
+
+android_test {
+ name: "AoapTestHostApp",
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ platform_apis: true,
+ optimize: {
+ enabled: false,
+ },
+}
diff --git a/tests/UsbHostExternalManagmentTest/AoapTestHost/Android.mk b/tests/UsbHostExternalManagmentTest/AoapTestHost/Android.mk
deleted file mode 100644
index bd8a51b69bff..000000000000
--- a/tests/UsbHostExternalManagmentTest/AoapTestHost/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-##################################################
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := AoapTestHostApp
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/Android.bp b/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/Android.bp
new file mode 100644
index 000000000000..edd4205968b3
--- /dev/null
+++ b/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+
+//#################################################
+
+// TODO: should this be android_helper_test_app?
+android_app {
+ name: "UsbHostExternalManagementTestApp",
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ platform_apis: true,
+ privileged: true,
+ // TODO remove tests tag
+ //LOCAL_MODULE_TAGS := tests
+ //LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+ optimize: {
+ enabled: false,
+ },
+}
diff --git a/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/Android.mk b/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/Android.mk
deleted file mode 100644
index fed454eb9d01..000000000000
--- a/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-##################################################
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := UsbHostExternalManagementTestApp
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_PRIVILEGED_MODULE := true
-# TODO remove tests tag
-#LOCAL_MODULE_TAGS := tests
-#LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/UsbTests/Android.bp b/tests/UsbTests/Android.bp
new file mode 100644
index 000000000000..1b2cf638f514
--- /dev/null
+++ b/tests/UsbTests/Android.bp
@@ -0,0 +1,34 @@
+//
+// 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.
+//
+
+android_test {
+ name: "UsbTests",
+ srcs: ["**/*.java"],
+ static_libs: [
+ "frameworks-base-testutils",
+ "androidx.test.rules",
+ "mockito-target-inline-minus-junit4",
+ "platform-test-annotations",
+ "services.core",
+ "services.net",
+ "services.usb",
+ "truth-prebuilt",
+ ],
+ jni_libs: ["libdexmakerjvmtiagent"],
+ certificate: "platform",
+ platform_apis: true,
+ test_suites: ["device-tests"],
+}
diff --git a/tests/UsbTests/Android.mk b/tests/UsbTests/Android.mk
deleted file mode 100644
index aef993b9d348..000000000000
--- a/tests/UsbTests/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- frameworks-base-testutils \
- androidx.test.rules \
- mockito-target-inline-minus-junit4 \
- platform-test-annotations \
- services.core \
- services.net \
- services.usb \
- truth-prebuilt \
-
-LOCAL_JNI_SHARED_LIBRARIES := \
- libdexmakerjvmtiagent \
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_PACKAGE_NAME := UsbTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/WindowAnimationJank/Android.bp b/tests/WindowAnimationJank/Android.bp
new file mode 100644
index 000000000000..50b2297386cc
--- /dev/null
+++ b/tests/WindowAnimationJank/Android.bp
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 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.
+
+android_test {
+ name: "WindowAnimationJank",
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "ub-uiautomator",
+ "androidx.test.janktesthelper",
+ "junit",
+ ],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "current",
+}
diff --git a/tests/WindowAnimationJank/Android.mk b/tests/WindowAnimationJank/Android.mk
deleted file mode 100644
index 1c2d16787e88..000000000000
--- a/tests/WindowAnimationJank/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2015 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := WindowAnimationJank
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- ub-uiautomator \
- androidx.test.janktesthelper \
- junit
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 379819d417a1..476330052dcf 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -1171,39 +1171,49 @@ public class WifiConfiguration implements Parcelable {
* This network is disabled because EAP-TLS failure
*/
public static final int DISABLED_TLS_VERSION_MISMATCH = 8;
+ /**
+ * This network is disabled due to WifiManager.disconnect() call.
+ */
+ public static final int DISABLED_BY_WIFI_MANAGER_DISCONNECT = 9;
+
// Values above are for temporary disablement; values below are for permanent disablement.
/**
+ * The starting index for permanent network selection disabled reasons
+ */
+ public static final int NETWORK_SELECTION_DISABLED_PERMANENT_STARTING_INDEX = 10;
+ /**
* This network is disabled due to absence of user credentials
*/
- public static final int DISABLED_AUTHENTICATION_NO_CREDENTIALS = 9;
+ public static final int DISABLED_AUTHENTICATION_NO_CREDENTIALS = 10;
/**
* This network is permanently disabled because it has no Internet access and user does not
* want to stay connected.
*/
- public static final int DISABLED_NO_INTERNET_PERMANENT = 10;
+ public static final int DISABLED_NO_INTERNET_PERMANENT = 11;
/**
- * This network is disabled due to WifiManager disable it explicitly
+ * This network is disabled due to WifiManager.disable() call.
*/
- public static final int DISABLED_BY_WIFI_MANAGER = 11;
+ public static final int DISABLED_BY_WIFI_MANAGER = 12;
/**
* This network is disabled due to user switching
*/
- public static final int DISABLED_DUE_TO_USER_SWITCH = 12;
+ public static final int DISABLED_DUE_TO_USER_SWITCH = 13;
/**
* This network is disabled due to wrong password
*/
- public static final int DISABLED_BY_WRONG_PASSWORD = 13;
+ public static final int DISABLED_BY_WRONG_PASSWORD = 14;
/**
* This network is disabled because service is not subscribed
*/
- public static final int DISABLED_AUTHENTICATION_NO_SUBSCRIPTION = 14;
+ public static final int DISABLED_AUTHENTICATION_NO_SUBSCRIPTION = 15;
/**
* This Maximum disable reason value
*/
- public static final int NETWORK_SELECTION_DISABLED_MAX = 15;
+ public static final int NETWORK_SELECTION_DISABLED_MAX = 16;
/**
- * Quality network selection disable reason String (for debug purpose)
+ * Quality network selection disable reason String (for debug purposes & configuration
+ * storage)
*/
public static final String[] QUALITY_NETWORK_SELECTION_DISABLE_REASON = {
"NETWORK_SELECTION_ENABLE",
@@ -1215,6 +1225,7 @@ public class WifiConfiguration implements Parcelable {
"NETWORK_SELECTION_DISABLED_NO_INTERNET_TEMPORARY",
"NETWORK_SELECTION_DISABLED_WPS_START",
"NETWORK_SELECTION_DISABLED_TLS_VERSION",
+ "NETWORK_SELECTION_DISABLED_BY_WIFI_MANAGER_DISCONNECT",
"NETWORK_SELECTION_DISABLED_AUTHENTICATION_NO_CREDENTIALS",
"NETWORK_SELECTION_DISABLED_NO_INTERNET_PERMANENT",
"NETWORK_SELECTION_DISABLED_BY_WIFI_MANAGER",
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 52e03ce5e197..d38b2f49048b 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -948,7 +948,8 @@ public class WifiManager {
/**
* Directed broadcast intent action indicating that the device has connected to one of the
* network suggestions provided by the app. This will be sent post connection to a network
- * which was created with {@link WifiNetworkSuggestion.Builder#setIsAppInteractionRequired()}
+ * which was created with {@link WifiNetworkSuggestion.Builder#setIsAppInteractionRequired(
+ * boolean)}
* flag set.
* <p>
* Note: The broadcast is sent to the app only if it holds
diff --git a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
index 8b56b3f24593..6c2d7ff882d3 100644
--- a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
+++ b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
@@ -183,10 +183,12 @@ public final class WifiNetworkSpecifier extends NetworkSpecifier implements Parc
/**
* Specifies whether this represents an Enhanced Open (OWE) network.
*
+ * @param isEnhancedOpen {@code true} to indicate that the network uses enhanced open,
+ * {@code false} otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
- public @NonNull Builder setIsEnhancedOpen() {
- mIsEnhancedOpen = true;
+ public @NonNull Builder setIsEnhancedOpen(boolean isEnhancedOpen) {
+ mIsEnhancedOpen = isEnhancedOpen;
return this;
}
@@ -261,10 +263,12 @@ public final class WifiNetworkSpecifier extends NetworkSpecifier implements Parc
* hidden networks need to be explicitly probed for.</li>
* <li>If not set, defaults to false (i.e not a hidden network).</li>
*
+ * @param isHiddenSsid {@code true} to indicate that the network is hidden, {@code false}
+ * otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
- public @NonNull Builder setIsHiddenSsid() {
- mIsHiddenSSID = true;
+ public @NonNull Builder setIsHiddenSsid(boolean isHiddenSsid) {
+ mIsHiddenSSID = isHiddenSsid;
return this;
}
diff --git a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java
index 3742b83d5836..32a7a477466d 100644
--- a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java
+++ b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java
@@ -18,6 +18,7 @@ package android.net.wifi;
import static com.android.internal.util.Preconditions.checkNotNull;
+import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityThread;
@@ -159,10 +160,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
/**
* Specifies whether this represents an Enhanced Open (OWE) network.
*
+ * @param isEnhancedOpen {@code true} to indicate that the network used enhanced open,
+ * {@code false} otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
- public @NonNull Builder setIsEnhancedOpen() {
- mIsEnhancedOpen = true;
+ public @NonNull Builder setIsEnhancedOpen(boolean isEnhancedOpen) {
+ mIsEnhancedOpen = isEnhancedOpen;
return this;
}
@@ -235,10 +238,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
* <p>
* <li>If not set, defaults to false (i.e not a hidden network).</li>
*
+ * @param isHiddenSsid {@code true} to indicate that the network is hidden, {@code false}
+ * otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
- public @NonNull Builder setIsHiddenSsid() {
- mIsHiddenSSID = true;
+ public @NonNull Builder setIsHiddenSsid(boolean isHiddenSsid) {
+ mIsHiddenSSID = isHiddenSsid;
return this;
}
@@ -253,10 +258,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
* <p>
* <li>If not set, defaults to false (i.e no app interaction required).</li>
*
+ * @param isAppInteractionRequired {@code true} to indicate that app interaction is
+ * required, {@code false} otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
- public @NonNull Builder setIsAppInteractionRequired() {
- mIsAppInteractionRequired = true;
+ public @NonNull Builder setIsAppInteractionRequired(boolean isAppInteractionRequired) {
+ mIsAppInteractionRequired = isAppInteractionRequired;
return this;
}
@@ -265,10 +272,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
* <p>
* <li>If not set, defaults to false (i.e no user interaction required).</li>
*
+ * @param isUserInteractionRequired {@code true} to indicate that user interaction is
+ * required, {@code false} otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
- public @NonNull Builder setIsUserInteractionRequired() {
- mIsUserInteractionRequired = true;
+ public @NonNull Builder setIsUserInteractionRequired(boolean isUserInteractionRequired) {
+ mIsUserInteractionRequired = isUserInteractionRequired;
return this;
}
@@ -283,7 +292,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if the priority value is negative.
*/
- public @NonNull Builder setPriority(int priority) {
+ public @NonNull Builder setPriority(@IntRange(from = 0) int priority) {
if (priority < 0) {
throw new IllegalArgumentException("Invalid priority value " + priority);
}
@@ -296,10 +305,12 @@ public final class WifiNetworkSuggestion implements Parcelable {
* <p>
* <li>If not set, defaults to false (i.e not metered).</li>
*
+ * @param isMetered {@code true} to indicate that the network is metered, {@code false}
+ * otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
- public @NonNull Builder setIsMetered() {
- mIsMetered = true;
+ public @NonNull Builder setIsMetered(boolean isMetered) {
+ mIsMetered = isMetered;
return this;
}
diff --git a/wifi/tests/runtests.sh b/wifi/tests/runtests.sh
index 2caf8a59b9fb..1e0ec37c52e2 100755
--- a/wifi/tests/runtests.sh
+++ b/wifi/tests/runtests.sh
@@ -19,7 +19,7 @@ set -x # print commands
adb root
adb wait-for-device
-adb install -r -g "$OUT/data/app/FrameworksWifiApiTests/FrameworksWifiApiTests.apk"
+adb install -r -g "$OUT/testcases/FrameworksWifiApiTests/arm64/FrameworksWifiApiTests.apk"
adb shell am instrument --no-hidden-api-checks -w "$@" \
'android.net.wifi.test/androidx.test.runner.AndroidJUnitRunner'
diff --git a/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java b/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java
index feac0e598127..edb43d8bdf52 100644
--- a/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java
@@ -114,7 +114,7 @@ public class WifiNetworkSpecifierTest {
.setSsid(TEST_SSID)
.setBssid(MacAddress.fromString(TEST_BSSID))
.setWpa2EnterpriseConfig(enterpriseConfig)
- .setIsHiddenSsid()
+ .setIsHiddenSsid(true)
.build();
assertTrue(specifier instanceof WifiNetworkSpecifier);
@@ -278,7 +278,7 @@ public class WifiNetworkSpecifierTest {
new WifiNetworkSpecifier.Builder()
.setBssidPattern(MacAddress.fromString(TEST_BSSID_OUI_BASE_ADDRESS),
MacAddress.fromString(TEST_BSSID_OUI_MASK))
- .setIsHiddenSsid()
+ .setIsHiddenSsid(true)
.build();
}
@@ -305,7 +305,7 @@ public class WifiNetworkSpecifierTest {
public void testWifiNetworkSpecifierBuilderWithSsidMatchPatternForHiddenNetwork() {
new WifiNetworkSpecifier.Builder()
.setSsidPattern(new PatternMatcher(TEST_SSID, PATTERN_PREFIX))
- .setIsHiddenSsid()
+ .setIsHiddenSsid(true)
.build();
}
@@ -341,14 +341,14 @@ public class WifiNetworkSpecifierTest {
/**
* Ensure {@link WifiNetworkSpecifier.Builder#build()} throws an exception
* when both {@link WifiNetworkSpecifier.Builder#setWpa3Passphrase(String)} and
- * {@link WifiNetworkSpecifier.Builder#setIsEnhancedOpen()} are invoked.
+ * {@link WifiNetworkSpecifier.Builder#setIsEnhancedOpen(boolean)} are invoked.
*/
@Test(expected = IllegalStateException.class)
public void testWifiNetworkSpecifierBuilderWithBothWpa3PasphraseAndEnhancedOpen() {
new WifiNetworkSpecifier.Builder()
.setSsidPattern(new PatternMatcher(TEST_SSID, PATTERN_LITERAL))
.setWpa3Passphrase(TEST_PRESHARED_KEY)
- .setIsEnhancedOpen()
+ .setIsEnhancedOpen(true)
.build();
}
diff --git a/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java b/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java
index 05ee22c90464..2b0c7732e7ae 100644
--- a/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiNetworkSuggestionTest.java
@@ -49,7 +49,7 @@ public class WifiNetworkSuggestionTest {
public void testWifiNetworkSuggestionBuilderForOpenNetworkWithReqAppInteraction() {
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
.setSsid(TEST_SSID)
- .setIsAppInteractionRequired()
+ .setIsAppInteractionRequired(true)
.build();
assertEquals(Process.myUid(), suggestion.suggestorUid);
@@ -74,7 +74,7 @@ public class WifiNetworkSuggestionTest {
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
.setSsid(TEST_SSID)
.setWpa2Passphrase(TEST_PRESHARED_KEY)
- .setIsAppInteractionRequired()
+ .setIsAppInteractionRequired(true)
.setPriority(0)
.build();
@@ -101,8 +101,8 @@ public class WifiNetworkSuggestionTest {
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
.setSsid(TEST_SSID)
.setWpa2Passphrase(TEST_PRESHARED_KEY)
- .setIsUserInteractionRequired()
- .setIsMetered()
+ .setIsUserInteractionRequired(true)
+ .setIsMetered(true)
.build();
assertEquals("\"" + TEST_SSID + "\"", suggestion.wifiConfiguration.SSID);
@@ -126,7 +126,7 @@ public class WifiNetworkSuggestionTest {
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
.setSsid(TEST_SSID)
.setBssid(MacAddress.fromString(TEST_BSSID))
- .setIsEnhancedOpen()
+ .setIsEnhancedOpen(true)
.build();
assertEquals("\"" + TEST_SSID + "\"", suggestion.wifiConfiguration.SSID);
@@ -265,7 +265,7 @@ public class WifiNetworkSuggestionTest {
public void testWifiNetworkSuggestionBuilderWithInvalidPriority() {
new WifiNetworkSuggestion.Builder()
.setSsid(TEST_SSID)
- .setPriority(-1)
+ .setPriority(-2)
.build();
}
@@ -301,14 +301,14 @@ public class WifiNetworkSuggestionTest {
/**
* Ensure {@link WifiNetworkSuggestion.Builder#build()} throws an exception
* when both {@link WifiNetworkSuggestion.Builder#setWpa3Passphrase(String)} and
- * {@link WifiNetworkSuggestion.Builder#setIsEnhancedOpen()} are invoked.
+ * {@link WifiNetworkSuggestion.Builder#setIsEnhancedOpen(boolean)} are invoked.
*/
@Test(expected = IllegalStateException.class)
public void testWifiNetworkSuggestionBuilderWithBothWpa3PasphraseAndEnhancedOpen() {
new WifiNetworkSuggestion.Builder()
.setSsid(TEST_SSID)
.setWpa3Passphrase(TEST_PRESHARED_KEY)
- .setIsEnhancedOpen()
+ .setIsEnhancedOpen(true)
.build();
}