diff options
119 files changed, 2001 insertions, 481 deletions
diff --git a/Android.bp b/Android.bp index 17e31e04506f..b01c3c7c920d 100644 --- a/Android.bp +++ b/Android.bp @@ -507,7 +507,7 @@ java_defaults { "telephony/java/android/telephony/ims/aidl/IImsServiceController.aidl", "telephony/java/android/telephony/ims/aidl/IImsServiceControllerListener.aidl", "telephony/java/android/telephony/ims/aidl/IImsSmsListener.aidl", - "telephony/java/android/telephony/ims/aidl/IRcs.aidl", + "telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl", "telephony/java/android/telephony/mbms/IMbmsDownloadSessionCallback.aidl", "telephony/java/android/telephony/mbms/IMbmsStreamingSessionCallback.aidl", "telephony/java/android/telephony/mbms/IMbmsGroupCallSessionCallback.aidl", @@ -1275,7 +1275,6 @@ stubs_defaults { libs: [ "ext", "framework", - "voip-common", ], local_sourcepaths: frameworks_base_subdirs, installable: false, diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index 543f0edbf835..e731138ff40d 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -9,6 +9,8 @@ hidden_api_txt_checksorted_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/c hidden_api_txt_exclude_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/exclude.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} +ktlint_hook = ${REPO_ROOT}/prebuilts/ktlint/ktlint.py -f ${PREUPLOAD_FILES} + owners_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "OWNERS$" shell_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "^packages/Shell/" diff --git a/api/current.txt b/api/current.txt index 015874d6e30c..b22c949f8715 100755 --- a/api/current.txt +++ b/api/current.txt @@ -11361,6 +11361,9 @@ package android.content.pm { field public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY = "android.hardware.sensor.relative_humidity"; field public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter"; field public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector"; + field public static final String FEATURE_SE_OMAPI_ESE = "android.hardware.se.omapi.ese"; + field public static final String FEATURE_SE_OMAPI_SD = "android.hardware.se.omapi.sd"; + field public static final String FEATURE_SE_OMAPI_UICC = "android.hardware.se.omapi.uicc"; field public static final String FEATURE_SIP = "android.software.sip"; field public static final String FEATURE_SIP_VOIP = "android.software.sip.voip"; field public static final String FEATURE_STRONGBOX_KEYSTORE = "android.hardware.strongbox_keystore"; @@ -37412,7 +37415,7 @@ package android.provider { field public static final String CONTENT_ID = "cid"; field public static final String CONTENT_LOCATION = "cl"; field public static final String CONTENT_TYPE = "ct"; - field public static final android.net.Uri CONTENT_URI; + field @NonNull public static final android.net.Uri CONTENT_URI; field public static final String CT_START = "ctt_s"; field public static final String CT_TYPE = "ctt_t"; field public static final String FILENAME = "fn"; diff --git a/api/system-current.txt b/api/system-current.txt index 7f29b1d05fc4..593b45db5809 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -4270,6 +4270,7 @@ package android.os { public class UpdateEngine { ctor public UpdateEngine(); method public void applyPayload(String, long, long, String[]); + method public void applyPayload(java.io.FileDescriptor, long, long, String[]); method public boolean bind(android.os.UpdateEngineCallback, android.os.Handler); method public boolean bind(android.os.UpdateEngineCallback); method public void cancel(); diff --git a/cmds/bootanimation/Android.bp b/cmds/bootanimation/Android.bp index 60a1cfbe9dd7..e17f735b93a4 100644 --- a/cmds/bootanimation/Android.bp +++ b/cmds/bootanimation/Android.bp @@ -76,7 +76,6 @@ cc_library_shared { "libEGL", "libGLESv1_CM", "libgui", - "libtinyalsa", ], product_variables: { diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index ed6c25dc49c3..95bdc4a79af9 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -63,6 +63,10 @@ #include "BootAnimation.h" +#define ANIM_PATH_MAX 255 +#define STR(x) #x +#define STRTO(x) STR(x) + namespace android { static const char OEM_BOOTANIMATION_FILE[] = "/oem/media/bootanimation.zip"; @@ -94,7 +98,7 @@ static constexpr size_t FONT_NUM_ROWS = FONT_NUM_CHARS / FONT_NUM_COLS; static const int TEXT_CENTER_VALUE = INT_MAX; static const int TEXT_MISSING_VALUE = INT_MIN; static const char EXIT_PROP_NAME[] = "service.bootanim.exit"; -static const int ANIM_ENTRY_NAME_MAX = 256; +static const int ANIM_ENTRY_NAME_MAX = ANIM_PATH_MAX + 1; static constexpr size_t TEXT_POS_LEN_MAX = 16; // --------------------------------------------------------------------------- @@ -658,7 +662,7 @@ bool BootAnimation::parseAnimationDesc(Animation& animation) animation.width = width; animation.height = height; animation.fps = fps; - } else if (sscanf(l, " %c %d %d %s #%6s %16s %16s", + } else if (sscanf(l, " %c %d %d %" STRTO(ANIM_PATH_MAX) "s #%6s %16s %16s", &pathType, &count, &pause, path, color, clockPos1, clockPos2) >= 4) { //ALOGD("> type=%c, count=%d, pause=%d, path=%s, color=%s, clockPos1=%s, clockPos2=%s", // pathType, count, pause, path, color, clockPos1, clockPos2); diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 1254f1a3afa0..f9b6219747f7 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -2871,6 +2871,9 @@ message NetworkDnsEventReported { // Additional pass-through fields opaque to statsd. // The DNS resolver Mainline module can add new fields here without requiring an OS update. optional android.stats.dnsresolver.DnsQueryEvents dns_query_events = 8 [(log_mode) = MODE_BYTES]; + + // The sample rate of DNS stats (to statsd) is 1/sampling_rate_denom. + optional int32 sampling_rate_denom = 9; } /** diff --git a/config/hiddenapi-greylist-max-p.txt b/config/hiddenapi-greylist-max-p.txt index f201063ef12e..a32fbec768e3 100644 --- a/config/hiddenapi-greylist-max-p.txt +++ b/config/hiddenapi-greylist-max-p.txt @@ -68,6 +68,8 @@ Lcom/android/internal/R$styleable;->MenuView:[I Lcom/android/internal/R$styleable;->Searchable:[I Lcom/android/internal/R$styleable;->SearchableActionKey:[I Lcom/android/internal/telephony/IPhoneSubInfo$Stub;-><init>()V +Lcom/android/internal/telephony/ITelephony;->getDataActivity()I +Lcom/android/internal/telephony/ITelephony;->getDataState()I Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCallForwardingChanged(Z)V Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCellLocation(Landroid/os/Bundle;)V Lcom/android/internal/telephony/ITelephonyRegistry;->notifyDataActivity(I)V diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index d9c82ea31537..6c67191eb3eb 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -703,6 +703,8 @@ public final class ActivityThread extends ClientTransactionHandler { boolean autofillCompatibilityEnabled; + long[] disabledCompatChanges; + public String toString() { return "AppBindData{appInfo=" + appInfo + "}"; } @@ -920,7 +922,8 @@ public final class ActivityThread extends ClientTransactionHandler { boolean enableBinderTracking, boolean trackAllocation, boolean isRestrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map services, Bundle coreSettings, - String buildSerial, boolean autofillCompatibilityEnabled) { + String buildSerial, boolean autofillCompatibilityEnabled, + long[] disabledCompatChanges) { if (services != null) { if (false) { @@ -968,6 +971,7 @@ public final class ActivityThread extends ClientTransactionHandler { data.initProfilerInfo = profilerInfo; data.buildSerial = buildSerial; data.autofillCompatibilityEnabled = autofillCompatibilityEnabled; + data.disabledCompatChanges = disabledCompatChanges; sendMessage(H.BIND_APPLICATION, data); } @@ -5670,6 +5674,7 @@ public final class ActivityThread extends ClientTransactionHandler { // Note when this process has started. Process.setStartTimes(SystemClock.elapsedRealtime(), SystemClock.uptimeMillis()); + AppCompatCallbacks.install(data.disabledCompatChanges); mBoundApplication = data; mConfiguration = new Configuration(data.config); mCompatConfiguration = new Configuration(data.config); diff --git a/core/java/android/app/AppCompatCallbacks.java b/core/java/android/app/AppCompatCallbacks.java new file mode 100644 index 000000000000..17697dba9ccd --- /dev/null +++ b/core/java/android/app/AppCompatCallbacks.java @@ -0,0 +1,64 @@ +/* + * 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 android.app; + +import android.compat.Compatibility; +import android.os.Process; +import android.util.Log; + +import java.util.Arrays; + +/** + * App process implementation of the {@link Compatibility} API. + * + * @hide + */ +public final class AppCompatCallbacks extends Compatibility.Callbacks { + + private static final String TAG = "Compatibility"; + + private final long[] mDisabledChanges; + + /** + * Install this class into the current process. + * + * @param disabledChanges Set of compatibility changes that are disabled for this process. + */ + public static void install(long[] disabledChanges) { + Compatibility.setCallbacks(new AppCompatCallbacks(disabledChanges)); + } + + private AppCompatCallbacks(long[] disabledChanges) { + mDisabledChanges = Arrays.copyOf(disabledChanges, disabledChanges.length); + Arrays.sort(mDisabledChanges); + } + + protected void reportChange(long changeId) { + Log.d(TAG, "Compat change reported: " + changeId + "; UID " + Process.myUid()); + // TODO log via StatsLog + } + + protected boolean isChangeEnabled(long changeId) { + if (Arrays.binarySearch(mDisabledChanges, changeId) < 0) { + // Not present in the disabled array + reportChange(changeId); + return true; + } + return false; + } + +} diff --git a/core/java/android/app/IApplicationThread.aidl b/core/java/android/app/IApplicationThread.aidl index d478cd6e5946..1f45fc5b8752 100644 --- a/core/java/android/app/IApplicationThread.aidl +++ b/core/java/android/app/IApplicationThread.aidl @@ -67,7 +67,8 @@ oneway interface IApplicationThread { int debugMode, boolean enableBinderTracking, boolean trackAllocation, boolean restrictedBackupMode, boolean persistent, in Configuration config, in CompatibilityInfo compatInfo, in Map services, - in Bundle coreSettings, in String buildSerial, boolean isAutofillCompatEnabled); + in Bundle coreSettings, in String buildSerial, boolean isAutofillCompatEnabled, + in long[] disabledCompatChanges); void runIsolatedEntryPoint(in String entryPoint, in String[] entryPointArgs); void scheduleExit(); void scheduleServiceArgs(IBinder token, in ParceledListSlice args); diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index f6b7eefc7864..94aa4811b846 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -149,7 +149,8 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.telephony.euicc.EuiccCardManager; import android.telephony.euicc.EuiccManager; -import android.telephony.ims.RcsManager; +import android.telephony.ims.RcsMessageManager; +import android.util.ArrayMap; import android.util.Log; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; @@ -171,7 +172,7 @@ import com.android.internal.net.INetworkWatchlistManager; import com.android.internal.os.IDropBoxManagerService; import com.android.internal.policy.PhoneLayoutInflater; -import java.util.HashMap; +import java.util.Map; /** * Manages all of the system services that can be returned by {@link Context#getSystemService}. @@ -182,10 +183,10 @@ final class SystemServiceRegistry { // Service registry information. // This information is never changed once static initialization has completed. - private static final HashMap<Class<?>, String> SYSTEM_SERVICE_NAMES = - new HashMap<Class<?>, String>(); - private static final HashMap<String, ServiceFetcher<?>> SYSTEM_SERVICE_FETCHERS = - new HashMap<String, ServiceFetcher<?>>(); + private static final Map<Class<?>, String> SYSTEM_SERVICE_NAMES = + new ArrayMap<Class<?>, String>(); + private static final Map<String, ServiceFetcher<?>> SYSTEM_SERVICE_FETCHERS = + new ArrayMap<String, ServiceFetcher<?>>(); private static int sServiceCacheSize; // Not instantiable. @@ -551,11 +552,11 @@ final class SystemServiceRegistry { return new SubscriptionManager(ctx.getOuterContext()); }}); - registerService(Context.TELEPHONY_RCS_SERVICE, RcsManager.class, - new CachedServiceFetcher<RcsManager>() { + registerService(Context.TELEPHONY_RCS_MESSAGE_SERVICE, RcsMessageManager.class, + new CachedServiceFetcher<RcsMessageManager>() { @Override - public RcsManager createService(ContextImpl ctx) { - return new RcsManager(ctx.getOuterContext()); + public RcsMessageManager createService(ContextImpl ctx) { + return new RcsMessageManager(ctx.getOuterContext()); } }); diff --git a/core/java/android/bluetooth/BluetoothHeadsetClient.java b/core/java/android/bluetooth/BluetoothHeadsetClient.java index 05833b5f571d..5d00f09501b0 100644 --- a/core/java/android/bluetooth/BluetoothHeadsetClient.java +++ b/core/java/android/bluetooth/BluetoothHeadsetClient.java @@ -126,6 +126,17 @@ public final class BluetoothHeadsetClient implements BluetoothProfile { "android.bluetooth.headsetclient.profile.action.RESULT"; /** + * Intent that notifies about vendor specific event arrival. Events not defined in + * HFP spec will be matched with supported vendor event list and this intent will + * be broadcasted upon a match. Supported vendor events are of format of + * of "+eventCode" or "+eventCode=xxxx" or "+eventCode:=xxxx". + * Vendor event can be a response to an vendor specific command or unsolicited. + * + */ + public static final String ACTION_VENDOR_SPECIFIC_HEADSETCLIENT_EVENT = + "android.bluetooth.headsetclient.profile.action.VENDOR_SPECIFIC_EVENT"; + + /** * Intent that notifies about the number attached to the last voice tag * recorded on AG. * @@ -243,6 +254,28 @@ public final class BluetoothHeadsetClient implements BluetoothProfile { public static final String EXTRA_CME_CODE = "android.bluetooth.headsetclient.extra.CME_CODE"; + /** + * Extra for VENDOR_SPECIFIC_HEADSETCLIENT_EVENT intent that + * indicates vendor ID. + */ + public static final String EXTRA_VENDOR_ID = + "android.bluetooth.headsetclient.extra.VENDOR_ID"; + + /** + * Extra for VENDOR_SPECIFIC_HEADSETCLIENT_EVENT intent that + * indicates vendor event code. + */ + public static final String EXTRA_VENDOR_EVENT_CODE = + "android.bluetooth.headsetclient.extra.VENDOR_EVENT_CODE"; + + /** + * Extra for VENDOR_SPECIFIC_HEADSETCLIENT_EVENT intent that + * contains full vendor event including event code and full arguments. + */ + public static final String EXTRA_VENDOR_EVENT_FULL_ARGS = + "android.bluetooth.headsetclient.extra.VENDOR_EVENT_FULL_ARGS"; + + /* Extras for AG_FEATURES, extras type is boolean */ // TODO verify if all of those are actually useful /** @@ -588,6 +621,31 @@ public final class BluetoothHeadsetClient implements BluetoothProfile { } /** + * Send vendor specific AT command. + * + * @param device remote device + * @param vendorId vendor number by Bluetooth SIG + * @param atCommand command to be sent. It start with + prefix and only one command at one time. + * @return <code>true</code> if command has been issued successfully; <code>false</code> + * otherwise. + */ + public boolean sendVendorAtCommand(BluetoothDevice device, int vendorId, + String atCommand) { + if (DBG) log("sendVendorSpecificCommand()"); + final IBluetoothHeadsetClient service = + getService(); + if (service != null && isEnabled() && isValidDevice(device)) { + try { + return service.sendVendorAtCommand(device, vendorId, atCommand); + } catch (RemoteException e) { + Log.e(TAG, Log.getStackTraceString(new Throwable())); + } + } + if (service == null) Log.w(TAG, "Proxy not attached to service"); + return false; + } + + /** * Stops voice recognition. * * @param device remote device diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 9223f71b4428..99ff53dcb904 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -2948,7 +2948,7 @@ public abstract class Context { * @hide */ @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) - @UnsupportedAppUsage + @UnsupportedAppUsage(trackingBug = 136728678) public boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags, Handler handler, UserHandle user) { throw new RuntimeException("Not implemented. Must override in a subclass."); @@ -4290,10 +4290,10 @@ public abstract class Context { /** * Use with {@link #getSystemService(String)} to retrieve an - * {@link android.telephony.ims.RcsManager}. + * {@link android.telephony.ims.RcsMessageManager}. * @hide */ - public static final String TELEPHONY_RCS_SERVICE = "ircs"; + public static final String TELEPHONY_RCS_MESSAGE_SERVICE = "ircsmessage"; /** * Use with {@link #getSystemService(String)} to retrieve an diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index a9ba6ca1ea99..43cbfe97ea0a 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -52,6 +52,8 @@ import android.provider.DocumentsContract; import android.provider.DocumentsProvider; import android.provider.MediaStore; import android.provider.OpenableColumns; +import android.telecom.PhoneAccount; +import android.telecom.TelecomManager; import android.text.TextUtils; import android.util.ArraySet; import android.util.AttributeSet; @@ -1108,6 +1110,12 @@ public class Intent implements Parcelable, Cloneable { * <p>Input: {@link #getData} is URI of a phone number to be dialed or a * tel: URI of an explicit phone number. * <p>Output: nothing. + * + * <p class="note"><strong>Note:</strong> It is not guaranteed that the call will be placed on + * the {@link PhoneAccount} provided in the {@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE} + * extra (if specified) and may be placed on another {@link PhoneAccount} with the + * {@link PhoneAccount#CAPABILITY_PLACE_EMERGENCY_CALLS} capability, depending on external + * factors, such as network conditions and Modem/SIM status. * @hide */ @SystemApi diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 4f7f07bdee55..f7c9635f67de 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -1949,6 +1949,30 @@ public abstract class PackageManager { /** * Feature for {@link #getSystemAvailableFeatures} and + * {@link #hasSystemFeature}: The device supports Open Mobile API capable UICC-based secure + * elements. + */ + @SdkConstant(SdkConstantType.FEATURE) + public static final String FEATURE_SE_OMAPI_UICC = "android.hardware.se.omapi.uicc"; + + /** + * Feature for {@link #getSystemAvailableFeatures} and + * {@link #hasSystemFeature}: The device supports Open Mobile API capable eSE-based secure + * elements. + */ + @SdkConstant(SdkConstantType.FEATURE) + public static final String FEATURE_SE_OMAPI_ESE = "android.hardware.se.omapi.ese"; + + /** + * Feature for {@link #getSystemAvailableFeatures} and + * {@link #hasSystemFeature}: The device supports Open Mobile API capable SD-based secure + * elements. + */ + @SdkConstant(SdkConstantType.FEATURE) + public static final String FEATURE_SE_OMAPI_SD = "android.hardware.se.omapi.sd"; + + /** + * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports the OpenGL ES * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt"> * Android Extension Pack</a>. diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java index 7d101b8f78e5..888380b41e58 100644 --- a/core/java/android/content/res/CompatibilityInfo.java +++ b/core/java/android/content/res/CompatibilityInfo.java @@ -32,8 +32,8 @@ import android.view.WindowManager; import android.view.WindowManager.LayoutParams; /** - * CompatibilityInfo class keeps the information about compatibility mode that the application is - * running under. + * CompatibilityInfo class keeps the information about the screen compatibility mode that the + * application is running under. * * {@hide} */ diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index 81abdea0d23f..10fe52a71d9d 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -812,7 +812,10 @@ public class Camera { * * @throws RuntimeException if starting preview fails; usually this would be * because of a hardware or other low-level error, or because release() - * has been called on this Camera instance. + * has been called on this Camera instance. The QCIF (176x144) exception + * mentioned in {@link Parameters#setPreviewSize setPreviewSize} and + * {@link Parameters#setPictureSize setPictureSize} can also cause this + * exception be thrown. */ public native final void startPreview(); @@ -2863,6 +2866,16 @@ public class Camera { * orientation should also be considered while setting picture size and * thumbnail size. * + * Exception on 176x144 (QCIF) resolution: + * Camera devices usually have a fixed capability for downscaling from + * larger resolution to smaller, and the QCIF resolution sometimes + * is not fully supported due to this limitation on devices with + * high-resolution image sensors. Therefore, trying to configure a QCIF + * preview size with any picture or video size larger than 1920x1080 + * (either width or height) might not be supported, and + * {@link #setParameters(Camera.Parameters)} might throw a + * RuntimeException if it is not. + * * @param width the width of the pictures, in pixels * @param height the height of the pictures, in pixels * @see #setDisplayOrientation(int) @@ -2908,6 +2921,16 @@ public class Camera { * preview can be different from the resolution of the recorded video * during video recording.</p> * + * <p>Exception on 176x144 (QCIF) resolution: + * Camera devices usually have a fixed capability for downscaling from + * larger resolution to smaller, and the QCIF resolution sometimes + * is not fully supported due to this limitation on devices with + * high-resolution image sensors. Therefore, trying to configure a QCIF + * video resolution with any preview or picture size larger than + * 1920x1080 (either width or height) might not be supported, and + * {@link #setParameters(Camera.Parameters)} will throw a + * RuntimeException if it is not.</p> + * * @return a list of Size object if camera has separate preview and * video output; otherwise, null is returned. * @see #getPreferredPreviewSizeForVideo() @@ -3202,6 +3225,16 @@ public class Camera { * <p>Applications need to consider the display orientation. See {@link * #setPreviewSize(int,int)} for reference.</p> * + * <p>Exception on 176x144 (QCIF) resolution: + * Camera devices usually have a fixed capability for downscaling from + * larger resolution to smaller, and the QCIF resolution sometimes + * is not fully supported due to this limitation on devices with + * high-resolution image sensors. Therefore, trying to configure a QCIF + * picture size with any preview or video size larger than 1920x1080 + * (either width or height) might not be supported, and + * {@link #setParameters(Camera.Parameters)} might throw a + * RuntimeException if it is not.</p> + * * @param width the width for pictures, in pixels * @param height the height for pictures, in pixels * @see #setPreviewSize(int,int) diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index a787d77bc964..e5c5328a32fa 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -2136,6 +2136,12 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri * </table> * <p>Refer to {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} for additional * mandatory stream configurations on a per-capability basis.</p> + * <p>Exception on 176x144 (QCIF) resolution: camera devices usually have a fixed capability for + * downscaling from larger resolution to smaller, and the QCIF resolution sometimes is not + * fully supported due to this limitation on devices with high-resolution image sensors. + * Therefore, trying to configure a QCIF resolution stream together with any other + * stream larger than 1920x1080 resolution (either width or height) might not be supported, + * and capture session creation will fail if it is not.</p> * <p>This key is available on all devices.</p> * * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL @@ -2331,6 +2337,12 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri * ratio 4:3, and the JPEG encoder alignment requirement is 16, the maximum JPEG size will be * 3264x2448.</li> * </ul> + * <p>Exception on 176x144 (QCIF) resolution: camera devices usually have a fixed capability on + * downscaling from larger resolution to smaller ones, and the QCIF resolution can sometimes + * not be fully supported due to this limitation on devices with high-resolution image + * sensors. Therefore, trying to configure a QCIF resolution stream together with any other + * stream larger than 1920x1080 resolution (either width or height) might not be supported, + * and capture session creation will fail if it is not.</p> * <p>This key is available on all devices.</p> * * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL @@ -3188,7 +3200,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri * <li><code>LEVEL_3</code> devices additionally support YUV reprocessing and RAW image capture, along * with additional output stream configurations.</li> * <li><code>EXTERNAL</code> devices are similar to <code>LIMITED</code> devices with exceptions like some sensor or - * lens information not reorted or less stable framerates.</li> + * lens information not reported or less stable framerates.</li> * </ul> * <p>See the individual level enums for full descriptions of the supported capabilities. The * {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} entry describes the device's capabilities at a diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java index ce88697fa8db..04e9246b994e 100644 --- a/core/java/android/hardware/camera2/CameraDevice.java +++ b/core/java/android/hardware/camera2/CameraDevice.java @@ -433,6 +433,14 @@ public abstract class CameraDevice implements AutoCloseable { * target combinations with sizes outside of these guarantees, but this can only be tested for * by attempting to create a session with such targets.</p> * + * <p>Exception on 176x144 (QCIF) resolution: + * Camera devices usually have a fixed capability for downscaling from larger resolution to + * smaller, and the QCIF resolution sometimes is not fully supported due to this + * limitation on devices with high-resolution image sensors. Therefore, trying to configure a + * QCIF resolution stream together with any other stream larger than 1920x1080 resolution + * (either width or height) might not be supported, and capture session creation will fail if it + * is not.</p> + * * @param outputs The new set of Surfaces that should be made available as * targets for captured image data. * @param callback The callback to notify about the status of the new capture session. diff --git a/core/java/android/os/ServiceManager.java b/core/java/android/os/ServiceManager.java index b2ba92849133..9a9b0306063b 100644 --- a/core/java/android/os/ServiceManager.java +++ b/core/java/android/os/ServiceManager.java @@ -17,13 +17,13 @@ package android.os; import android.annotation.UnsupportedAppUsage; +import android.util.ArrayMap; import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.android.internal.os.BinderInternal; import com.android.internal.util.StatLogger; -import java.util.HashMap; import java.util.Map; /** @hide */ @@ -38,7 +38,7 @@ public final class ServiceManager { * Cache for the "well known" services, such as WM and AM. */ @UnsupportedAppUsage - private static HashMap<String, IBinder> sCache = new HashMap<String, IBinder>(); + private static Map<String, IBinder> sCache = new ArrayMap<String, IBinder>(); /** * We do the "slow log" at most once every this interval. diff --git a/core/java/android/os/SharedMemory.java b/core/java/android/os/SharedMemory.java index 6025c348853c..4c12c325bde3 100644 --- a/core/java/android/os/SharedMemory.java +++ b/core/java/android/os/SharedMemory.java @@ -62,7 +62,7 @@ public final class SharedMemory implements Parcelable, Closeable { mMemoryRegistration = new MemoryRegistration(mSize); mCleaner = Cleaner.create(mFileDescriptor, - new Closer(mFileDescriptor, mMemoryRegistration)); + new Closer(mFileDescriptor.getInt$(), mMemoryRegistration)); } /** @@ -290,10 +290,10 @@ public final class SharedMemory implements Parcelable, Closeable { * Cleaner that closes the FD */ private static final class Closer implements Runnable { - private FileDescriptor mFd; + private int mFd; private MemoryRegistration mMemoryReference; - private Closer(FileDescriptor fd, MemoryRegistration memoryReference) { + private Closer(int fd, MemoryRegistration memoryReference) { mFd = fd; mMemoryReference = memoryReference; } @@ -301,7 +301,9 @@ public final class SharedMemory implements Parcelable, Closeable { @Override public void run() { try { - Os.close(mFd); + FileDescriptor fd = new FileDescriptor(); + fd.setInt$(mFd); + Os.close(fd); } catch (ErrnoException e) { /* swallow error */ } mMemoryReference.release(); mMemoryReference = null; diff --git a/core/java/android/os/UpdateEngine.java b/core/java/android/os/UpdateEngine.java index 8f2826c16b63..69bdde35a967 100644 --- a/core/java/android/os/UpdateEngine.java +++ b/core/java/android/os/UpdateEngine.java @@ -21,6 +21,8 @@ import android.os.IUpdateEngine; import android.os.IUpdateEngineCallback; import android.os.RemoteException; +import java.io.FileDescriptor; + /** * UpdateEngine handles calls to the update engine which takes care of A/B OTA * updates. It wraps up the update engine Binder APIs and exposes them as @@ -187,6 +189,22 @@ public class UpdateEngine { } /** + * Applies the payload passed as file descriptor {@code fd} instead of + * using the {@code file://} scheme. + * + * <p>See {@link #applyPayload(String)} for {@code offset}, {@code size} and + * {@code headerKeyValuePairs} parameters. + */ + public void applyPayload(FileDescriptor fd, long offset, long size, + String[] headerKeyValuePairs) { + try { + mUpdateEngine.applyPayloadFd(fd, offset, size, headerKeyValuePairs); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Permanently cancels an in-progress update. * * <p>See {@link #resetStatus} to undo a finshed update (only available diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 66f16d57c828..1ef262923442 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -75,7 +75,8 @@ public class SurfaceControl implements Parcelable { boolean allLayers, boolean useIdentityTransform, int rotation); private static native GraphicBuffer nativeScreenshotToBuffer(IBinder displayToken, Rect sourceCrop, int width, int height, int minLayer, int maxLayer, - boolean allLayers, boolean useIdentityTransform, int rotation); + boolean allLayers, boolean useIdentityTransform, int rotation, + boolean captureSecureLayers); private static native void nativeScreenshot(IBinder displayToken, Surface consumer, Rect sourceCrop, int width, int height, int minLayer, int maxLayer, boolean allLayers, boolean useIdentityTransform); @@ -1299,7 +1300,28 @@ public class SurfaceControl implements Parcelable { IBinder displayToken = SurfaceControl.getBuiltInDisplay( SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN); return nativeScreenshotToBuffer(displayToken, sourceCrop, width, height, - minLayer, maxLayer, false, useIdentityTransform, rotation); + minLayer, maxLayer, false, useIdentityTransform, rotation, + false /* captureSecureLayers */); + } + + /** + * Like screenshotToBuffer, but if the caller is AID_SYSTEM, allows + * for the capture of secure layers. This is used for the screen rotation + * animation where the system server takes screenshots but does + * not persist them or allow them to leave the server. However in other + * cases in the system server, we mostly want to omit secure layers + * like when we take a screenshot on behalf of the assistant. + * + * @hide + */ + public static GraphicBuffer screenshotToBufferWithSecureLayersUnsafe(Rect sourceCrop, + int width, int height, int minLayer, int maxLayer, boolean useIdentityTransform, + int rotation) { + IBinder displayToken = SurfaceControl.getBuiltInDisplay( + SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN); + return nativeScreenshotToBuffer(displayToken, sourceCrop, width, height, + minLayer, maxLayer, false, useIdentityTransform, rotation, + true /* captureSecureLayers */); } /** diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java index a29d44966540..26c21753a23f 100644 --- a/core/java/android/webkit/WebViewClient.java +++ b/core/java/android/webkit/WebViewClient.java @@ -102,9 +102,11 @@ public class WebViewClient { /** * Notify the host application that a page has finished loading. This method - * is called only for main frame. When onPageFinished() is called, the - * rendering picture may not be updated yet. To get the notification for the - * new Picture, use {@link WebView.PictureListener#onNewPicture}. + * is called only for main frame. Receiving an {@code onPageFinished()} callback does not + * guarantee that the next frame drawn by WebView will reflect the state of the DOM at this + * point. In order to be notified that the current DOM state is ready to be rendered, request a + * visual state callback with {@link WebView#postVisualStateCallback} and wait for the supplied + * callback to be triggered. * * @param view The WebView that is initiating the callback. * @param url The url of the page. diff --git a/core/java/com/android/internal/os/KernelWakelockReader.java b/core/java/com/android/internal/os/KernelWakelockReader.java index df8c6d021466..ee0903a30e6d 100644 --- a/core/java/com/android/internal/os/KernelWakelockReader.java +++ b/core/java/com/android/internal/os/KernelWakelockReader.java @@ -27,6 +27,7 @@ import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; +import java.io.File; import java.io.FileInputStream; import java.util.Iterator; @@ -38,6 +39,7 @@ public class KernelWakelockReader { private static int sKernelWakelockUpdateVersion = 0; private static final String sWakelockFile = "/proc/wakelocks"; private static final String sWakeupSourceFile = "/d/wakeup_sources"; + private static final String sSysClassWakeupDir = "/sys/class/wakeup"; private static final int[] PROC_WAKELOCKS_FORMAT = new int[] { Process.PROC_TAB_TERM|Process.PROC_OUT_STRING| // 0: name @@ -71,99 +73,108 @@ public class KernelWakelockReader { * @return the updated data. */ public final KernelWakelockStats readKernelWakelockStats(KernelWakelockStats staleStats) { - byte[] buffer = new byte[32*1024]; - int len = 0; - boolean wakeup_sources; - final long startTime = SystemClock.uptimeMillis(); + boolean useSystemSuspend = (new File(sSysClassWakeupDir)).exists(); - final int oldMask = StrictMode.allowThreadDiskReadsMask(); - try { - FileInputStream is; - try { - is = new FileInputStream(sWakelockFile); - wakeup_sources = false; - } catch (java.io.FileNotFoundException e) { + if (useSystemSuspend) { + WakeLockInfo[] wlStats = null; + if (mSuspendControlService == null) { try { - is = new FileInputStream(sWakeupSourceFile); - wakeup_sources = true; - } catch (java.io.FileNotFoundException e2) { - Slog.wtf(TAG, "neither " + sWakelockFile + " nor " + - sWakeupSourceFile + " exists"); + mSuspendControlService = ISuspendControlService.Stub.asInterface( + ServiceManager.getServiceOrThrow("suspend_control")); + } catch (ServiceNotFoundException e) { + Slog.wtf(TAG, "Required service suspend_control not available", e); return null; } } - int cnt; - while ((cnt = is.read(buffer, len, buffer.length - len)) > 0) { - len += cnt; + try { + wlStats = mSuspendControlService.getWakeLockStats(); + updateVersion(staleStats); + updateWakelockStats(wlStats, staleStats); + } catch (RemoteException e) { + Slog.wtf(TAG, "Failed to obtain wakelock stats from ISuspendControlService", e); + return null; } - is.close(); - } catch (java.io.IOException e) { - Slog.wtf(TAG, "failed to read kernel wakelocks", e); - return null; - } finally { - StrictMode.setThreadPolicyMask(oldMask); - } + return removeOldStats(staleStats); - final long readTime = SystemClock.uptimeMillis() - startTime; - if (readTime > 100) { - Slog.w(TAG, "Reading wakelock stats took " + readTime + "ms"); - } + } else { + byte[] buffer = new byte[32*1024]; + int len = 0; + boolean wakeup_sources; + final long startTime = SystemClock.uptimeMillis(); - if (len > 0) { - if (len >= buffer.length) { - Slog.wtf(TAG, "Kernel wake locks exceeded buffer size " + buffer.length); - } - int i; - for (i=0; i<len; i++) { - if (buffer[i] == '\0') { - len = i; - break; + final int oldMask = StrictMode.allowThreadDiskReadsMask(); + try { + FileInputStream is; + try { + is = new FileInputStream(sWakelockFile); + wakeup_sources = false; + } catch (java.io.FileNotFoundException e) { + try { + is = new FileInputStream(sWakeupSourceFile); + wakeup_sources = true; + } catch (java.io.FileNotFoundException e2) { + Slog.wtf(TAG, "neither " + sWakelockFile + " nor " + + sWakeupSourceFile + " exists"); + return null; + } } - } - } - updateVersion(staleStats); + int cnt; + while ((cnt = is.read(buffer, len, buffer.length - len)) > 0) { + len += cnt; + } - parseProcWakelocks(buffer, len, wakeup_sources, staleStats); + is.close(); + } catch (java.io.IOException e) { + Slog.wtf(TAG, "failed to read kernel wakelocks", e); + return null; + } finally { + StrictMode.setThreadPolicyMask(oldMask); + } - if (mSuspendControlService == null) { - try { - mSuspendControlService = ISuspendControlService.Stub.asInterface( - ServiceManager.getServiceOrThrow("suspend_control")); - } catch (ServiceNotFoundException e) { - Slog.wtf(TAG, "Required service suspend_control not available", e); + final long readTime = SystemClock.uptimeMillis() - startTime; + if (readTime > 100) { + Slog.w(TAG, "Reading wakelock stats took " + readTime + "ms"); } - } - try { - WakeLockInfo[] wlStats = mSuspendControlService.getWakeLockStats(); - getNativeWakelockStats(wlStats, staleStats); - } catch (RemoteException e) { - Slog.wtf(TAG, "Failed to obtain wakelock stats from ISuspendControlService", e); - } + if (len > 0) { + if (len >= buffer.length) { + Slog.wtf(TAG, "Kernel wake locks exceeded buffer size " + buffer.length); + } + int i; + for (i=0; i<len; i++) { + if (buffer[i] == '\0') { + len = i; + break; + } + } + } - return removeOldStats(staleStats); + updateVersion(staleStats); + parseProcWakelocks(buffer, len, wakeup_sources, staleStats); + return removeOldStats(staleStats); + } } /** - * Reads native wakelock stats from SystemSuspend and updates staleStats with the new - * information. + * Updates statleStats with stats from SystemSuspend. * @param staleStats Existing object to update. * @return the updated stats. */ @VisibleForTesting - public KernelWakelockStats getNativeWakelockStats(WakeLockInfo[] wlStats, + public KernelWakelockStats updateWakelockStats(WakeLockInfo[] wlStats, final KernelWakelockStats staleStats) { for (WakeLockInfo info : wlStats) { if (!staleStats.containsKey(info.name)) { staleStats.put(info.name, new KernelWakelockStats.Entry((int) info.activeCount, - info.totalTime, sKernelWakelockUpdateVersion)); + info.totalTime * 1000 /* ms to us */, sKernelWakelockUpdateVersion)); } else { KernelWakelockStats.Entry kwlStats = staleStats.get(info.name); kwlStats.mCount = (int) info.activeCount; - kwlStats.mTotalTime = info.totalTime; + // Convert milliseconds to microseconds + kwlStats.mTotalTime = info.totalTime * 1000; kwlStats.mVersion = sKernelWakelockUpdateVersion; } } diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 14b511df390b..cfe05c966a79 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -99,6 +99,14 @@ public final class Zygote { */ public static final int USE_APP_IMAGE_STARTUP_CACHE = 1 << 16; + /** + * When set, application specified signal handlers are not chained (i.e, ignored) + * by the runtime. + * + * Used for debugging only. Usage: set debug.ignoreappsignalhandler to 1. + */ + public static final int DEBUG_IGNORE_APP_SIGNAL_HANDLER = 1 << 17; + /** No external storage should be mounted. */ public static final int MOUNT_EXTERNAL_NONE = IVold.REMOUNT_MODE_NONE; /** Default external storage should be mounted. */ diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp index 62c4d76ed455..bbd8ffe686a8 100644 --- a/core/jni/android_os_Debug.cpp +++ b/core/jni/android_os_Debug.cpp @@ -306,6 +306,8 @@ static void read_mapinfo(FILE *fp, stats_t* stats, bool* foundSwapPss) whichHeap = HEAP_NATIVE; } else if (strncmp(name, "[stack", 6) == 0) { whichHeap = HEAP_STACK; + } else if (strncmp(name, "[anon:stack_and_tls:", 20) == 0) { + whichHeap = HEAP_STACK; } else if (nameLen > 3 && strcmp(name+nameLen-3, ".so") == 0) { whichHeap = HEAP_SO; is_swappable = true; diff --git a/core/jni/android_os_HwBlob.cpp b/core/jni/android_os_HwBlob.cpp index cb55618c685c..e5b72caf2792 100644 --- a/core/jni/android_os_HwBlob.cpp +++ b/core/jni/android_os_HwBlob.cpp @@ -88,7 +88,7 @@ JHwBlob::JHwBlob(JNIEnv *env, jobject thiz, size_t size) mOwnsBuffer(true), mHandle(0) { if (size > 0) { - mBuffer = malloc(size); + mBuffer = calloc(size, 1); } } diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index 9556333dbf86..fc977f14e97a 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -99,7 +99,9 @@ static struct sparseintarray_offsets_t static struct error_offsets_t { - jclass mClass; + jclass mError; + jclass mOutOfMemory; + jclass mStackOverflow; } gErrorOffsets; // ---------------------------------------------------------------------------- @@ -208,6 +210,16 @@ static JNIEnv* javavm_to_jnienv(JavaVM* vm) return vm->GetEnv((void **)&env, JNI_VERSION_1_4) >= 0 ? env : NULL; } +static const char* GetErrorTypeName(JNIEnv* env, jthrowable error) { + if (env->IsInstanceOf(error, gErrorOffsets.mOutOfMemory)) { + return "OutOfMemoryError"; + } + if (env->IsInstanceOf(error, gErrorOffsets.mStackOverflow)) { + return "StackOverflowError"; + } + return nullptr; +} + // Report a java.lang.Error (or subclass). This will terminate the runtime by // calling FatalError with a message derived from the given error. static void report_java_lang_error_fatal_error(JNIEnv* env, jthrowable error, @@ -217,7 +229,7 @@ static void report_java_lang_error_fatal_error(JNIEnv* env, jthrowable error, // Try to get the exception string. Sometimes logcat isn't available, // so try to add it to the abort message. - std::string exc_msg = "(Unknown exception message)"; + std::string exc_msg; { ScopedLocalRef<jclass> exc_class(env, env->GetObjectClass(error)); jmethodID method_id = env->GetMethodID(exc_class.get(), "toString", @@ -226,15 +238,36 @@ static void report_java_lang_error_fatal_error(JNIEnv* env, jthrowable error, env, reinterpret_cast<jstring>( env->CallObjectMethod(error, method_id))); - env->ExceptionClear(); // Just for good measure. + ScopedLocalRef<jthrowable> new_error(env, nullptr); + bool got_jstr = false; + if (env->ExceptionCheck()) { + new_error = ScopedLocalRef<jthrowable>(env, env->ExceptionOccurred()); + env->ExceptionClear(); + } if (jstr.get() != nullptr) { ScopedUtfChars jstr_utf(env, jstr.get()); if (jstr_utf.c_str() != nullptr) { exc_msg = jstr_utf.c_str(); + got_jstr = true; } else { + new_error = ScopedLocalRef<jthrowable>(env, env->ExceptionOccurred()); env->ExceptionClear(); } } + if (!got_jstr) { + exc_msg = "(Unknown exception message)"; + const char* orig_type = GetErrorTypeName(env, error); + if (orig_type != nullptr) { + exc_msg = base::StringPrintf("%s (Error was %s)", exc_msg.c_str(), orig_type); + } + const char* new_type = + new_error == nullptr ? nullptr : GetErrorTypeName(env, new_error.get()); + if (new_type != nullptr) { + exc_msg = base::StringPrintf("%s (toString() error was %s)", + exc_msg.c_str(), + new_type); + } + } } env->Throw(error); @@ -292,7 +325,7 @@ static void report_exception(JNIEnv* env, jthrowable excep, const char* msg) ALOGE("%s", msg); } - if (env->IsInstanceOf(excep, gErrorOffsets.mClass)) { + if (env->IsInstanceOf(excep, gErrorOffsets.mError)) { report_java_lang_error(env, excep, msg); } } @@ -1417,10 +1450,13 @@ const char* const kBinderProxyPathName = "android/os/BinderProxy"; static int int_register_android_os_BinderProxy(JNIEnv* env) { - jclass clazz = FindClassOrDie(env, "java/lang/Error"); - gErrorOffsets.mClass = MakeGlobalRefOrDie(env, clazz); + gErrorOffsets.mError = MakeGlobalRefOrDie(env, FindClassOrDie(env, "java/lang/Error")); + gErrorOffsets.mOutOfMemory = + MakeGlobalRefOrDie(env, FindClassOrDie(env, "java/lang/OutOfMemoryError")); + gErrorOffsets.mStackOverflow = + MakeGlobalRefOrDie(env, FindClassOrDie(env, "java/lang/StackOverflowError")); - clazz = FindClassOrDie(env, kBinderProxyPathName); + jclass clazz = FindClassOrDie(env, kBinderProxyPathName); gBinderProxyOffsets.mClass = MakeGlobalRefOrDie(env, clazz); gBinderProxyOffsets.mGetInstance = GetStaticMethodIDOrDie(env, clazz, "getInstance", "(JJ)Landroid/os/BinderProxy;"); diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 5b4b5f2a2264..614a8ff124ea 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -160,7 +160,7 @@ static Rect rectFromObj(JNIEnv* env, jobject rectObj) { static jobject nativeScreenshotToBuffer(JNIEnv* env, jclass clazz, jobject displayTokenObj, jobject sourceCropObj, jint width, jint height, jint minLayer, jint maxLayer, bool allLayers, bool useIdentityTransform, - int rotation) { + int rotation, bool captureSecureLayers) { sp<IBinder> displayToken = ibinderForJavaObject(env, displayTokenObj); if (displayToken == NULL) { return NULL; @@ -171,9 +171,10 @@ static jobject nativeScreenshotToBuffer(JNIEnv* env, jclass clazz, maxLayer = INT32_MAX; } sp<GraphicBuffer> buffer; + bool capturedSecureLayers = false; status_t res = ScreenshotClient::capture(displayToken, sourceCrop, width, height, minLayer, maxLayer, useIdentityTransform, - rotation, &buffer); + rotation, captureSecureLayers, &buffer, capturedSecureLayers); if (res != NO_ERROR) { return NULL; } @@ -184,7 +185,8 @@ static jobject nativeScreenshotToBuffer(JNIEnv* env, jclass clazz, buffer->getHeight(), buffer->getPixelFormat(), (jint)buffer->getUsage(), - (jlong)buffer.get()); + (jlong)buffer.get(), + capturedSecureLayers); } static jobject nativeScreenshotBitmap(JNIEnv* env, jclass clazz, @@ -1026,7 +1028,7 @@ static const JNINativeMethod sSurfaceControlMethods[] = { {"nativeGetHandle", "(J)Landroid/os/IBinder;", (void*)nativeGetHandle }, {"nativeScreenshotToBuffer", - "(Landroid/os/IBinder;Landroid/graphics/Rect;IIIIZZI)Landroid/graphics/GraphicBuffer;", + "(Landroid/os/IBinder;Landroid/graphics/Rect;IIIIZZIZ)Landroid/graphics/GraphicBuffer;", (void*)nativeScreenshotToBuffer }, {"nativeCaptureLayers", "(Landroid/os/IBinder;Landroid/graphics/Rect;F)Landroid/graphics/GraphicBuffer;", (void*)nativeCaptureLayers }, @@ -1082,7 +1084,7 @@ int register_android_view_SurfaceControl(JNIEnv* env) jclass graphicsBufferClazz = FindClassOrDie(env, "android/graphics/GraphicBuffer"); gGraphicBufferClassInfo.clazz = MakeGlobalRefOrDie(env, graphicsBufferClazz); gGraphicBufferClassInfo.builder = GetStaticMethodIDOrDie(env, graphicsBufferClazz, - "createFromExisting", "(IIIIJ)Landroid/graphics/GraphicBuffer;"); + "createFromExisting", "(IIIIJZ)Landroid/graphics/GraphicBuffer;"); return err; } diff --git a/core/proto/OWNERS b/core/proto/OWNERS index 480b1eaaf98c..1475d5fec12b 100644 --- a/core/proto/OWNERS +++ b/core/proto/OWNERS @@ -12,7 +12,7 @@ yaochen@google.com yro@google.com # Settings UI -per-file settings_enums.proto=zhfan@google.com +per-file settings_enums.proto=tmfang@google.com # Frameworks ogunwale@google.com diff --git a/core/res/res/values-bs/strings.xml b/core/res/res/values-bs/strings.xml index 1720e8be05af..b203fa32e48e 100644 --- a/core/res/res/values-bs/strings.xml +++ b/core/res/res/values-bs/strings.xml @@ -1779,7 +1779,7 @@ <string name="zen_mode_rule_name_combination" msgid="191109939968076477">"<xliff:g id="FIRST">%1$s</xliff:g>/<xliff:g id="REST">%2$s</xliff:g>"</string> <string name="toolbar_collapse_description" msgid="2821479483960330739">"Suzi"</string> <string name="zen_mode_feature_name" msgid="5254089399895895004">"Ne ometaj"</string> - <string name="zen_mode_downtime_feature_name" msgid="2626974636779860146">"Prestanak rada"</string> + <string name="zen_mode_downtime_feature_name" msgid="2626974636779860146">"Neaktivnost"</string> <string name="zen_mode_default_weeknights_name" msgid="3081318299464998143">"Radni dan uvečer"</string> <string name="zen_mode_default_weekends_name" msgid="2786495801019345244">"Vikend"</string> <string name="zen_mode_default_events_name" msgid="8158334939013085363">"Događaj"</string> diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml index e5f208d4a91f..6ca2691ad624 100644 --- a/core/res/res/values-ca/strings.xml +++ b/core/res/res/values-ca/strings.xml @@ -255,7 +255,7 @@ <string name="notification_channel_vpn" msgid="8330103431055860618">"Estat de la VPN"</string> <string name="notification_channel_device_admin" msgid="1568154104368069249">"Administració del dispositiu"</string> <string name="notification_channel_alerts" msgid="4496839309318519037">"Alertes"</string> - <string name="notification_channel_retail_mode" msgid="6088920674914038779">"Demostració comercial"</string> + <string name="notification_channel_retail_mode" msgid="6088920674914038779">"Demostració per a botigues"</string> <string name="notification_channel_usb" msgid="9006850475328924681">"Connexió USB"</string> <string name="notification_channel_heavy_weight_app" msgid="6218742927792852607">"S\'està executant una aplicació"</string> <string name="notification_channel_foreground_service" msgid="3931987440602669158">"Aplicacions que consumeixen bateria"</string> diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml index d9e15b2c186f..bb8548705339 100644 --- a/core/res/res/values-cs/strings.xml +++ b/core/res/res/values-cs/strings.xml @@ -375,13 +375,13 @@ <string name="permdesc_broadcastSticky" product="tv" msgid="6839285697565389467">"Umožňuje aplikaci odesílat trvalá vysílání, která přetrvávají i po skončení vysílání. Nadměrné používání může televizi zpomalit či způsobit její nestabilitu, protože bude používat příliš mnoho paměti."</string> <string name="permdesc_broadcastSticky" product="default" msgid="2825803764232445091">"Umožňuje aplikaci odesílat trvalá vysílání, která přetrvávají i po skončení vysílání. Nadměrné používání může telefon zpomalit či způsobit jeho nestabilitu, protože bude používat příliš mnoho paměti."</string> <string name="permlab_readContacts" msgid="8348481131899886131">"čtení kontaktů"</string> - <string name="permdesc_readContacts" product="tablet" msgid="5294866856941149639">"Umožňuje aplikaci číst údaje o kontaktech uložených v tabletu, včetně toho, jak často voláte, posíláte e-maily nebo jinak komunikujete s konkrétními osobami. Toto oprávnění umožňuje aplikacím ukládat údaje o kontaktech. Škodlivé aplikace mohou tyto údaje bez vašeho vědomí sdílet."</string> - <string name="permdesc_readContacts" product="tv" msgid="1839238344654834087">"Umožňuje aplikaci číst údaje o kontaktech uložených v televizi včetně toho, jak často voláte, posíláte e-maily nebo jinými způsoby komunikujete s konkrétními kontakty. Toto oprávnění umožňuje aplikacím ukládat údaje o vašich kontaktech a škodlivé aplikace mohou sdílet údaje o kontaktech bez vašeho vědomí."</string> - <string name="permdesc_readContacts" product="default" msgid="8440654152457300662">"Umožňuje aplikaci číst údaje o kontaktech uložených v telefonu, včetně toho, jak často voláte, posíláte e-maily nebo komunikujete jinými způsoby s konkrétními osobami. Toto oprávnění umožňuje aplikacím ukládat údaje o kontaktech. Škodlivé aplikace mohou tyto údaje bez vašeho vědomí sdílet."</string> + <string name="permdesc_readContacts" product="tablet" msgid="5294866856941149639">"Umožňuje aplikaci číst údaje o kontaktech uložených v tabletu, včetně toho, jak často voláte, posíláte e‑maily nebo jinak komunikujete s konkrétními osobami. Toto oprávnění umožňuje aplikacím ukládat údaje o kontaktech. Škodlivé aplikace mohou tyto údaje bez vašeho vědomí sdílet."</string> + <string name="permdesc_readContacts" product="tv" msgid="1839238344654834087">"Umožňuje aplikaci číst údaje o kontaktech uložených v televizi včetně toho, jak často voláte, posíláte e‑maily nebo jinými způsoby komunikujete s konkrétními kontakty. Toto oprávnění umožňuje aplikacím ukládat údaje o vašich kontaktech a škodlivé aplikace mohou sdílet údaje o kontaktech bez vašeho vědomí."</string> + <string name="permdesc_readContacts" product="default" msgid="8440654152457300662">"Umožňuje aplikaci číst údaje o kontaktech uložených v telefonu, včetně toho, jak často voláte, posíláte e‑maily nebo komunikujete jinými způsoby s konkrétními osobami. Toto oprávnění umožňuje aplikacím ukládat údaje o kontaktech. Škodlivé aplikace mohou tyto údaje bez vašeho vědomí sdílet."</string> <string name="permlab_writeContacts" msgid="5107492086416793544">"úprava kontaktů"</string> - <string name="permdesc_writeContacts" product="tablet" msgid="897243932521953602">"Umožňuje aplikaci upravit údaje o kontaktech uložených v tabletu včetně toho, jak často voláte, posíláte e-maily nebo komunikujete jinými způsoby s konkrétními kontakty. Toto oprávnění aplikacím umožňuje mazat údaje o kontaktech."</string> - <string name="permdesc_writeContacts" product="tv" msgid="5438230957000018959">"Umožňuje aplikaci upravit údaje o kontaktech uložených v televizi včetně toho, jak často voláte, posíláte e-maily nebo jinými způsoby komunikujete s konkrétními kontakty. Toto oprávnění aplikacím umožňuje mazat údaje o kontaktech."</string> - <string name="permdesc_writeContacts" product="default" msgid="589869224625163558">"Umožňuje aplikaci upravit údaje o kontaktech uložených v telefonu včetně toho, jak často voláte, posíláte e-maily nebo komunikujete jinými způsoby s konkrétními kontakty. Toto oprávnění aplikacím umožňuje mazat údaje o kontaktech."</string> + <string name="permdesc_writeContacts" product="tablet" msgid="897243932521953602">"Umožňuje aplikaci upravit údaje o kontaktech uložených v tabletu včetně toho, jak často voláte, posíláte e‑maily nebo komunikujete jinými způsoby s konkrétními kontakty. Toto oprávnění aplikacím umožňuje mazat údaje o kontaktech."</string> + <string name="permdesc_writeContacts" product="tv" msgid="5438230957000018959">"Umožňuje aplikaci upravit údaje o kontaktech uložených v televizi včetně toho, jak často voláte, posíláte e‑maily nebo jinými způsoby komunikujete s konkrétními kontakty. Toto oprávnění aplikacím umožňuje mazat údaje o kontaktech."</string> + <string name="permdesc_writeContacts" product="default" msgid="589869224625163558">"Umožňuje aplikaci upravit údaje o kontaktech uložených v telefonu včetně toho, jak často voláte, posíláte e‑maily nebo komunikujete jinými způsoby s konkrétními kontakty. Toto oprávnění aplikacím umožňuje mazat údaje o kontaktech."</string> <string name="permlab_readCallLog" msgid="3478133184624102739">"čtení seznamu hovorů"</string> <string name="permdesc_readCallLog" msgid="3204122446463552146">"Tato aplikace může číst historii volání."</string> <string name="permlab_writeCallLog" msgid="8552045664743499354">"zápis do seznamu hovorů"</string> diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml index ab95af6f52bc..654165539d3b 100644 --- a/core/res/res/values-de/strings.xml +++ b/core/res/res/values-de/strings.xml @@ -63,7 +63,7 @@ <string name="CfMmi" msgid="5123218989141573515">"Rufweiterleitung"</string> <string name="CwMmi" msgid="9129678056795016867">"Anklopfen"</string> <string name="BaMmi" msgid="455193067926770581">"Anrufsperre"</string> - <string name="PwdMmi" msgid="7043715687905254199">"Passwort-Änderung"</string> + <string name="PwdMmi" msgid="7043715687905254199">"Passwortänderung"</string> <string name="PinMmi" msgid="3113117780361190304">"PIN-Änderung"</string> <string name="CnipMmi" msgid="3110534680557857162">"Rufnummer vorhanden"</string> <string name="CnirMmi" msgid="3062102121430548731">"Rufnummer begrenzt"</string> diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml index 089320115206..6219bb90541f 100644 --- a/core/res/res/values-es/strings.xml +++ b/core/res/res/values-es/strings.xml @@ -134,7 +134,7 @@ <string name="wifi_calling_off_summary" msgid="8720659586041656098">"Desactivado"</string> <string name="wfc_mode_wifi_preferred_summary" msgid="1994113411286935263">"Preferir Wi-Fi"</string> <string name="wfc_mode_cellular_preferred_summary" msgid="1988279625335345908">"Preferir datos móviles"</string> - <string name="wfc_mode_wifi_only_summary" msgid="2379919155237869320">"Solo conexión Wi-Fi"</string> + <string name="wfc_mode_wifi_only_summary" msgid="2379919155237869320">"Solo Wi-Fi"</string> <string name="cfTemplateNotForwarded" msgid="1683685883841272560">"<xliff:g id="BEARER_SERVICE_CODE">{0}</xliff:g>: No desviada"</string> <string name="cfTemplateForwarded" msgid="1302922117498590521">"<xliff:g id="BEARER_SERVICE_CODE">{0}</xliff:g>: <xliff:g id="DIALING_NUMBER">{1}</xliff:g>"</string> <string name="cfTemplateForwardedTime" msgid="9206251736527085256">"<xliff:g id="BEARER_SERVICE_CODE">{0}</xliff:g>: <xliff:g id="DIALING_NUMBER">{1}</xliff:g> transcurridos <xliff:g id="TIME_DELAY">{2}</xliff:g> segundos"</string> diff --git a/core/res/res/values-eu/strings.xml b/core/res/res/values-eu/strings.xml index 0bf480296b88..d1f6cb53d271 100644 --- a/core/res/res/values-eu/strings.xml +++ b/core/res/res/values-eu/strings.xml @@ -1195,7 +1195,7 @@ <string name="sms_short_code_confirm_deny" msgid="2927389840209170706">"Utzi"</string> <string name="sms_short_code_remember_choice" msgid="5289538592272218136">"Gogoratu aukera"</string> <string name="sms_short_code_remember_undo_instruction" msgid="4960944133052287484">"Hori geroago alda dezakezu Ezarpenak > Aplikazioak atalean"</string> - <string name="sms_short_code_confirm_always_allow" msgid="3241181154869493368">"Onartu beti"</string> + <string name="sms_short_code_confirm_always_allow" msgid="3241181154869493368">"Eman baimena beti"</string> <string name="sms_short_code_confirm_never_allow" msgid="446992765774269673">"Ez onartu inoiz"</string> <string name="sim_removed_title" msgid="6227712319223226185">"SIM txartela kendu da"</string> <string name="sim_removed_message" msgid="2333164559970958645">"Sare mugikorra ez da erabilgarri egongo baliozko SIM txartel bat sartuta berrabiarazten ez duzun arte."</string> diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml index f840922090c9..223d8b54fd57 100644 --- a/core/res/res/values-fr/strings.xml +++ b/core/res/res/values-fr/strings.xml @@ -266,7 +266,7 @@ <string name="safeMode" msgid="2788228061547930246">"Mode sécurisé"</string> <string name="android_system_label" msgid="6577375335728551336">"Système Android"</string> <string name="user_owner_label" msgid="8836124313744349203">"Passer au profil personnel"</string> - <string name="managed_profile_label" msgid="8947929265267690522">"Passer au profil professionnel"</string> + <string name="managed_profile_label" msgid="8947929265267690522">"Passer au profil pro"</string> <string name="permgrouplab_contacts" msgid="3657758145679177612">"Contacts"</string> <string name="permgroupdesc_contacts" msgid="6951499528303668046">"accéder à vos contacts"</string> <string name="permgrouprequest_contacts" msgid="1601591667800538208">"Permettre à <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> d\'accéder à vos contacts"</string> diff --git a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java index d922c16a9297..b9f5ef996fc5 100644 --- a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java +++ b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java @@ -412,7 +412,8 @@ public class TransactionParcelTests { IUiAutomationConnection iUiAutomationConnection, int i, boolean b, boolean b1, boolean b2, boolean b3, Configuration configuration, CompatibilityInfo compatibilityInfo, Map map, Bundle bundle1, String s1, - boolean autofillCompatEnabled) throws RemoteException { + boolean autofillCompatEnabled, long[] disableCompatChanges) + throws RemoteException { } @Override diff --git a/core/tests/coretests/src/com/android/internal/os/KernelWakelockReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelWakelockReaderTest.java index 008085e38dbf..a93573724ba1 100644 --- a/core/tests/coretests/src/com/android/internal/os/KernelWakelockReaderTest.java +++ b/core/tests/coretests/src/com/android/internal/os/KernelWakelockReaderTest.java @@ -68,12 +68,7 @@ public class KernelWakelockReaderTest extends TestCase { private WakeLockInfo createWakeLockInfo(String name, int activeCount, long totalTime) { WakeLockInfo info = new WakeLockInfo(); info.name = name; - info.pid = 1; info.activeCount = activeCount; - info.isActive = true; - info.activeSince = 0; - info.lastChange = 0; - info.maxTime = 0; info.totalTime = totalTime; return info; } @@ -89,7 +84,7 @@ public class KernelWakelockReaderTest extends TestCase { byte[] buffer, WakeLockInfo[] wlStats) { mReader.updateVersion(staleStats); mReader.parseProcWakelocks(buffer, buffer.length, true, staleStats); - mReader.getNativeWakelockStats(wlStats, staleStats); + mReader.updateWakelockStats(wlStats, staleStats); return mReader.removeOldStats(staleStats); } @@ -101,7 +96,7 @@ public class KernelWakelockReaderTest extends TestCase { mReader = new KernelWakelockReader(); } -// ------------------------- Kernel Wakelock Stats Test ------------------------ +// ------------------------- Legacy Wakelock Stats Test ------------------------ @SmallTest public void testParseEmptyFile() throws Exception { KernelWakelockStats staleStats = mReader.parseProcWakelocks(new byte[0], 0, true, @@ -196,10 +191,10 @@ public class KernelWakelockReaderTest extends TestCase { assertFalse(staleStats.containsKey("Fakelock")); } -// -------------------- Native (SystemSuspend) Wakelock Stats Test ------------------- +// -------------------- SystemSuspend Wakelock Stats Test ------------------- @SmallTest public void testEmptyWakeLockInfoList() { - KernelWakelockStats staleStats = mReader.getNativeWakelockStats(new WakeLockInfo[0], + KernelWakelockStats staleStats = mReader.updateWakelockStats(new WakeLockInfo[0], new KernelWakelockStats()); assertTrue(staleStats.isEmpty()); @@ -208,9 +203,9 @@ public class KernelWakelockReaderTest extends TestCase { @SmallTest public void testOneWakeLockInfo() { WakeLockInfo[] wlStats = new WakeLockInfo[1]; - wlStats[0] = createWakeLockInfo("WakeLock", 20, 10000); + wlStats[0] = createWakeLockInfo("WakeLock", 20, 1000); // Milliseconds - KernelWakelockStats staleStats = mReader.getNativeWakelockStats(wlStats, + KernelWakelockStats staleStats = mReader.updateWakelockStats(wlStats, new KernelWakelockStats()); assertEquals(1, staleStats.size()); @@ -219,16 +214,16 @@ public class KernelWakelockReaderTest extends TestCase { KernelWakelockStats.Entry entry = staleStats.get("WakeLock"); assertEquals(20, entry.mCount); - assertEquals(10000, entry.mTotalTime); + assertEquals(1000 * 1000, entry.mTotalTime); // Microseconds } @SmallTest public void testTwoWakeLockInfos() { WakeLockInfo[] wlStats = new WakeLockInfo[2]; - wlStats[0] = createWakeLockInfo("WakeLock1", 10, 1000); - wlStats[1] = createWakeLockInfo("WakeLock2", 20, 2000); + wlStats[0] = createWakeLockInfo("WakeLock1", 10, 1000); // Milliseconds + wlStats[1] = createWakeLockInfo("WakeLock2", 20, 2000); // Milliseconds - KernelWakelockStats staleStats = mReader.getNativeWakelockStats(wlStats, + KernelWakelockStats staleStats = mReader.updateWakelockStats(wlStats, new KernelWakelockStats()); assertEquals(2, staleStats.size()); @@ -238,17 +233,17 @@ public class KernelWakelockReaderTest extends TestCase { KernelWakelockStats.Entry entry1 = staleStats.get("WakeLock1"); assertEquals(10, entry1.mCount); - assertEquals(1000, entry1.mTotalTime); + assertEquals(1000 * 1000, entry1.mTotalTime); // Microseconds KernelWakelockStats.Entry entry2 = staleStats.get("WakeLock2"); assertEquals(20, entry2.mCount); - assertEquals(2000, entry2.mTotalTime); + assertEquals(2000 * 1000, entry2.mTotalTime); // Microseconds } @SmallTest public void testWakeLockInfosBecomeStale() { WakeLockInfo[] wlStats = new WakeLockInfo[1]; - wlStats[0] = createWakeLockInfo("WakeLock1", 10, 1000); + wlStats[0] = createWakeLockInfo("WakeLock1", 10, 1000); // Milliseconds KernelWakelockStats staleStats = new KernelWakelockStats(); @@ -259,9 +254,9 @@ public class KernelWakelockReaderTest extends TestCase { assertTrue(staleStats.containsKey("WakeLock1")); KernelWakelockStats.Entry entry = staleStats.get("WakeLock1"); assertEquals(10, entry.mCount); - assertEquals(1000, entry.mTotalTime); + assertEquals(1000 * 1000, entry.mTotalTime); // Microseconds - wlStats[0] = createWakeLockInfo("WakeLock2", 20, 2000); + wlStats[0] = createWakeLockInfo("WakeLock2", 20, 2000); // Milliseconds readKernelWakelockStats(staleStats, new byte[0], wlStats); @@ -271,146 +266,6 @@ public class KernelWakelockReaderTest extends TestCase { assertTrue(staleStats.containsKey("WakeLock2")); entry = staleStats.get("WakeLock2"); assertEquals(20, entry.mCount); - assertEquals(2000, entry.mTotalTime); - } - -// -------------------- Aggregate Wakelock Stats Tests -------------------- - @SmallTest - public void testAggregateStatsEmpty() throws Exception { - KernelWakelockStats staleStats = new KernelWakelockStats(); - - byte[] buffer = new byte[0]; - WakeLockInfo[] wlStats = new WakeLockInfo[0]; - - readKernelWakelockStats(staleStats, buffer, wlStats); - - assertTrue(staleStats.isEmpty()); - } - - @SmallTest - public void testAggregateStatsNoNativeWakelocks() throws Exception { - KernelWakelockStats staleStats = new KernelWakelockStats(); - - byte[] buffer = new ProcFileBuilder() - .addLine("Wakelock", 34, 123) // Milliseconds - .getBytes(); - WakeLockInfo[] wlStats = new WakeLockInfo[0]; - - readKernelWakelockStats(staleStats, buffer, wlStats); - - assertEquals(1, staleStats.size()); - - assertTrue(staleStats.containsKey("Wakelock")); - - KernelWakelockStats.Entry entry = staleStats.get("Wakelock"); - assertEquals(34, entry.mCount); - assertEquals(1000 * 123, entry.mTotalTime); // Microseconds - } - - @SmallTest - public void testAggregateStatsNoKernelWakelocks() throws Exception { - KernelWakelockStats staleStats = new KernelWakelockStats(); - - byte[] buffer = new byte[0]; - WakeLockInfo[] wlStats = new WakeLockInfo[1]; - wlStats[0] = createWakeLockInfo("WakeLock", 10, 1000); - - readKernelWakelockStats(staleStats, buffer, wlStats); - - assertEquals(1, staleStats.size()); - - assertTrue(staleStats.containsKey("WakeLock")); - - KernelWakelockStats.Entry entry = staleStats.get("WakeLock"); - assertEquals(10, entry.mCount); - assertEquals(1000, entry.mTotalTime); - } - - @SmallTest - public void testAggregateStatsBothKernelAndNativeWakelocks() throws Exception { - KernelWakelockStats staleStats = new KernelWakelockStats(); - - byte[] buffer = new ProcFileBuilder() - .addLine("WakeLock1", 34, 123) // Milliseconds - .getBytes(); - WakeLockInfo[] wlStats = new WakeLockInfo[1]; - wlStats[0] = createWakeLockInfo("WakeLock2", 10, 1000); - - readKernelWakelockStats(staleStats, buffer, wlStats); - - assertEquals(2, staleStats.size()); - - assertTrue(staleStats.containsKey("WakeLock1")); - KernelWakelockStats.Entry entry1 = staleStats.get("WakeLock1"); - assertEquals(34, entry1.mCount); - assertEquals(123 * 1000, entry1.mTotalTime); // Microseconds - - assertTrue(staleStats.containsKey("WakeLock2")); - KernelWakelockStats.Entry entry2 = staleStats.get("WakeLock2"); - assertEquals(10, entry2.mCount); - assertEquals(1000, entry2.mTotalTime); - } - - @SmallTest - public void testAggregateStatsUpdate() throws Exception { - KernelWakelockStats staleStats = new KernelWakelockStats(); - - byte[] buffer = new ProcFileBuilder() - .addLine("WakeLock1", 34, 123) // Milliseconds - .addLine("WakeLock2", 46, 345) // Milliseconds - .getBytes(); - WakeLockInfo[] wlStats = new WakeLockInfo[2]; - wlStats[0] = createWakeLockInfo("WakeLock3", 10, 1000); - wlStats[1] = createWakeLockInfo("WakeLock4", 20, 2000); - - readKernelWakelockStats(staleStats, buffer, wlStats); - - assertEquals(4, staleStats.size()); - - assertTrue(staleStats.containsKey("WakeLock1")); - assertTrue(staleStats.containsKey("WakeLock2")); - assertTrue(staleStats.containsKey("WakeLock3")); - assertTrue(staleStats.containsKey("WakeLock4")); - - KernelWakelockStats.Entry entry1 = staleStats.get("WakeLock1"); - assertEquals(34, entry1.mCount); - assertEquals(123 * 1000, entry1.mTotalTime); // Microseconds - - KernelWakelockStats.Entry entry2 = staleStats.get("WakeLock2"); - assertEquals(46, entry2.mCount); - assertEquals(345 * 1000, entry2.mTotalTime); // Microseconds - - KernelWakelockStats.Entry entry3 = staleStats.get("WakeLock3"); - assertEquals(10, entry3.mCount); - assertEquals(1000, entry3.mTotalTime); - - KernelWakelockStats.Entry entry4 = staleStats.get("WakeLock4"); - assertEquals(20, entry4.mCount); - assertEquals(2000, entry4.mTotalTime); - - buffer = new ProcFileBuilder() - .addLine("WakeLock1", 45, 789) // Milliseconds - .addLine("WakeLock1", 56, 123) // Milliseconds - .getBytes(); - wlStats = new WakeLockInfo[1]; - wlStats[0] = createWakeLockInfo("WakeLock4", 40, 4000); - - readKernelWakelockStats(staleStats, buffer, wlStats); - - assertEquals(2, staleStats.size()); - - assertTrue(staleStats.containsKey("WakeLock1")); - assertTrue(staleStats.containsKey("WakeLock4")); - - assertFalse(staleStats.containsKey("WakeLock2")); - assertFalse(staleStats.containsKey("WakeLock3")); - - entry1 = staleStats.get("WakeLock1"); - assertEquals(45 + 56, entry1.mCount); - assertEquals((789 + 123) * 1000, entry1.mTotalTime); // Microseconds - - entry2 = staleStats.get("WakeLock4"); - assertEquals(40, entry2.mCount); - assertEquals(4000, entry4.mTotalTime); + assertEquals(2000 * 1000, entry.mTotalTime); // Micro seconds } } diff --git a/graphics/java/android/graphics/GraphicBuffer.java b/graphics/java/android/graphics/GraphicBuffer.java index 74086830fae2..644f7bc13208 100644 --- a/graphics/java/android/graphics/GraphicBuffer.java +++ b/graphics/java/android/graphics/GraphicBuffer.java @@ -53,6 +53,7 @@ public class GraphicBuffer implements Parcelable { private final int mHeight; private final int mFormat; private final int mUsage; + private final boolean mCapturedSecureLayers; // Note: do not rename, this field is used by native code @UnsupportedAppUsage private final long mNativeObject; @@ -87,12 +88,22 @@ public class GraphicBuffer implements Parcelable { * Private use only. See {@link #create(int, int, int, int)}. */ @UnsupportedAppUsage - private GraphicBuffer(int width, int height, int format, int usage, long nativeObject) { + private GraphicBuffer(int width, int height, int format, int usage, long nativeObject, + boolean capturedSecureLayers) { mWidth = width; mHeight = height; mFormat = format; mUsage = usage; mNativeObject = nativeObject; + mCapturedSecureLayers = capturedSecureLayers; + } + + /** + * Private use only. See {@link #create(int, int, int, int)}. + */ + @UnsupportedAppUsage + private GraphicBuffer(int width, int height, int format, int usage, long nativeObject) { + this(width, height, format, usage, nativeObject, false); } /** @@ -101,15 +112,34 @@ public class GraphicBuffer implements Parcelable { */ @UnsupportedAppUsage public static GraphicBuffer createFromExisting(int width, int height, - int format, int usage, long unwrappedNativeObject) { + int format, int usage, long unwrappedNativeObject, + boolean capturedSecureLayers) { long nativeObject = nWrapGraphicBuffer(unwrappedNativeObject); if (nativeObject != 0) { - return new GraphicBuffer(width, height, format, usage, nativeObject); + return new GraphicBuffer(width, height, format, usage, nativeObject, + capturedSecureLayers); } return null; } /** + * For SurfaceControl JNI. Provides and ignored value for capturedSecureLayers for backwards + * compatibility + * @hide + */ + public static GraphicBuffer createFromExisting(int width, int height, + int format, int usage, long unwrappedNativeObject) { + return createFromExisting(width, height, format, usage, unwrappedNativeObject, false); + } + + /** + * Returns true if the buffer contains visible secure layers. + */ + public boolean doesContainSecureLayers() { + return mCapturedSecureLayers; + } + + /** * Returns the width of this buffer in pixels. */ public int getWidth() { diff --git a/packages/CtsShim/build/shim/AndroidManifest.xml b/packages/CtsShim/build/shim/AndroidManifest.xml index 9b813ace8b80..3e546f1e02db 100644 --- a/packages/CtsShim/build/shim/AndroidManifest.xml +++ b/packages/CtsShim/build/shim/AndroidManifest.xml @@ -20,7 +20,7 @@ package="com.android.cts.ctsshim" > <uses-sdk android:minSdkVersion="24" - android:targetSdkVersion="24" /> + android:targetSdkVersion="28" /> <restrict-update android:hash="__CAN_NOT_BE_UPDATED__" /> diff --git a/packages/CtsShim/build/shim_priv/AndroidManifest.xml b/packages/CtsShim/build/shim_priv/AndroidManifest.xml index 9bf454c29768..9ab12c9743c0 100644 --- a/packages/CtsShim/build/shim_priv/AndroidManifest.xml +++ b/packages/CtsShim/build/shim_priv/AndroidManifest.xml @@ -20,7 +20,7 @@ package="com.android.cts.priv.ctsshim" > <uses-sdk android:minSdkVersion="24" - android:targetSdkVersion="24" /> + android:targetSdkVersion="28" /> <restrict-update android:hash="__HASH__" /> diff --git a/packages/CtsShim/build/shim_priv_upgrade/AndroidManifest.xml b/packages/CtsShim/build/shim_priv_upgrade/AndroidManifest.xml index 023e93e1449e..2354061fe351 100644 --- a/packages/CtsShim/build/shim_priv_upgrade/AndroidManifest.xml +++ b/packages/CtsShim/build/shim_priv_upgrade/AndroidManifest.xml @@ -20,7 +20,7 @@ package="com.android.cts.priv.ctsshim" > <uses-sdk android:minSdkVersion="24" - android:targetSdkVersion="24" /> + android:targetSdkVersion="28" /> <application android:hasCode="false" diff --git a/packages/EasterEgg/src/com/android/egg/paint/BrushPropertyDrawable.kt b/packages/EasterEgg/src/com/android/egg/paint/BrushPropertyDrawable.kt index d06e5ec634de..f10a3ac42b77 100644 --- a/packages/EasterEgg/src/com/android/egg/paint/BrushPropertyDrawable.kt +++ b/packages/EasterEgg/src/com/android/egg/paint/BrushPropertyDrawable.kt @@ -63,7 +63,7 @@ class BrushPropertyDrawable : Drawable { } override fun draw(c: Canvas) { - c?.let { + c.let { val w = bounds.width().toFloat() val h = bounds.height().toFloat() val inset = _size / 12 // 2dp in a 24x24 icon diff --git a/packages/SettingsLib/res/values-da/strings.xml b/packages/SettingsLib/res/values-da/strings.xml index 291d4abc4006..1c35a9d9edb7 100644 --- a/packages/SettingsLib/res/values-da/strings.xml +++ b/packages/SettingsLib/res/values-da/strings.xml @@ -184,7 +184,7 @@ <string name="enable_adb_summary" msgid="4881186971746056635">"Fejlretningstilstand, når USB er tilsluttet"</string> <string name="clear_adb_keys" msgid="4038889221503122743">"Tilbagekald tilladelser for USB-fejlfinding"</string> <string name="bugreport_in_power" msgid="7923901846375587241">"Genvej til fejlrapporting"</string> - <string name="bugreport_in_power_summary" msgid="1778455732762984579">"Vis en knap til oprettelse af fejlrapporter i menu for slukknap"</string> + <string name="bugreport_in_power_summary" msgid="1778455732762984579">"Vis en knap til oprettelse af fejlrapporter i afbrydermenuen"</string> <string name="keep_screen_on" msgid="1146389631208760344">"Lås ikke"</string> <string name="keep_screen_on_summary" msgid="2173114350754293009">"Skærmen går ikke i dvale under opladning"</string> <string name="bt_hci_snoop_log" msgid="3340699311158865670">"Aktivér Bluetooth HCI snoop log"</string> diff --git a/packages/SettingsLib/res/values-de/strings.xml b/packages/SettingsLib/res/values-de/strings.xml index 84e33bc51ce3..df8245cf0426 100644 --- a/packages/SettingsLib/res/values-de/strings.xml +++ b/packages/SettingsLib/res/values-de/strings.xml @@ -192,7 +192,7 @@ <string name="oem_unlock_enable" msgid="6040763321967327691">"OEM-Entsperrung"</string> <string name="oem_unlock_enable_summary" msgid="4720281828891618376">"Bootloader-Entsperrung zulassen"</string> <string name="confirm_enable_oem_unlock_title" msgid="4802157344812385674">"OEM-Entsperrung zulassen?"</string> - <string name="confirm_enable_oem_unlock_text" msgid="5517144575601647022">"Achtung: Die Geräteschutzfunktionen funktionieren auf diesem Gerät nicht, solange diese Einstellung aktiviert ist."</string> + <string name="confirm_enable_oem_unlock_text" msgid="5517144575601647022">"Achtung: Der Geräteschutz funktioniert auf diesem Gerät nicht, solange diese Einstellung aktiviert ist."</string> <string name="mock_location_app" msgid="7966220972812881854">"App für simulierte Standorte auswählen"</string> <string name="mock_location_app_not_set" msgid="809543285495344223">"Keine App für simulierte Standorte eingerichtet"</string> <string name="mock_location_app_set" msgid="8966420655295102685">"App für simulierte Standorte: <xliff:g id="APP_NAME">%1$s</xliff:g>"</string> diff --git a/packages/SettingsLib/res/values-eu/strings.xml b/packages/SettingsLib/res/values-eu/strings.xml index bcaf79cfbaf4..5b2b8b0e33e7 100644 --- a/packages/SettingsLib/res/values-eu/strings.xml +++ b/packages/SettingsLib/res/values-eu/strings.xml @@ -33,7 +33,7 @@ <string name="wifi_check_password_try_again" msgid="516958988102584767">"Egiaztatu pasahitza zuzena dela eta saiatu berriro"</string> <string name="wifi_not_in_range" msgid="1136191511238508967">"Urrunegi"</string> <string name="wifi_no_internet_no_reconnect" msgid="5724903347310541706">"Ez da konektatuko automatikoki"</string> - <string name="wifi_no_internet" msgid="4663834955626848401">"Ezin da atzitu Internet"</string> + <string name="wifi_no_internet" msgid="4663834955626848401">"Ezin da konektatu Internetera"</string> <string name="saved_network" msgid="4352716707126620811">"<xliff:g id="NAME">%1$s</xliff:g> aplikazioak gorde du"</string> <string name="connected_via_network_scorer" msgid="5713793306870815341">"%1$s bidez automatikoki konektatuta"</string> <string name="connected_via_network_scorer_default" msgid="7867260222020343104">"Automatikoki konektatuta sareen balorazioen hornitzailearen bidez"</string> @@ -67,7 +67,7 @@ <string name="bluetooth_profile_headset" msgid="7815495680863246034">"Telefono-deiak"</string> <string name="bluetooth_profile_opp" msgid="9168139293654233697">"Fitxategi-transferentzia"</string> <string name="bluetooth_profile_hid" msgid="3680729023366986480">"Sarrerako gailua"</string> - <string name="bluetooth_profile_pan" msgid="3391606497945147673">"Interneterako sarbidea"</string> + <string name="bluetooth_profile_pan" msgid="3391606497945147673">"Interneteko konexioa"</string> <string name="bluetooth_profile_pbap" msgid="5372051906968576809">"Kontaktuak partekatzea"</string> <string name="bluetooth_profile_pbap_summary" msgid="6605229608108852198">"Erabili kontaktuak partekatzeko"</string> <string name="bluetooth_profile_pan_nap" msgid="8429049285027482959">"Interneteko konexioa partekatzea"</string> @@ -84,9 +84,9 @@ <string name="bluetooth_sap_profile_summary_connected" msgid="8561765057453083838">"SAP sarbide-puntura konektatuta"</string> <string name="bluetooth_opp_profile_summary_not_connected" msgid="1267091356089086285">"Fitxategi-transferentziako zerbitzarira konektatu gabe"</string> <string name="bluetooth_hid_profile_summary_connected" msgid="3381760054215168689">"Sarrerako gailura konektatuta"</string> - <string name="bluetooth_pan_user_profile_summary_connected" msgid="6436258151814414028">"Gailura konektatuta Interneteko sarbiderako"</string> + <string name="bluetooth_pan_user_profile_summary_connected" msgid="6436258151814414028">"Gailura konektatuta Internet atzitzeko"</string> <string name="bluetooth_pan_nap_profile_summary_connected" msgid="1322694224800769308">"Tokiko Interneteko konexioa gailu batekin partekatzea"</string> - <string name="bluetooth_pan_profile_summary_use_for" msgid="5736111170225304239">"Erabili Internet atzitzeko"</string> + <string name="bluetooth_pan_profile_summary_use_for" msgid="5736111170225304239">"Erabili Internetera konektatzeko"</string> <string name="bluetooth_map_profile_summary_use_for" msgid="5154200119919927434">"Erabili maparako"</string> <string name="bluetooth_sap_profile_summary_use_for" msgid="7085362712786907993">"Erabili SIM txartelerako sarbiderako"</string> <string name="bluetooth_a2dp_profile_summary_use_for" msgid="4630849022250168427">"Erabili euskarriaren audiorako"</string> diff --git a/packages/SystemUI/res-keyguard/values-da/strings.xml b/packages/SystemUI/res-keyguard/values-da/strings.xml index 012fe2f4c437..16073a7c33de 100644 --- a/packages/SystemUI/res-keyguard/values-da/strings.xml +++ b/packages/SystemUI/res-keyguard/values-da/strings.xml @@ -34,6 +34,7 @@ <string name="keyguard_password_wrong_pin_code" msgid="6535018036285012028">"Forkert pinkode."</string> <string name="keyguard_sim_error_message_short" msgid="592109500618448312">"Ugyldigt kort."</string> <string name="keyguard_charged" msgid="2222329688813033109">"Opladet"</string> + <string name="keyguard_plugged_in_wireless" msgid="3004717438401575235">"<xliff:g id="PERCENTAGE">%s</xliff:g> • Trådløs opladning"</string> <string name="keyguard_plugged_in" msgid="3161102098900158923">"<xliff:g id="PERCENTAGE">%s</xliff:g> • Oplader"</string> <string name="keyguard_plugged_in_charging_fast" msgid="3684592786276709342">"<xliff:g id="PERCENTAGE">%s</xliff:g> • Oplader hurtigt"</string> <string name="keyguard_plugged_in_charging_slowly" msgid="509533586841478405">"<xliff:g id="PERCENTAGE">%s</xliff:g> • Oplader langsomt"</string> diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml index 83451ba6743b..73b16759ca07 100644 --- a/packages/SystemUI/res/values-ca/strings.xml +++ b/packages/SystemUI/res/values-ca/strings.xml @@ -399,6 +399,7 @@ <string name="interruption_level_none_twoline" msgid="3957581548190765889">"Silenci\ntotal"</string> <string name="interruption_level_priority_twoline" msgid="1564715335217164124">"Només\ninterr. prior."</string> <string name="interruption_level_alarms_twoline" msgid="3266909566410106146">"Només\nalarmes"</string> + <string name="keyguard_indication_charging_time_wireless" msgid="5376059837186496558">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • S\'està carregant sense fils (temps restant: <xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g>)"</string> <string name="keyguard_indication_charging_time" msgid="2056340799276374421">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • S\'està carregant (temps restant: <xliff:g id="CHARGING_TIME_LEFT">%s</xliff:g>)"</string> <string name="keyguard_indication_charging_time_fast" msgid="7767562163577492332">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Carregant ràpidament (temps restant: <xliff:g id="CHARGING_TIME_LEFT">%s</xliff:g>)"</string> <string name="keyguard_indication_charging_time_slowly" msgid="3769655133567307069">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • Carregant lentament (temps restant: <xliff:g id="CHARGING_TIME_LEFT">%s</xliff:g>)"</string> diff --git a/packages/SystemUI/res/values-iw/strings.xml b/packages/SystemUI/res/values-iw/strings.xml index 42c5caee72cf..f2905791c963 100644 --- a/packages/SystemUI/res/values-iw/strings.xml +++ b/packages/SystemUI/res/values-iw/strings.xml @@ -405,6 +405,7 @@ <string name="interruption_level_none_twoline" msgid="3957581548190765889">"שקט\nמוחלט"</string> <string name="interruption_level_priority_twoline" msgid="1564715335217164124">"הודעות בעדיפות\nבלבד"</string> <string name="interruption_level_alarms_twoline" msgid="3266909566410106146">"התראות\nבלבד"</string> + <string name="keyguard_indication_charging_time_wireless" msgid="5376059837186496558">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • בטעינה אלחוטית (<xliff:g id="CHARGING_TIME_LEFT">%1$s</xliff:g> עד לסיום)"</string> <string name="keyguard_indication_charging_time" msgid="2056340799276374421">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • בטעינה (<xliff:g id="CHARGING_TIME_LEFT">%s</xliff:g> עד לסיום)"</string> <string name="keyguard_indication_charging_time_fast" msgid="7767562163577492332">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • בטעינה מהירה (<xliff:g id="CHARGING_TIME_LEFT">%s</xliff:g> עד לסיום)"</string> <string name="keyguard_indication_charging_time_slowly" msgid="3769655133567307069">"<xliff:g id="PERCENTAGE">%2$s</xliff:g> • בטעינה איטית (<xliff:g id="CHARGING_TIME_LEFT">%s</xliff:g> עד לסיום)"</string> @@ -800,8 +801,8 @@ <string name="pip_notification_message" msgid="5619512781514343311">"אם אינך רוצה שהתכונה הזו תשמש את <xliff:g id="NAME">%s</xliff:g>, יש להקיש כדי לפתוח את ההגדרות ולכבות את התכונה."</string> <string name="pip_play" msgid="1417176722760265888">"הפעל"</string> <string name="pip_pause" msgid="8881063404466476571">"השהה"</string> - <string name="pip_skip_to_next" msgid="1948440006726306284">"ברצוני לדלג אל הבא"</string> - <string name="pip_skip_to_prev" msgid="1955311326688637914">"ברצוני לדלג אל הקודם"</string> + <string name="pip_skip_to_next" msgid="1948440006726306284">"אפשר לדלג אל הבא"</string> + <string name="pip_skip_to_prev" msgid="1955311326688637914">"אפשר לדלג אל הקודם"</string> <string name="thermal_shutdown_title" msgid="4458304833443861111">"הטלפון כבה עקב התחממות"</string> <string name="thermal_shutdown_message" msgid="9006456746902370523">"הטלפון פועל כרגיל עכשיו"</string> <string name="thermal_shutdown_dialog_message" msgid="566347880005304139">"הטלפון שלך התחמם יותר מדי וכבה כדי להתקרר. הטלפון פועל כרגיל עכשיו.\n\nייתכן שהטלפון יתחמם יותר מדי אם:\n • תשתמש באפליקציות עתירות משאבים (כגון משחקים, אפליקציות וידאו או אפליקציות ניווט)\n • תוריד או תעלה קבצים גדולים\n • תשתמש בטלפון בטמפרטורות גבוהות"</string> diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 03fb9bbdbd4e..0fcb99445a44 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -340,7 +340,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe case SimPuk: // Shortcut for SIM PIN/PUK to go to directly to user's security screen or home SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId); - if (securityMode == SecurityMode.None || mLockPatternUtils.isLockScreenDisabled( + if (securityMode == SecurityMode.None && mLockPatternUtils.isLockScreenDisabled( KeyguardUpdateMonitor.getCurrentUser())) { finish = true; } else { diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 223eb552f832..89b59cf4a734 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -1142,7 +1142,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { if (isBluetoothDisallowed) { return; } - if (mEnableExternal && isBluetoothPersistedStateOnBluetooth()) { + final boolean isSafeMode = mContext.getPackageManager().isSafeMode(); + if (mEnableExternal && isBluetoothPersistedStateOnBluetooth() && !isSafeMode) { if (DBG) { Slog.d(TAG, "Auto-enabling Bluetooth."); } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 5ebd17360961..27ef4a7c54a8 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -452,20 +452,10 @@ import com.android.server.SystemService; import com.android.server.SystemServiceManager; import com.android.server.ThreadPriorityBooster; import com.android.server.Watchdog; -import com.android.server.am.ActivityManagerServiceDumpActivitiesProto; -import com.android.server.am.ActivityManagerServiceDumpBroadcastsProto; -import com.android.server.am.ActivityManagerServiceDumpProcessesProto; import com.android.server.am.ActivityManagerServiceDumpProcessesProto.UidObserverRegistrationProto; -import com.android.server.am.ActivityManagerServiceDumpServicesProto; import com.android.server.am.ActivityStack.ActivityState; -import com.android.server.am.GrantUriProto; -import com.android.server.am.ImportanceTokenProto; -import com.android.server.am.MemInfoDumpProto; import com.android.server.am.MemoryStatUtil.MemoryStat; -import com.android.server.am.NeededUriGrantsProto; -import com.android.server.am.ProcessOomProto; -import com.android.server.am.ProcessToGcProto; -import com.android.server.am.StickyBroadcastProto; +import com.android.server.compat.CompatConfig; import com.android.server.firewall.IntentFirewall; import com.android.server.job.JobSchedulerInternal; import com.android.server.pm.Installer; @@ -478,12 +468,12 @@ import com.android.server.wm.WindowManagerService; import dalvik.system.VMRuntime; -import com.google.android.collect.Lists; -import com.google.android.collect.Maps; - import libcore.io.IoUtils; import libcore.util.EmptyArray; +import com.google.android.collect.Lists; +import com.google.android.collect.Maps; + import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; @@ -4309,6 +4299,9 @@ public class ActivityManagerService extends IActivityManager.Stub if ("1".equals(SystemProperties.get("debug.assert"))) { runtimeFlags |= Zygote.DEBUG_ENABLE_ASSERT; } + if ("1".equals(SystemProperties.get("debug.ignoreappsignalhandler"))) { + runtimeFlags |= Zygote.DEBUG_IGNORE_APP_SIGNAL_HANDLER; + } if (mNativeDebuggingApp != null && mNativeDebuggingApp.equals(app.processName)) { // Enable all debug flags required by the native debugger. runtimeFlags |= Zygote.DEBUG_ALWAYS_JIT; // Don't interpret anything @@ -7670,6 +7663,7 @@ public class ActivityManagerService extends IActivityManager.Stub checkTime(startTime, "attachApplicationLocked: immediately before bindApplication"); bindApplicationTimeMillis = SystemClock.elapsedRealtime(); mStackSupervisor.getActivityMetricsLogger().notifyBindApplication(app); + long[] disabledCompatChanges = CompatConfig.get().getDisabledChanges(app.info); if (app.isolatedEntryPoint != null) { // This is an isolated process which should just call an entry point instead of // being bound to an application. @@ -7685,7 +7679,7 @@ public class ActivityManagerService extends IActivityManager.Stub new Configuration(getGlobalConfiguration()), app.compat, getCommonServicesLocked(app.isolated), mCoreSettingsObserver.getCoreSettingsLocked(), - buildSerial, isAutofillCompatEnabled); + buildSerial, isAutofillCompatEnabled, disabledCompatChanges); } else { thread.bindApplication(processName, appInfo, providers, null, profilerInfo, null, null, null, testMode, @@ -7694,7 +7688,7 @@ public class ActivityManagerService extends IActivityManager.Stub new Configuration(getGlobalConfiguration()), app.compat, getCommonServicesLocked(app.isolated), mCoreSettingsObserver.getCoreSettingsLocked(), - buildSerial, isAutofillCompatEnabled); + buildSerial, isAutofillCompatEnabled, disabledCompatChanges); } if (profilerInfo != null) { profilerInfo.closeFd(); diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java index 3399a76f358f..6596cff4b6b4 100644 --- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java +++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java @@ -16,6 +16,15 @@ package com.android.server.am; +import static android.app.ActivityManager.RESIZE_MODE_SYSTEM; +import static android.app.ActivityManager.RESIZE_MODE_USER; +import static android.app.ActivityManager.StackId.INVALID_STACK_ID; +import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; +import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; +import static android.view.Display.INVALID_DISPLAY; + +import static com.android.server.am.TaskRecord.INVALID_TASK_ID; + import android.app.ActivityManager; import android.app.ActivityOptions; import android.app.AppGlobals; @@ -74,6 +83,7 @@ import android.view.Display; import com.android.internal.util.HexDump; import com.android.internal.util.MemInfoReader; import com.android.internal.util.Preconditions; +import com.android.server.compat.CompatConfig; import java.io.BufferedReader; import java.io.File; @@ -96,15 +106,6 @@ import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; -import static android.app.ActivityManager.RESIZE_MODE_SYSTEM; -import static android.app.ActivityManager.RESIZE_MODE_USER; -import static android.app.ActivityManager.StackId.INVALID_STACK_ID; -import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; -import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; -import static android.view.Display.INVALID_DISPLAY; - -import static com.android.server.am.TaskRecord.INVALID_TASK_ID; - final class ActivityManagerShellCommand extends ShellCommand { public static final String NO_CLASS_ERROR_CODE = "Error type 3"; private static final String SHELL_PACKAGE_NAME = "com.android.shell"; @@ -277,6 +278,8 @@ final class ActivityManagerShellCommand extends ShellCommand { return runNoHomeScreen(pw); case "wait-for-broadcast-idle": return runWaitForBroadcastIdle(pw); + case "compat": + return runCompat(pw); default: return handleDefaultCommands(cmd); } @@ -2794,6 +2797,50 @@ final class ActivityManagerShellCommand extends ShellCommand { return 0; } + private int runCompat(PrintWriter pw) { + final CompatConfig config = CompatConfig.get(); + String toggleValue = getNextArgRequired(); + long changeId; + String changeIdString = getNextArgRequired(); + try { + changeId = Long.parseLong(changeIdString); + } catch (NumberFormatException e) { + changeId = config.lookupChangeId(changeIdString); + } + if (changeId == -1) { + pw.println("Unknown or invalid change: '" + changeIdString + "'."); + } + String packageName = getNextArgRequired(); + switch(toggleValue) { + case "enable": + if (!config.addOverride(changeId, packageName, true)) { + pw.println("Warning! Change " + changeId + " is not known yet. Enabling it" + + " could have no effect."); + } + pw.println("Enabled change " + changeId + " for " + packageName + "."); + return 0; + case "disable": + if (!config.addOverride(changeId, packageName, false)) { + pw.println("Warning! Change " + changeId + " is not known yet. Disabling it" + + " could have no effect."); + } + pw.println("Disabled change " + changeId + " for " + packageName + "."); + return 0; + case "reset": + if (config.removeOverride(changeId, packageName)) { + pw.println("Reset change " + changeId + " for " + packageName + + " to default value."); + } else { + pw.println("No override exists for changeId " + changeId + "."); + } + return 0; + default: + pw.println("Invalid toggle value: '" + toggleValue + "'."); + } + return -1; + } + + private Resources getResources(PrintWriter pw) throws RemoteException { // system resources does not contain all the device configuration, construct it manually. Configuration config = mInterface.getConfiguration(); @@ -3090,6 +3137,8 @@ final class ActivityManagerShellCommand extends ShellCommand { pw.println(" without restarting any processes."); pw.println(" write"); pw.println(" Write all pending state to storage."); + pw.println(" compat enable|disable|reset <CHANGE_ID|CHANGE_NAME> <PACKAGE_NAME>"); + pw.println(" Toggles a change either by id or by name for <PACKAGE_NAME>."); pw.println(); Intent.printIntentArgsHelp(pw, ""); } diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 2a598774a2e1..a83b3375125e 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -363,7 +363,7 @@ public class AudioService extends IAudioService.Stub AudioSystem.STREAM_MUSIC, // STREAM_MUSIC AudioSystem.STREAM_MUSIC, // STREAM_ALARM AudioSystem.STREAM_MUSIC, // STREAM_NOTIFICATION - AudioSystem.STREAM_MUSIC, // STREAM_BLUETOOTH_SCO + AudioSystem.STREAM_BLUETOOTH_SCO, // STREAM_BLUETOOTH_SCO AudioSystem.STREAM_MUSIC, // STREAM_SYSTEM_ENFORCED AudioSystem.STREAM_MUSIC, // STREAM_DTMF AudioSystem.STREAM_MUSIC, // STREAM_TTS diff --git a/services/core/java/com/android/server/compat/CompatChange.java b/services/core/java/com/android/server/compat/CompatChange.java index bb3b9be2bd2f..2a866f390283 100644 --- a/services/core/java/com/android/server/compat/CompatChange.java +++ b/services/core/java/com/android/server/compat/CompatChange.java @@ -106,6 +106,12 @@ public final class CompatChange { * @return {@code true} if the change should be enabled for the package. */ boolean isEnabled(ApplicationInfo app) { + if (app.isSystemApp()) { + // All changes are enabled for system apps, and we do not support overrides. + // Compatibility issues for system apps should be addressed in the app itself when + // the compatibility change is made. + return true; + } if (mPackageOverrides != null && mPackageOverrides.containsKey(app.packageName)) { return mPackageOverrides.get(app.packageName); } diff --git a/services/core/java/com/android/server/compat/CompatConfig.java b/services/core/java/com/android/server/compat/CompatConfig.java index fea5d836ac25..bcf1d80781a6 100644 --- a/services/core/java/com/android/server/compat/CompatConfig.java +++ b/services/core/java/com/android/server/compat/CompatConfig.java @@ -128,20 +128,24 @@ public final class CompatConfig { * <p>Note, package overrides are not persistent and will be lost on system or runtime restart. * * @param changeId The ID of the change to be overridden. Note, this call will succeed even if - * this change is not known; it will only have any affect if any code in the + * this change is not known; it will only have any effect if any code in the * platform is gated on the ID given. * @param packageName The app package name to override the change for. * @param enabled If the change should be enabled or disabled. + * @return {@code true} if the change existed before adding the override. */ - public void addOverride(long changeId, String packageName, boolean enabled) { + public boolean addOverride(long changeId, String packageName, boolean enabled) { + boolean alreadyKnown = true; synchronized (mChanges) { CompatChange c = mChanges.get(changeId); if (c == null) { + alreadyKnown = false; c = new CompatChange(changeId); addChange(c); } c.addPackageOverride(packageName, enabled); } + return alreadyKnown; } /** @@ -151,14 +155,18 @@ public final class CompatConfig { * * @param changeId The ID of the change that was overridden. * @param packageName The app package name that was overridden. + * @return {@code true} if an override existed; */ - public void removeOverride(long changeId, String packageName) { + public boolean removeOverride(long changeId, String packageName) { + boolean overrideExists = false; synchronized (mChanges) { CompatChange c = mChanges.get(changeId); if (c != null) { + overrideExists = true; c.removePackageOverride(packageName); } } + return overrideExists; } } diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java index 755a571cf5f7..95051dea2e9a 100644 --- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java @@ -27,6 +27,7 @@ import static com.android.server.wm.ScreenRotationAnimationProto.ANIMATION_RUNNI import static com.android.server.wm.ScreenRotationAnimationProto.STARTED; import android.content.Context; +import android.graphics.GraphicBuffer; import android.graphics.Matrix; import android.graphics.Rect; import android.os.IBinder; @@ -285,10 +286,27 @@ class ScreenRotationAnimation { if (displayHandle != null) { Surface sur = new Surface(); sur.copyFrom(mSurfaceControl); - SurfaceControl.screenshot(displayHandle, sur); - t.setLayer(mSurfaceControl, SCREEN_FREEZE_LAYER_SCREENSHOT); - t.setAlpha(mSurfaceControl, 0); - t.show(mSurfaceControl); + GraphicBuffer gb = SurfaceControl.screenshotToBufferWithSecureLayersUnsafe( + new Rect(), 0 /* width */, 0 /* height */, 0 /* minLayer */, + 0 /* maxLayer */, false /* useIdentityTransform */, 0 /* rotation */); + if (gb != null) { + try { + sur.attachAndQueueBuffer(gb); + } catch (RuntimeException e) { + Slog.w(TAG, "Failed to attach screenshot - " + e.getMessage()); + } + // If the screenshot contains secure layers, we have to make sure the + // screenshot surface we display it in also has FLAG_SECURE so that + // the user can not screenshot secure layers via the screenshot surface. + if (gb.doesContainSecureLayers()) { + t.setSecure(mSurfaceControl, true); + } + t.setLayer(mSurfaceControl, SCREEN_FREEZE_LAYER_SCREENSHOT); + t.setAlpha(mSurfaceControl, 0); + t.show(mSurfaceControl); + } else { + Slog.w(TAG, "Unable to take screenshot of display " + displayId); + } sur.destroy(); } else { Slog.w(TAG, "Built-in display " + displayId + " is null."); diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 83ae0fc0c95f..dab160338a76 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -1671,6 +1671,10 @@ public final class SystemServer { mSystemServiceManager.startService(StatsCompanionService.Lifecycle.class); traceEnd(); + if (safeMode) { + mActivityManagerService.enterSafeMode(); + } + // MMS service broker traceBeginAndSlog("StartMmsService"); mmsService = mSystemServiceManager.startService(MmsServiceBroker.class); diff --git a/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java b/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java index e6c484a8dbbc..d008ca66b762 100644 --- a/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java +++ b/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java @@ -142,4 +142,32 @@ public class CompatConfigTest { CompatConfig pc = new CompatConfig(); assertThat(pc.lookupChangeId("MY_CHANGE")).isEqualTo(-1L); } + + @Test + public void testSystemAppDisabledChangeEnabled() { + CompatConfig pc = new CompatConfig(); + pc.addChange(new CompatChange(1234L, "MY_CHANGE", -1, true)); // disabled + ApplicationInfo sysApp = makeAppInfo("system.app", 1); + sysApp.flags |= ApplicationInfo.FLAG_SYSTEM; + assertThat(pc.isChangeEnabled(1234L, sysApp)).isTrue(); + } + + @Test + public void testSystemAppOverrideIgnored() { + CompatConfig pc = new CompatConfig(); + pc.addChange(new CompatChange(1234L, "MY_CHANGE", -1, false)); + pc.addOverride(1234L, "system.app", false); + ApplicationInfo sysApp = makeAppInfo("system.app", 1); + sysApp.flags |= ApplicationInfo.FLAG_SYSTEM; + assertThat(pc.isChangeEnabled(1234L, sysApp)).isTrue(); + } + + @Test + public void testSystemAppTargetSdkIgnored() { + CompatConfig pc = new CompatConfig(); + pc.addChange(new CompatChange(1234L, "MY_CHANGE", 2, false)); + ApplicationInfo sysApp = makeAppInfo("system.app", 1); + sysApp.flags |= ApplicationInfo.FLAG_SYSTEM; + assertThat(pc.isChangeEnabled(1234L, sysApp)).isTrue(); + } } diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index e949e7490230..655363efd2e0 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -922,6 +922,8 @@ public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver if (!mScreenLocked && mScreenUnlockedFunctions != UsbManager.FUNCTION_NONE) { // If the screen is unlocked, also set current functions. setScreenUnlockedFunctions(); + } else { + setEnabledFunctions(UsbManager.FUNCTION_NONE, false); } break; case MSG_UPDATE_SCREEN_LOCK: diff --git a/startop/apps/ColorChanging/.gitignore b/startop/apps/ColorChanging/.gitignore new file mode 100644 index 000000000000..2b75303ac58f --- /dev/null +++ b/startop/apps/ColorChanging/.gitignore @@ -0,0 +1,13 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/startop/apps/ColorChanging/.idea/encodings.xml b/startop/apps/ColorChanging/.idea/encodings.xml new file mode 100644 index 000000000000..15a15b218a29 --- /dev/null +++ b/startop/apps/ColorChanging/.idea/encodings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding" addBOMForNewFiles="with NO BOM" /> +</project>
\ No newline at end of file diff --git a/startop/apps/ColorChanging/.idea/gradle.xml b/startop/apps/ColorChanging/.idea/gradle.xml new file mode 100644 index 000000000000..2996d531255e --- /dev/null +++ b/startop/apps/ColorChanging/.idea/gradle.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="GradleSettings"> + <option name="linkedExternalProjectsSettings"> + <GradleProjectSettings> + <compositeConfiguration> + <compositeBuild compositeDefinitionSource="SCRIPT" /> + </compositeConfiguration> + <option name="distributionType" value="DEFAULT_WRAPPED" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="resolveModulePerSourceSet" value="false" /> + </GradleProjectSettings> + </option> + </component> +</project>
\ No newline at end of file diff --git a/startop/apps/ColorChanging/.idea/misc.xml b/startop/apps/ColorChanging/.idea/misc.xml new file mode 100644 index 000000000000..37a750962da6 --- /dev/null +++ b/startop/apps/ColorChanging/.idea/misc.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/build/classes" /> + </component> + <component name="ProjectType"> + <option name="id" value="Android" /> + </component> +</project>
\ No newline at end of file diff --git a/startop/apps/ColorChanging/.idea/runConfigurations.xml b/startop/apps/ColorChanging/.idea/runConfigurations.xml new file mode 100644 index 000000000000..7f68460d8b38 --- /dev/null +++ b/startop/apps/ColorChanging/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="RunConfigurationProducerService"> + <option name="ignoredProducers"> + <set> + <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" /> + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" /> + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" /> + </set> + </option> + </component> +</project>
\ No newline at end of file diff --git a/startop/apps/ColorChanging/README.md b/startop/apps/ColorChanging/README.md new file mode 100644 index 000000000000..eb8b9cc1103b --- /dev/null +++ b/startop/apps/ColorChanging/README.md @@ -0,0 +1,5 @@ +This directory contains a simple Android app that is meant to help in +syncing a trace along with a video in Perfetto. + +This app changes the colors of the screen that has traces to go along +with the colors. diff --git a/startop/apps/ColorChanging/app/.gitignore b/startop/apps/ColorChanging/app/.gitignore new file mode 100644 index 000000000000..796b96d1c402 --- /dev/null +++ b/startop/apps/ColorChanging/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/startop/apps/ColorChanging/app/build.gradle b/startop/apps/ColorChanging/app/build.gradle new file mode 100644 index 000000000000..ab955aaf90ee --- /dev/null +++ b/startop/apps/ColorChanging/app/build.gradle @@ -0,0 +1,29 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.0" + defaultConfig { + applicationId "com.android.startop.colorchanging" + minSdkVersion 15 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} diff --git a/startop/apps/ColorChanging/app/proguard-rules.pro b/startop/apps/ColorChanging/app/proguard-rules.pro new file mode 100644 index 000000000000..f1b424510da5 --- /dev/null +++ b/startop/apps/ColorChanging/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/startop/apps/ColorChanging/app/src/androidTest/java/com/android/startop/colorchanging/ExampleInstrumentedTest.java b/startop/apps/ColorChanging/app/src/androidTest/java/com/android/startop/colorchanging/ExampleInstrumentedTest.java new file mode 100644 index 000000000000..31736f3e2862 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/androidTest/java/com/android/startop/colorchanging/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.android.startop.colorchanging; + +import android.content.Context; + +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.android.startop.colorchanging", appContext.getPackageName()); + } +} diff --git a/startop/apps/ColorChanging/app/src/main/AndroidManifest.xml b/startop/apps/ColorChanging/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..37193b5ff596 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.startop.colorchanging"> + + <application + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/AppTheme"> + <activity android:name="com.android.startop.colorchanging.MainActivity"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest>
\ No newline at end of file diff --git a/startop/apps/ColorChanging/app/src/main/java/com/android/startop/colorchanging/MainActivity.java b/startop/apps/ColorChanging/app/src/main/java/com/android/startop/colorchanging/MainActivity.java new file mode 100644 index 000000000000..b8f4faf299a9 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/java/com/android/startop/colorchanging/MainActivity.java @@ -0,0 +1,91 @@ +/* + * 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.startop.colorchanging; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; +import android.os.Trace; +import android.view.View; + +public class MainActivity extends AppCompatActivity { + View view; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + view = this.getWindow().getDecorView(); + view.setBackgroundResource(R.color.gray); + Trace.beginSection("gray"); + } + + public void goRed(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.red); + Trace.beginSection("red"); + } + + public void goOrange(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.orange); + Trace.beginSection("orange"); + } + + public void goYellow(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.yellow); + Trace.beginSection("yellow"); + } + + public void goGreen(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.green); + Trace.beginSection("green"); + } + + public void goBlue(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.blue); + Trace.beginSection("blue"); + } + + public void goIndigo(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.indigo); + Trace.beginSection("indigo"); + } + + public void goViolet(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.violet); + Trace.beginSection("violet"); + } + + public void goCyan(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.cyan); + Trace.beginSection("cyan"); + } + + public void goBlack(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.black); + Trace.beginSection("black"); + } + +} diff --git a/startop/apps/ColorChanging/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/startop/apps/ColorChanging/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 000000000000..1f6bb290603d --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path + android:fillType="evenOdd" + android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z" + android:strokeWidth="1" + android:strokeColor="#00000000"> + <aapt:attr name="android:fillColor"> + <gradient + android:endX="78.5885" + android:endY="90.9159" + android:startX="48.7653" + android:startY="61.0927" + android:type="linear"> + <item + android:color="#44000000" + android:offset="0.0" /> + <item + android:color="#00000000" + android:offset="1.0" /> + </gradient> + </aapt:attr> + </path> + <path + android:fillColor="#FFFFFF" + android:fillType="nonZero" + android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z" + android:strokeWidth="1" + android:strokeColor="#00000000" /> +</vector> diff --git a/startop/apps/ColorChanging/app/src/main/res/drawable/ic_launcher_background.xml b/startop/apps/ColorChanging/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 000000000000..0d025f9bf6b6 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path + android:fillColor="#008577" + android:pathData="M0,0h108v108h-108z" /> + <path + android:fillColor="#00000000" + android:pathData="M9,0L9,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,0L19,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,0L29,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,0L39,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,0L49,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,0L59,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,0L69,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,0L79,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M89,0L89,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M99,0L99,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,9L108,9" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,19L108,19" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,29L108,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,39L108,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,49L108,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,59L108,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,69L108,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,79L108,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,89L108,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,99L108,99" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,29L89,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,39L89,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,49L89,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,59L89,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,69L89,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,79L89,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,19L29,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,19L39,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,19L49,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,19L59,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,19L69,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,19L79,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> +</vector> diff --git a/startop/apps/ColorChanging/app/src/main/res/layout/activity_main.xml b/startop/apps/ColorChanging/app/src/main/res/layout/activity_main.xml new file mode 100644 index 000000000000..fb18df79cce2 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MainActivity"> + + <Button + android:id="@+id/button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginLeft="16dp" + android:layout_marginTop="16dp" + android:onClick="goRed" + android:text="red" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <Button + android:id="@+id/button4" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" + android:onClick="goYellow" + android:text="YELLOW" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <Button + android:id="@+id/button6" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginLeft="16dp" + android:layout_marginTop="32dp" + android:onClick="goGreen" + android:text="GREEN" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/button" /> + + <Button + android:id="@+id/button7" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="165dp" + android:layout_marginLeft="165dp" + android:layout_marginTop="115dp" + android:layout_marginEnd="165dp" + android:layout_marginRight="165dp" + android:onClick="goViolet" + android:text="VIOLET" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.428" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/button8" /> + + <Button + android:id="@+id/button10" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="165dp" + android:layout_marginLeft="165dp" + android:layout_marginTop="32dp" + android:layout_marginEnd="165dp" + android:layout_marginRight="165dp" + android:onClick="goBlue" + android:text="BLUE" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/button8" /> + + <Button + android:id="@+id/button8" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="165dp" + android:layout_marginLeft="165dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="165dp" + android:layout_marginRight="165dp" + android:onClick="goOrange" + android:text="ORANGE" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <Button + android:id="@+id/button11" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="32dp" + android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" + android:onClick="goIndigo" + android:text="INDIGO" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/button4" /> + + <Button + android:id="@+id/button12" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="162dp" + android:layout_marginLeft="162dp" + android:layout_marginTop="25dp" + android:layout_marginEnd="161dp" + android:layout_marginRight="161dp" + android:onClick="goCyan" + android:text="CYAN" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/button7" /> + + <Button + android:id="@+id/button13" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="162dp" + android:layout_marginLeft="162dp" + android:layout_marginTop="25dp" + android:layout_marginEnd="161dp" + android:layout_marginRight="161dp" + android:onClick="goBlack" + android:text="BLACK" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/button12" /> +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/startop/apps/ColorChanging/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 000000000000..eca70cfe52ea --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon>
\ No newline at end of file diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/startop/apps/ColorChanging/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 000000000000..eca70cfe52ea --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon>
\ No newline at end of file diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-hdpi/ic_launcher.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000000..898f3ed59ac9 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-hdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 000000000000..dffca3601eba --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-mdpi/ic_launcher.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000000..64ba76f75e9c --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-mdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 000000000000..dae5e082342f --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000000..e5ed46597ea8 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 000000000000..14ed0af35023 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000000..b0907cac3bfd --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 000000000000..d8ae03154975 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000000..2c18de9e6610 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/startop/apps/ColorChanging/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/startop/apps/ColorChanging/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 000000000000..beed3cdd2c32 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/startop/apps/ColorChanging/app/src/main/res/values/colors.xml b/startop/apps/ColorChanging/app/src/main/res/values/colors.xml new file mode 100644 index 000000000000..209790fed1cd --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/values/colors.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="colorPrimary">#008577</color> + <color name="colorPrimaryDark">#00574B</color> + <color name="colorAccent">#D81B60</color> + <color name="black">#000000</color> + <color name="red">#F44336</color> + <color name="green">#2CF035</color> + <color name="blue">#2C70F0</color> + <color name="yellow">#F0EA2C</color> + <color name="gray">#D3D3D3</color> + <color name="orange">#E57E0A</color> + <color name="indigo">#4B0082</color> + <color name="violet">#EE82EE</color> + <color name="cyan">#00E8FF</color> +</resources> diff --git a/startop/apps/ColorChanging/app/src/main/res/values/strings.xml b/startop/apps/ColorChanging/app/src/main/res/values/strings.xml new file mode 100644 index 000000000000..ff062fb274bf --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ +<resources> + <string name="app_name">ColorChanging</string> +</resources> diff --git a/startop/apps/ColorChanging/app/src/main/res/values/styles.xml b/startop/apps/ColorChanging/app/src/main/res/values/styles.xml new file mode 100644 index 000000000000..5885930df6d1 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ +<resources> + + <!-- Base application theme. --> + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> + <!-- Customize your theme here. --> + <item name="colorPrimary">@color/colorPrimary</item> + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> + <item name="colorAccent">@color/colorAccent</item> + </style> + +</resources> diff --git a/startop/apps/ColorChanging/app/src/test/java/com/android/startop/colorchanging/ExampleUnitTest.java b/startop/apps/ColorChanging/app/src/test/java/com/android/startop/colorchanging/ExampleUnitTest.java new file mode 100644 index 000000000000..8423674b9d75 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/test/java/com/android/startop/colorchanging/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.android.startop.colorchanging; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +}
\ No newline at end of file diff --git a/startop/apps/ColorChanging/build.gradle b/startop/apps/ColorChanging/build.gradle new file mode 100644 index 000000000000..a960ab34dc6e --- /dev/null +++ b/startop/apps/ColorChanging/build.gradle @@ -0,0 +1,24 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.4.1' + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/startop/apps/ColorChanging/gradle.properties b/startop/apps/ColorChanging/gradle.properties new file mode 100644 index 000000000000..199d16ede38c --- /dev/null +++ b/startop/apps/ColorChanging/gradle.properties @@ -0,0 +1,20 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true + diff --git a/startop/apps/ColorChanging/gradle/wrapper/gradle-wrapper.jar b/startop/apps/ColorChanging/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 000000000000..f6b961fd5a86 --- /dev/null +++ b/startop/apps/ColorChanging/gradle/wrapper/gradle-wrapper.jar diff --git a/startop/apps/ColorChanging/gradle/wrapper/gradle-wrapper.properties b/startop/apps/ColorChanging/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..09f2718ae856 --- /dev/null +++ b/startop/apps/ColorChanging/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Jun 17 13:40:58 PDT 2019 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/startop/apps/ColorChanging/gradlew b/startop/apps/ColorChanging/gradlew new file mode 100755 index 000000000000..cccdd3d517fc --- /dev/null +++ b/startop/apps/ColorChanging/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/startop/apps/ColorChanging/gradlew.bat b/startop/apps/ColorChanging/gradlew.bat new file mode 100644 index 000000000000..e95643d6a2ca --- /dev/null +++ b/startop/apps/ColorChanging/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/startop/apps/ColorChanging/settings.gradle b/startop/apps/ColorChanging/settings.gradle new file mode 100644 index 000000000000..e7b4def49cb5 --- /dev/null +++ b/startop/apps/ColorChanging/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index 2ffad0345c64..f201cc1f9375 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -17,6 +17,7 @@ package android.telecom; import android.annotation.SystemApi; +import android.content.Intent; import android.graphics.drawable.Icon; import android.net.Uri; import android.os.Bundle; @@ -24,7 +25,6 @@ import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; -import java.lang.String; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -314,7 +314,22 @@ public final class PhoneAccount implements Parcelable { */ public static final int CAPABILITY_RTT = 0x1000; - /* NEXT CAPABILITY: 0x2000 */ + /** + * Flag indicating that this {@link PhoneAccount} is the preferred SIM subscription for + * emergency calls. A {@link PhoneAccount} that sets this capabilitiy must also + * set the {@link #CAPABILITY_SIM_SUBSCRIPTION} and {@link #CAPABILITY_PLACE_EMERGENCY_CALLS} + * capabilities. There should only be one emergency preferred {@link PhoneAccount}. + * <p> + * When set, Telecom will prefer this {@link PhoneAccount} over others for emergency calling, + * even if the emergency call was placed with a specific {@link PhoneAccount} set using the + * extra{@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE} in + * {@link Intent#ACTION_CALL_EMERGENCY} or {@link TelecomManager#placeCall(Uri, Bundle)}. + * + * @hide + */ + public static final int CAPABILITY_EMERGENCY_PREFERRED = 0x2000; + + /* NEXT CAPABILITY: 0x4000 */ /** * URI scheme for telephone number URIs. @@ -1020,6 +1035,9 @@ public final class PhoneAccount implements Parcelable { if (hasCapabilities(CAPABILITY_PLACE_EMERGENCY_CALLS)) { sb.append("PlaceEmerg "); } + if (hasCapabilities(CAPABILITY_EMERGENCY_PREFERRED)) { + sb.append("EmerPrefer "); + } if (hasCapabilities(CAPABILITY_EMERGENCY_VIDEO_CALLING)) { sb.append("EmergVideo "); } diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 1f701587412e..3b4b86807121 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -1800,6 +1800,13 @@ public class TelecomManager { * Self-managed {@link ConnectionService}s require permission * {@link android.Manifest.permission#MANAGE_OWN_CALLS}. * + * <p class="note"><strong>Note:</strong> If this method is used to place an emergency call, it + * is not guaranteed that the call will be placed on the {@link PhoneAccount} provided in + * the {@link #EXTRA_PHONE_ACCOUNT_HANDLE} extra (if specified) and may be placed on another + * {@link PhoneAccount} with the {@link PhoneAccount#CAPABILITY_PLACE_EMERGENCY_CALLS} + * capability, depending on external factors, such as network conditions and Modem/SIM status. + * </p> + * * @param address The address to make the call to. * @param extras Bundle of extras to use with the call. */ diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java index 83aa52176b87..094f8c2eb053 100644 --- a/telephony/java/android/provider/Telephony.java +++ b/telephony/java/android/provider/Telephony.java @@ -2975,6 +2975,7 @@ public final class Telephony { * The {@code content://} style URL for this table. Can be appended with a part ID to * address individual parts. */ + @NonNull public static final Uri CONTENT_URI = Uri.withAppendedPath(Mms.CONTENT_URI, "part"); /** diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 77e35e1530bf..31cd60807570 100755 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -2649,6 +2649,68 @@ public class CarrierConfigManager { public static final String KEY_AUTO_CANCEL_CS_REJECT_NOTIFICATION = "carrier_auto_cancel_cs_notification"; + /** + * GPS configs. See android.hardware.gnss@1.0 IGnssConfiguration. + * @hide + */ + public static final class Gps { + /** Prefix of all Gps.KEY_* constants. */ + public static final String KEY_PREFIX = "gps."; + + /** + * Location information during (and after) an emergency call is only provided over control + * plane signaling from the network. + * @hide + */ + public static final int SUPL_EMERGENCY_MODE_TYPE_CP_ONLY = 0; + + /** + * Location information during (and after) an emergency call is provided over the data + * plane and serviced by the framework GNSS service, but if it fails, the carrier also + * supports control plane backup signaling. + * @hide + */ + public static final int SUPL_EMERGENCY_MODE_TYPE_CP_FALLBACK = 1; + + /** + * Location information during (and after) an emergency call is provided over the data plane + * and serviced by the framework GNSS service only. There is no backup signalling over the + * control plane if it fails. + * @hide + */ + public static final int SUPL_EMERGENCY_MODE_TYPE_DP_ONLY = 2; + + /** + * Control Plane / SUPL NI emergency extension time in seconds. Default to "0". + */ + public static final String KEY_ES_EXTENSION_SEC_STRING = KEY_PREFIX + "es_extension_sec"; + + /** + * Determines whether or not SUPL ES mode supports a control-plane mechanism to get a user's + * location in the event that data plane SUPL fails or is otherwise unavailable. + * <p> + * An integer value determines the support type of this carrier. If this carrier only + * supports data plane SUPL ES, then the value will be + * {@link #SUPL_EMERGENCY_MODE_TYPE_DP_ONLY}. If the carrier supports control plane fallback + * for emergency SUPL, the value will be {@link #SUPL_EMERGENCY_MODE_TYPE_CP_FALLBACK}. + * If the carrier does not support data plane SUPL using the framework, the value will be + * {@link #SUPL_EMERGENCY_MODE_TYPE_CP_ONLY}. + * <p> + * The default value for this configuration is {@link #SUPL_EMERGENCY_MODE_TYPE_CP_ONLY}. + * @hide + */ + public static final String KEY_ES_SUPL_CONTROL_PLANE_SUPPORT_INT = KEY_PREFIX + + "es_supl_control_plane_support_int"; + + private static PersistableBundle getDefaults() { + PersistableBundle defaults = new PersistableBundle(); + defaults.putString(KEY_ES_EXTENSION_SEC_STRING, "0"); + defaults.putInt(KEY_ES_SUPL_CONTROL_PLANE_SUPPORT_INT, + SUPL_EMERGENCY_MODE_TYPE_CP_ONLY); + return defaults; + } + } + /** * An int array containing CDMA enhanced roaming indicator values for Home (non-roaming) network. * The default values come from 3GPP2 C.R1001 table 8.1-1. @@ -3133,6 +3195,7 @@ public class CarrierConfigManager { sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_ENTRY_OR_EXIT_HYSTERESIS_TIME_LONG, 10000); /* Default value is 10 seconds. */ sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_HYSTERESIS_TIME_LONG, 10000); + sDefaults.putAll(Gps.getDefaults()); sDefaults.putIntArray(KEY_CDMA_ENHANCED_ROAMING_INDICATOR_FOR_HOME_NETWORK_INT_ARRAY, new int[] { 1 /* Roaming Indicator Off */ diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 6557886d3a5c..1c048571f12f 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -3078,18 +3078,10 @@ public class SubscriptionManager { } /** - * Returns whether the subscription is enabled or not. This is different from activated - * or deactivated for two aspects. 1) For when user disables a physical subscription, we - * actually disable the modem because we can't switch off the subscription. 2) For eSIM, - * user may enable one subscription but the system may activate another temporarily. In this - * case, user enabled one is different from current active one. - - * @param subscriptionId The subscription it asks about. - * @return whether it's enabled or not. {@code true} if user set this subscription enabled - * earlier, or user never set subscription enable / disable on this slot explicitly, and - * this subscription is currently active. Otherwise, it returns {@code false}. - * + * DO NOT USE. + * This API is designed for features that are not finished at this point. Do not call this API. * @hide + * TODO b/135547512: further clean up */ @SystemApi @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -3107,14 +3099,10 @@ public class SubscriptionManager { } /** - * Get which subscription is enabled on this slot. See {@link #isSubscriptionEnabled(int)} - * for more details. - * - * @param slotIndex which slot it asks about. - * @return which subscription is enabled on this slot. If there's no enabled subscription - * in this slot, it will return {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}. - * + * DO NOT USE. + * This API is designed for features that are not finished at this point. Do not call this API. * @hide + * TODO b/135547512: further clean up */ @SystemApi @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 03a5c74be766..fe812151489b 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -4777,7 +4777,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return DATA_ACTIVITY_NONE; - return telephony.getDataActivity(); + return telephony.getDataActivityForSubId( + getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } catch (RemoteException ex) { // the phone process is restarting. return DATA_ACTIVITY_NONE; @@ -4825,7 +4826,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return DATA_DISCONNECTED; - return telephony.getDataState(); + return telephony.getDataStateForSubId( + getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } catch (RemoteException ex) { // the phone process is restarting. return DATA_DISCONNECTED; diff --git a/telephony/java/android/telephony/ims/ImsException.java b/telephony/java/android/telephony/ims/ImsException.java index 8c686f704967..8e1324b3be0b 100644 --- a/telephony/java/android/telephony/ims/ImsException.java +++ b/telephony/java/android/telephony/ims/ImsException.java @@ -20,6 +20,7 @@ import android.annotation.IntDef; import android.annotation.Nullable; import android.annotation.SystemApi; import android.content.pm.PackageManager; +import android.telephony.SubscriptionManager; import android.text.TextUtils; import java.lang.annotation.Retention; @@ -55,12 +56,23 @@ public final class ImsException extends Exception { */ public static final int CODE_ERROR_UNSUPPORTED_OPERATION = 2; + /** + * The subscription ID associated with this operation is invalid or not active. + * <p> + * This is a configuration error and there should be no retry. The subscription used for this + * operation is either invalid or has become inactive. The active subscriptions can be queried + * with {@link SubscriptionManager#getActiveSubscriptionInfoList()}. + * @hide + */ + public static final int CODE_ERROR_INVALID_SUBSCRIPTION = 3; + /**@hide*/ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = "CODE_ERROR_", value = { CODE_ERROR_UNSPECIFIED, CODE_ERROR_SERVICE_UNAVAILABLE, - CODE_ERROR_UNSUPPORTED_OPERATION + CODE_ERROR_UNSUPPORTED_OPERATION, + CODE_ERROR_INVALID_SUBSCRIPTION }) public @interface ImsErrorCode {} diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java index be5872387d7b..a1a7fcc5dd51 100644 --- a/telephony/java/android/telephony/ims/ImsMmTelManager.java +++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java @@ -31,6 +31,7 @@ import android.net.Uri; import android.os.Binder; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.ServiceSpecificException; import android.telephony.AccessNetworkConstants; import android.telephony.SubscriptionManager; import android.telephony.ims.aidl.IImsCapabilityCallback; @@ -375,6 +376,13 @@ public class ImsMmTelManager { c.setExecutor(executor); try { getITelephony().registerImsRegistrationCallback(mSubId, c.getBinder()); + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException | IllegalStateException e) { throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } @@ -390,8 +398,6 @@ public class ImsMmTelManager { * @param c The {@link RegistrationCallback} to be removed. * @see SubscriptionManager.OnSubscriptionsChangedListener * @see #registerImsRegistrationCallback(Executor, RegistrationCallback) - * @throws IllegalArgumentException if the subscription ID associated with this callback is - * invalid. */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull RegistrationCallback c) { @@ -445,6 +451,13 @@ public class ImsMmTelManager { c.setExecutor(executor); try { getITelephony().registerMmTelCapabilityCallback(mSubId, c.getBinder()); + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } catch (IllegalStateException e) { @@ -460,8 +473,6 @@ public class ImsMmTelManager { * inactive subscription, it will result in a no-op. * @param c The MmTel {@link CapabilityCallback} to be removed. * @see #registerMmTelCapabilityCallback(Executor, CapabilityCallback) - * @throws IllegalArgumentException if the subscription ID associated with this callback is - * invalid. */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterMmTelCapabilityCallback(@NonNull CapabilityCallback c) { @@ -482,12 +493,9 @@ public class ImsMmTelManager { * be enabled as long as the carrier has provisioned these services for the specified * subscription. Other IMS services (SMS/UT) are not affected by this user setting and depend on * carrier requirements. - * - * Modifying this value may also trigger an IMS registration or deregistration, depending on - * whether or not the new value is enabled or disabled. - * + * <p> * Note: If the carrier configuration for advanced calling is not editable or hidden, this - * method will do nothing and will instead always use the default value. + * method will always return the default value. * * @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL * @see android.telephony.CarrierConfigManager#KEY_EDITABLE_ENHANCED_4G_LTE_BOOL @@ -495,12 +503,21 @@ public class ImsMmTelManager { * @see android.telephony.CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL * @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_AVAILABLE_BOOL * @see #setAdvancedCallingSettingEnabled(boolean) + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @return true if the user's setting for advanced calling is enabled, false otherwise. */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAdvancedCallingSettingEnabled() { try { return getITelephony().isAdvancedCallingSettingEnabled(mSubId); + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -526,12 +543,20 @@ public class ImsMmTelManager { * @see android.telephony.CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL * @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_AVAILABLE_BOOL * @see #isAdvancedCallingSettingEnabled() + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setAdvancedCallingSettingEnabled(boolean isEnabled) { try { getITelephony().setAdvancedCallingSettingEnabled(mSubId, isEnabled); - return; + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -597,6 +622,9 @@ public class ImsMmTelManager { /** * The user's setting for whether or not they have enabled the "Video Calling" setting. + * + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @return true if the user’s “Video Calling” setting is currently enabled. * @see #setVtSettingEnabled(boolean) */ @@ -604,6 +632,13 @@ public class ImsMmTelManager { public boolean isVtSettingEnabled() { try { return getITelephony().isVtSettingEnabled(mSubId); + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -611,13 +646,22 @@ public class ImsMmTelManager { /** * Change the user's setting for Video Telephony and enable the Video Telephony capability. + * + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @see #isVtSettingEnabled() */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setVtSettingEnabled(boolean isEnabled) { try { getITelephony().setVtSettingEnabled(mSubId, isEnabled); - return; + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -625,12 +669,22 @@ public class ImsMmTelManager { /** * @return true if the user's setting for Voice over WiFi is enabled and false if it is not. + * + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @see #setVoWiFiSettingEnabled(boolean) */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isVoWiFiSettingEnabled() { try { return getITelephony().isVoWiFiSettingEnabled(mSubId); + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -638,6 +692,9 @@ public class ImsMmTelManager { /** * Sets the user's setting for whether or not Voice over WiFi is enabled. + * + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @param isEnabled true if the user's setting for Voice over WiFi is enabled, false otherwise= * @see #isVoWiFiSettingEnabled() */ @@ -645,13 +702,23 @@ public class ImsMmTelManager { public void setVoWiFiSettingEnabled(boolean isEnabled) { try { getITelephony().setVoWiFiSettingEnabled(mSubId, isEnabled); - return; + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } } /** + * Returns the user's voice over WiFi roaming setting associated with the current subscription. + * + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @return true if the user's setting for Voice over WiFi while roaming is enabled, false * if disabled. * @see #setVoWiFiRoamingSettingEnabled(boolean) @@ -660,6 +727,13 @@ public class ImsMmTelManager { public boolean isVoWiFiRoamingSettingEnabled() { try { return getITelephony().isVoWiFiRoamingSettingEnabled(mSubId); + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -667,15 +741,24 @@ public class ImsMmTelManager { /** * Change the user's setting for Voice over WiFi while roaming. + * * @param isEnabled true if the user's setting for Voice over WiFi while roaming is enabled, * false otherwise. + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @see #isVoWiFiRoamingSettingEnabled() */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingSettingEnabled(boolean isEnabled) { try { getITelephony().setVoWiFiRoamingSettingEnabled(mSubId, isEnabled); - return; + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -691,19 +774,31 @@ public class ImsMmTelManager { * - {@link #WIFI_MODE_WIFI_ONLY} * - {@link #WIFI_MODE_CELLULAR_PREFERRED} * - {@link #WIFI_MODE_WIFI_PREFERRED} + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @see #setVoWiFiSettingEnabled(boolean) */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiNonPersistent(boolean isCapable, int mode) { try { getITelephony().setVoWiFiNonPersistent(mSubId, isCapable, mode); - return; + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } } /** + * Returns the user's voice over WiFi Roaming mode setting associated with the device. + * + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @return The Voice over WiFi Mode preference set by the user, which can be one of the * following: * - {@link #WIFI_MODE_WIFI_ONLY} @@ -715,6 +810,13 @@ public class ImsMmTelManager { public @WiFiCallingMode int getVoWiFiModeSetting() { try { return getITelephony().getVoWiFiModeSetting(mSubId); + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -727,13 +829,21 @@ public class ImsMmTelManager { * - {@link #WIFI_MODE_WIFI_ONLY} * - {@link #WIFI_MODE_CELLULAR_PREFERRED} * - {@link #WIFI_MODE_WIFI_PREFERRED} + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @see #getVoWiFiModeSetting() */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiModeSetting(@WiFiCallingMode int mode) { try { getITelephony().setVoWiFiModeSetting(mSubId, mode); - return; + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -748,12 +858,21 @@ public class ImsMmTelManager { * - {@link #WIFI_MODE_WIFI_ONLY} * - {@link #WIFI_MODE_CELLULAR_PREFERRED} * - {@link #WIFI_MODE_WIFI_PREFERRED} + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @see #setVoWiFiRoamingSettingEnabled(boolean) */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public @WiFiCallingMode int getVoWiFiRoamingModeSetting() { try { return getITelephony().getVoWiFiRoamingModeSetting(mSubId); + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -768,13 +887,21 @@ public class ImsMmTelManager { * - {@link #WIFI_MODE_WIFI_ONLY} * - {@link #WIFI_MODE_CELLULAR_PREFERRED} * - {@link #WIFI_MODE_WIFI_PREFERRED} + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @see #getVoWiFiRoamingModeSetting() */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingModeSetting(@WiFiCallingMode int mode) { try { getITelephony().setVoWiFiRoamingModeSetting(mSubId, mode); - return; + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -787,13 +914,21 @@ public class ImsMmTelManager { * {@link android.provider.Settings.Secure#RTT_CALLING_MODE}, which is the global user setting * for RTT. That value is enabled/disabled separately by the user through the Accessibility * settings. + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @param isEnabled if true RTT should be enabled during calls made on this subscription. */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setRttCapabilitySetting(boolean isEnabled) { try { getITelephony().setRttCapabilitySetting(mSubId, isEnabled); - return; + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } @@ -801,6 +936,9 @@ public class ImsMmTelManager { /** * @return true if TTY over VoLTE is supported + * + * @throws IllegalArgumentException if the subscription associated with this operation is not + * active (SIM is not inserted, ESIM inactive) or invalid. * @see android.telecom.TelecomManager#getCurrentTtyMode * @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL */ @@ -808,6 +946,13 @@ public class ImsMmTelManager { boolean isTtyOverVolteEnabled() { try { return getITelephony().isTtyOverVolteEnabled(mSubId); + } catch (ServiceSpecificException e) { + if (e.errorCode == ImsException.CODE_ERROR_INVALID_SUBSCRIPTION) { + // Rethrow as runtime error to keep API compatible. + throw new IllegalArgumentException(e.getMessage()); + } else { + throw new RuntimeException(e.getMessage()); + } } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } diff --git a/telephony/java/android/telephony/ims/RcsControllerCall.java b/telephony/java/android/telephony/ims/RcsControllerCall.java index a2d68ad0cdb0..ce03c3c799bb 100644 --- a/telephony/java/android/telephony/ims/RcsControllerCall.java +++ b/telephony/java/android/telephony/ims/RcsControllerCall.java @@ -19,10 +19,11 @@ package android.telephony.ims; import android.content.Context; import android.os.RemoteException; import android.os.ServiceManager; -import android.telephony.ims.aidl.IRcs; +import android.telephony.ims.aidl.IRcsMessage; /** - * A wrapper class around RPC calls that {@link RcsMessageStore} APIs to minimize boilerplate code. + * A wrapper class around RPC calls that {@link RcsMessageManager} APIs to minimize boilerplate + * code. * * @hide - not meant for public use */ @@ -34,13 +35,14 @@ class RcsControllerCall { } <R> R call(RcsServiceCall<R> serviceCall) throws RcsMessageStoreException { - IRcs iRcs = IRcs.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_RCS_SERVICE)); - if (iRcs == null) { + IRcsMessage iRcsMessage = IRcsMessage.Stub.asInterface(ServiceManager.getService( + Context.TELEPHONY_RCS_MESSAGE_SERVICE)); + if (iRcsMessage == null) { throw new RcsMessageStoreException("Could not connect to RCS storage service"); } try { - return serviceCall.methodOnIRcs(iRcs, mContext.getOpPackageName()); + return serviceCall.methodOnIRcs(iRcsMessage, mContext.getOpPackageName()); } catch (RemoteException exception) { throw new RcsMessageStoreException(exception.getMessage()); } @@ -48,17 +50,17 @@ class RcsControllerCall { void callWithNoReturn(RcsServiceCallWithNoReturn serviceCall) throws RcsMessageStoreException { - call((iRcs, callingPackage) -> { - serviceCall.methodOnIRcs(iRcs, callingPackage); + call((iRcsMessage, callingPackage) -> { + serviceCall.methodOnIRcs(iRcsMessage, callingPackage); return null; }); } interface RcsServiceCall<R> { - R methodOnIRcs(IRcs iRcs, String callingPackage) throws RemoteException; + R methodOnIRcs(IRcsMessage iRcs, String callingPackage) throws RemoteException; } interface RcsServiceCallWithNoReturn { - void methodOnIRcs(IRcs iRcs, String callingPackage) throws RemoteException; + void methodOnIRcs(IRcsMessage iRcs, String callingPackage) throws RemoteException; } } diff --git a/telephony/java/android/telephony/ims/RcsManager.java b/telephony/java/android/telephony/ims/RcsManager.java deleted file mode 100644 index 0d6ca3cc58e1..000000000000 --- a/telephony/java/android/telephony/ims/RcsManager.java +++ /dev/null @@ -1,43 +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. - */ -package android.telephony.ims; - -import android.annotation.SystemService; -import android.content.Context; - -/** - * The manager class for RCS related utilities. - * - * @hide - */ -@SystemService(Context.TELEPHONY_RCS_SERVICE) -public class RcsManager { - private final RcsMessageStore mRcsMessageStore; - - /** - * @hide - */ - public RcsManager(Context context) { - mRcsMessageStore = new RcsMessageStore(context); - } - - /** - * Returns an instance of {@link RcsMessageStore} - */ - public RcsMessageStore getRcsMessageStore() { - return mRcsMessageStore; - } -} diff --git a/telephony/java/android/telephony/ims/RcsMessageStore.java b/telephony/java/android/telephony/ims/RcsMessageManager.java index d1127984f126..a1c7c0fefab2 100644 --- a/telephony/java/android/telephony/ims/RcsMessageStore.java +++ b/telephony/java/android/telephony/ims/RcsMessageManager.java @@ -18,6 +18,7 @@ package android.telephony.ims; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.SystemService; import android.annotation.WorkerThread; import android.content.Context; import android.net.Uri; @@ -25,15 +26,20 @@ import android.net.Uri; import java.util.List; /** - * RcsMessageStore is the application interface to RcsProvider and provides access methods to + * RcsMessageManager is the application interface to RcsProvider and provides access methods to * RCS related database tables. * * @hide */ -public class RcsMessageStore { +@SystemService(Context.TELEPHONY_RCS_MESSAGE_SERVICE) +public class RcsMessageManager { RcsControllerCall mRcsControllerCall; - RcsMessageStore(Context context) { + /** + * Use {@link Context#getSystemService(String)} to get an instance of this service. + * @hide + */ + public RcsMessageManager(Context context) { mRcsControllerCall = new RcsControllerCall(context); } diff --git a/telephony/java/android/telephony/ims/aidl/IRcs.aidl b/telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl index 9ee15daf67b9..0ae6303f024e 100644 --- a/telephony/java/android/telephony/ims/aidl/IRcs.aidl +++ b/telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl @@ -35,7 +35,7 @@ import android.telephony.ims.RcsThreadQueryResultParcelable; * RPC definition between RCS storage APIs and phone process. * {@hide} */ -interface IRcs { +interface IRcsMessage { ///////////////////////// // RcsMessageStore APIs ///////////////////////// diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 1aba95bf5e5a..da80774e8ed0 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -308,18 +308,46 @@ interface ITelephony { */ List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg); - @UnsupportedAppUsage - int getCallState(); + @UnsupportedAppUsage + int getCallState(); /** * Returns the call state for a slot. */ - int getCallStateForSlot(int slotIndex); + int getCallStateForSlot(int slotIndex); + + /** + * Replaced by getDataActivityForSubId. + */ + int getDataActivity(); + + /** + * Returns a constant indicating the type of activity on a data connection + * (cellular). + * + * @see #DATA_ACTIVITY_NONE + * @see #DATA_ACTIVITY_IN + * @see #DATA_ACTIVITY_OUT + * @see #DATA_ACTIVITY_INOUT + * @see #DATA_ACTIVITY_DORMANT + */ + int getDataActivityForSubId(int subId); + + /** + * Replaced by getDataStateForSubId. + */ + int getDataState(); - @UnsupportedAppUsage - int getDataActivity(); - @UnsupportedAppUsage - int getDataState(); + /** + * Returns a constant indicating the current data connection state + * (cellular). + * + * @see #DATA_DISCONNECTED + * @see #DATA_CONNECTING + * @see #DATA_CONNECTED + * @see #DATA_SUSPENDED + */ + int getDataStateForSubId(int subId); /** * Returns the current active phone type as integer. diff --git a/tests/CanvasCompare/src/com/android/test/hwuicompare/errorCalculator.rs b/tests/CanvasCompare/src/com/android/test/hwuicompare/errorCalculator.rscript index 0a1742ef3867..0a1742ef3867 100644 --- a/tests/CanvasCompare/src/com/android/test/hwuicompare/errorCalculator.rs +++ b/tests/CanvasCompare/src/com/android/test/hwuicompare/errorCalculator.rscript diff --git a/tests/DexLoggerIntegrationTests/src/com/android/server/pm/dex/DexLoggerIntegrationTests.java b/tests/DexLoggerIntegrationTests/src/com/android/server/pm/dex/DexLoggerIntegrationTests.java index d8b3b2086335..460022e2c83b 100644 --- a/tests/DexLoggerIntegrationTests/src/com/android/server/pm/dex/DexLoggerIntegrationTests.java +++ b/tests/DexLoggerIntegrationTests/src/com/android/server/pm/dex/DexLoggerIntegrationTests.java @@ -28,6 +28,7 @@ import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -108,6 +109,7 @@ public final class DexLoggerIntegrationTests { } @Test + @Ignore // Should invoke shell command via UiAutomation: b/137574238 public void testDexLoggerReconcileGeneratesEvents() throws Exception { int[] tagList = new int[] { SNET_TAG }; List<EventLog.Event> events = new ArrayList<>(); diff --git a/tools/lock_agent/Android.bp b/tools/lock_agent/Android.bp index 408946b28836..79dce4a8ce09 100644 --- a/tools/lock_agent/Android.bp +++ b/tools/lock_agent/Android.bp @@ -12,13 +12,9 @@ cc_library { ], sdk_version: "current", stl: "c++_static", - include_dirs: [ - // NDK headers aren't available in platform NDK builds. - "libnativehelper/include_jni", - // Use ScopedUtfChars. - "libnativehelper/header_only_include", - ], header_libs: [ + // Use ScopedUtfChars. + "libnativehelper_header_only", "libopenjdkjvmti_headers", ], compile_multilib: "both", @@ -32,13 +28,9 @@ cc_binary_host { "libz", "slicer", ], - include_dirs: [ - // NDK headers aren't available in platform NDK builds. - "libnativehelper/include_jni", - // Use ScopedUtfChars. - "libnativehelper/header_only_include", - ], header_libs: [ + // Use ScopedUtfChars. + "libnativehelper_header_only", "libopenjdkjvmti_headers", ], } diff --git a/tools/preload2/Android.bp b/tools/preload2/Android.bp new file mode 100644 index 000000000000..5809421da3e8 --- /dev/null +++ b/tools/preload2/Android.bp @@ -0,0 +1,50 @@ +// 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. + +java_library_host { + name: "preload2", + + srcs: ["src/**/*.java"], + + // To connect to devices (and take hprof dumps). + static_libs: [ + "ddmlib-prebuilt", + "tools-common-prebuilt", + + // To process hprof dumps. + "perflib-prebuilt", + + "trove-prebuilt", + "guavalib", + + // For JDWP access we use the framework in the JDWP tests from Apache Harmony, for + // convenience (and to not depend on internal JDK APIs). + "apache-harmony-jdwp-tests", + "junit", + ], + + // Copy to build artifacts + dist: { + targets: [ + "dist_files", + ], + }, +} + +// Copy the preload-tool shell script to the host's bin directory. +sh_binary_host { + name: "preload-tool", + src: "preload-tool", + required: ["preload2"], +} diff --git a/tools/preload2/Android.mk b/tools/preload2/Android.mk deleted file mode 100644 index d3ee1d370855..000000000000 --- a/tools/preload2/Android.mk +++ /dev/null @@ -1,30 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(call all-java-files-under,src) - -# To connect to devices (and take hprof dumps). -LOCAL_STATIC_JAVA_LIBRARIES := ddmlib-prebuilt tools-common-prebuilt - -# To process hprof dumps. -LOCAL_STATIC_JAVA_LIBRARIES += perflib-prebuilt trove-prebuilt guavalib - -# For JDWP access we use the framework in the JDWP tests from Apache Harmony, for -# convenience (and to not depend on internal JDK APIs). -LOCAL_STATIC_JAVA_LIBRARIES += apache-harmony-jdwp-tests-host junit-host - -LOCAL_MODULE:= preload2 - -include $(BUILD_HOST_JAVA_LIBRARY) -# Copy to build artifacts -$(call dist-for-goals,dist_files,$(LOCAL_BUILT_MODULE):$(LOCAL_MODULE).jar) - -# Copy the preload-tool shell script to the host's bin directory. -include $(CLEAR_VARS) -LOCAL_IS_HOST_MODULE := true -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE := preload-tool -LOCAL_SRC_FILES := preload-tool -LOCAL_REQUIRED_MODULES := preload2 -include $(BUILD_PREBUILT) |