diff options
55 files changed, 1016 insertions, 637 deletions
diff --git a/api/current.txt b/api/current.txt index 835e836..5126123 100644 --- a/api/current.txt +++ b/api/current.txt @@ -4019,10 +4019,12 @@ package android.app { ctor public AssistContent(); method public android.content.ClipData getClipData(); method public android.os.Bundle getExtras(); + method public java.lang.String getStructuredData(); method public android.net.Uri getWebUri(); method public boolean isAppProvidedIntent(); method public void setClipData(android.content.ClipData); method public void setIntent(android.content.Intent); + method public void setStructuredData(java.lang.String); method public void setWebUri(android.net.Uri); } @@ -13325,6 +13327,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Long> SENSOR_INFO_MAX_FRAME_DURATION; field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.SizeF> SENSOR_INFO_PHYSICAL_SIZE; field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE; + field public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE; field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> SENSOR_INFO_SENSITIVITY_RANGE; field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_TIMESTAMP_SOURCE; field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_WHITE_LEVEL; @@ -23673,6 +23676,7 @@ package android.os { field public static final java.lang.String DISALLOW_CROSS_PROFILE_COPY_PASTE = "no_cross_profile_copy_paste"; field public static final java.lang.String DISALLOW_DEBUGGING_FEATURES = "no_debugging_features"; field public static final java.lang.String DISALLOW_FACTORY_RESET = "no_factory_reset"; + field public static final java.lang.String DISALLOW_FUN = "no_fun"; field public static final java.lang.String DISALLOW_INSTALL_APPS = "no_install_apps"; field public static final java.lang.String DISALLOW_INSTALL_UNKNOWN_SOURCES = "no_install_unknown_sources"; field public static final java.lang.String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; @@ -30615,9 +30619,11 @@ package android.telephony { field public static final java.lang.String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL = "carrier_volte_tty_supported_bool"; + field public static final java.lang.String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool"; + field public static final java.lang.String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string"; field public static final java.lang.String KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool"; field public static final java.lang.String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool"; - field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "key_enable_dialer_vibration_bool"; + field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_vibration_bool"; field public static final java.lang.String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool"; field public static final java.lang.String KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool"; field public static final java.lang.String KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL = "ignore_sim_network_locked_events_bool"; diff --git a/api/system-current.txt b/api/system-current.txt index e3978cb..d3823fc 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -4114,10 +4114,12 @@ package android.app { ctor public AssistContent(); method public android.content.ClipData getClipData(); method public android.os.Bundle getExtras(); + method public java.lang.String getStructuredData(); method public android.net.Uri getWebUri(); method public boolean isAppProvidedIntent(); method public void setClipData(android.content.ClipData); method public void setIntent(android.content.Intent); + method public void setStructuredData(java.lang.String); method public void setWebUri(android.net.Uri); } @@ -13645,6 +13647,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Long> SENSOR_INFO_MAX_FRAME_DURATION; field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.SizeF> SENSOR_INFO_PHYSICAL_SIZE; field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE; + field public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE; field public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> SENSOR_INFO_SENSITIVITY_RANGE; field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_TIMESTAMP_SOURCE; field public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_WHITE_LEVEL; @@ -25607,6 +25610,7 @@ package android.os { field public static final java.lang.String DISALLOW_CROSS_PROFILE_COPY_PASTE = "no_cross_profile_copy_paste"; field public static final java.lang.String DISALLOW_DEBUGGING_FEATURES = "no_debugging_features"; field public static final java.lang.String DISALLOW_FACTORY_RESET = "no_factory_reset"; + field public static final java.lang.String DISALLOW_FUN = "no_fun"; field public static final java.lang.String DISALLOW_INSTALL_APPS = "no_install_apps"; field public static final java.lang.String DISALLOW_INSTALL_UNKNOWN_SOURCES = "no_install_unknown_sources"; field public static final java.lang.String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; @@ -32835,9 +32839,11 @@ package android.telephony { field public static final java.lang.String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool"; field public static final java.lang.String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL = "carrier_volte_tty_supported_bool"; + field public static final java.lang.String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool"; + field public static final java.lang.String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string"; field public static final java.lang.String KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool"; field public static final java.lang.String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool"; - field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "key_enable_dialer_vibration_bool"; + field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_vibration_bool"; field public static final java.lang.String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool"; field public static final java.lang.String KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool"; field public static final java.lang.String KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL = "ignore_sim_network_locked_events_bool"; diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp index c5af992..449a4ab 100644 --- a/cmds/app_process/app_main.cpp +++ b/cmds/app_process/app_main.cpp @@ -90,9 +90,6 @@ public: virtual void onZygoteInit() { - // Re-enable tracing now that we're no longer in Zygote. - atrace_set_tracing_enabled(true); - sp<ProcessState> proc = ProcessState::self(); ALOGV("App process: starting thread pool.\n"); proc->startThreadPool(); diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index e21c04a..828dc0a 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -5375,6 +5375,7 @@ public final class ActivityThread { } public static void main(String[] args) { + Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "ActivityThreadMain"); SamplingProfilerIntegration.start(); // CloseGuard defaults to true and can be quite spammy. We @@ -5409,6 +5410,8 @@ public final class ActivityThread { LogPrinter(Log.DEBUG, "ActivityThread")); } + // End of event ActivityThreadMain. + Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Looper.loop(); throw new RuntimeException("Main thread loop unexpectedly exited"); diff --git a/core/java/android/app/AssistContent.java b/core/java/android/app/AssistContent.java index 0df9ce5..ad2ba39 100644 --- a/core/java/android/app/AssistContent.java +++ b/core/java/android/app/AssistContent.java @@ -33,6 +33,7 @@ import android.os.Parcelable; public class AssistContent { private boolean mIsAppProvidedIntent = false; private Intent mIntent; + private String mStructuredData; private ClipData mClipData; private Uri mUri; private final Bundle mExtras; @@ -125,6 +126,22 @@ public class AssistContent { } /** + * Sets optional structured data regarding the content being viewed. The provided data + * must be a string represented with <a href="http://json-ld.org/">JSON-LD</a> using the + * <a href="http://schema.org/">schema.org</a> vocabulary. + */ + public void setStructuredData(String structuredData) { + mStructuredData = structuredData; + } + + /** + * Returns the current {@link #setStructuredData}. + */ + public String getStructuredData() { + return mStructuredData; + } + + /** * Set a web URI associated with the current data being shown to the user. * This URI could be opened in a web browser, or in the app as an * {@link Intent#ACTION_VIEW} Intent, to show the same data that is currently @@ -163,6 +180,9 @@ public class AssistContent { if (in.readInt() != 0) { mUri = Uri.CREATOR.createFromParcel(in); } + if (in.readInt() != 0) { + mStructuredData = in.readString(); + } mIsAppProvidedIntent = in.readInt() == 1; mExtras = in.readBundle(); } @@ -187,6 +207,12 @@ public class AssistContent { } else { dest.writeInt(0); } + if (mStructuredData != null) { + dest.writeInt(1); + dest.writeString(mStructuredData); + } else { + dest.writeInt(0); + } dest.writeInt(mIsAppProvidedIntent ? 1 : 0); dest.writeBundle(mExtras); } diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 9f49154..ed20086 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -403,8 +403,9 @@ public class DevicePolicyManager { = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER"; /** - * A String extra holding the URL-safe base64 encoded SHA-1 checksum of the file at download - * location specified in {@link #EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION}. + * A String extra holding the URL-safe base64 encoded SHA-256 or SHA-1 hash (see notes below) of + * the file at download location specified in + * {@link #EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION}. * * <p>Either this extra or {@link #EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM} should be * present. The provided checksum should match the checksum of the file at the download @@ -413,12 +414,17 @@ public class DevicePolicyManager { * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner * provisioning via an NFC bump. + * + * <p><strong>Note:</strong> for devices running {@link android.os.Build.VERSION_CODES#LOLLIPOP} + * and {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1} only SHA-1 hash is supported. + * Starting from {@link android.os.Build.VERSION_CODES#MNC}, this parameter accepts SHA-256 in + * addition to SHA-1. Support for SHA-1 is likely to be removed in future OS releases. */ public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM"; /** - * A String extra holding the URL-safe base64 encoded SHA-1 checksum of any signature of the + * A String extra holding the URL-safe base64 encoded SHA-256 checksum of any signature of the * android package archive at the download location specified in {@link * #EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION}. * @@ -510,7 +516,7 @@ public class DevicePolicyManager { = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_COOKIE_HEADER"; /** - * A String extra holding the URL-safe base64 encoded SHA-1 checksum of the file at download + * A String extra holding the URL-safe base64 encoded SHA-256 checksum of the file at download * location specified in * {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION}. * @@ -526,7 +532,7 @@ public class DevicePolicyManager { = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_PACKAGE_CHECKSUM"; /** - * A String extra holding the URL-safe base64 encoded SHA-1 checksum of any signature of the + * A String extra holding the URL-safe base64 encoded SHA-256 checksum of any signature of the * android package archive at the download location specified in {@link * #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION}. * @@ -924,7 +930,7 @@ public class DevicePolicyManager { /** * Constant for {@link #setPasswordQuality}: the policy requires some kind - * of password, but doesn't care what it is. Note that quality constants + * of password or pattern, but doesn't care what it is. Note that quality constants * are ordered so that higher values are more restrictive. */ public static final int PASSWORD_QUALITY_SOMETHING = 0x10000; diff --git a/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java b/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java index 161c339..834a587 100644 --- a/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java +++ b/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java @@ -28,10 +28,10 @@ import android.os.Parcelable; public final class BluetoothActivityEnergyInfo implements Parcelable { private final long mTimestamp; private final int mBluetoothStackState; - private final int mControllerTxTimeMs; - private final int mControllerRxTimeMs; - private final int mControllerIdleTimeMs; - private final int mControllerEnergyUsed; + private final long mControllerTxTimeMs; + private final long mControllerRxTimeMs; + private final long mControllerIdleTimeMs; + private final long mControllerEnergyUsed; public static final int BT_STACK_STATE_INVALID = 0; public static final int BT_STACK_STATE_STATE_ACTIVE = 1; @@ -39,7 +39,7 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { public static final int BT_STACK_STATE_STATE_IDLE = 3; public BluetoothActivityEnergyInfo(long timestamp, int stackState, - int txTime, int rxTime, int idleTime, int energyUsed) { + long txTime, long rxTime, long idleTime, long energyUsed) { mTimestamp = timestamp; mBluetoothStackState = stackState; mControllerTxTimeMs = txTime; @@ -65,10 +65,10 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { public BluetoothActivityEnergyInfo createFromParcel(Parcel in) { long timestamp = in.readLong(); int stackState = in.readInt(); - int txTime = in.readInt(); - int rxTime = in.readInt(); - int idleTime = in.readInt(); - int energyUsed = in.readInt(); + long txTime = in.readLong(); + long rxTime = in.readLong(); + long idleTime = in.readLong(); + long energyUsed = in.readLong(); return new BluetoothActivityEnergyInfo(timestamp, stackState, txTime, rxTime, idleTime, energyUsed); } @@ -80,10 +80,10 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeLong(mTimestamp); out.writeInt(mBluetoothStackState); - out.writeInt(mControllerTxTimeMs); - out.writeInt(mControllerRxTimeMs); - out.writeInt(mControllerIdleTimeMs); - out.writeInt(mControllerEnergyUsed); + out.writeLong(mControllerTxTimeMs); + out.writeLong(mControllerRxTimeMs); + out.writeLong(mControllerIdleTimeMs); + out.writeLong(mControllerEnergyUsed); } public int describeContents() { @@ -100,21 +100,21 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { /** * @return tx time in ms */ - public int getControllerTxTimeMillis() { + public long getControllerTxTimeMillis() { return mControllerTxTimeMs; } /** * @return rx time in ms */ - public int getControllerRxTimeMillis() { + public long getControllerRxTimeMillis() { return mControllerRxTimeMs; } /** * @return idle time in ms */ - public int getControllerIdleTimeMillis() { + public long getControllerIdleTimeMillis() { return mControllerIdleTimeMs; } @@ -122,7 +122,7 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { * product of current(mA), voltage(V) and time(ms) * @return energy used */ - public int getControllerEnergyUsed() { + public long getControllerEnergyUsed() { return mControllerEnergyUsed; } @@ -137,8 +137,8 @@ public final class BluetoothActivityEnergyInfo implements Parcelable { * @return if the record is valid */ public boolean isValid() { - return ((getControllerTxTimeMillis() !=0) || - (getControllerRxTimeMillis() !=0) || - (getControllerIdleTimeMillis() !=0)); + return ((mControllerTxTimeMs !=0) || + (mControllerRxTimeMs !=0) || + (mControllerIdleTimeMs !=0)); } } diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 921e9f1..27d14b3 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -1093,14 +1093,28 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri * <p>so <code>[x_s, y_s]</code> is the pixel coordinates of the world * point, <code>z_s = 1</code>, and <code>w_s</code> is a measurement of disparity * (depth) in pixel coordinates.</p> + * <p>Note that the coordinate system for this transform is the + * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} system, + * where <code>(0,0)</code> is the top-left of the + * preCorrectionActiveArraySize rectangle. Once the pose and + * intrinsic calibration transforms have been applied to a + * world point, then the android.lens.radialDistortion + * transform needs to be applied, and the result adjusted to + * be in the {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} coordinate + * system (where <code>(0, 0)</code> is the top-left of the + * activeArraySize rectangle), to determine the final pixel + * coordinate of the world point for processed (non-RAW) + * output buffers.</p> * <p><b>Units</b>: - * Pixels in the {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} coordinate - * system.</p> + * Pixels in the + * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} + * coordinate system.</p> * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * * @see CameraCharacteristics#LENS_POSE_ROTATION * @see CameraCharacteristics#LENS_POSE_TRANSLATION * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE + * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE */ @PublicKey public static final Key<float[]> LENS_INTRINSIC_CALIBRATION = @@ -1959,22 +1973,25 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri new Key<Integer>("android.scaler.croppingType", int.class); /** - * <p>The area of the image sensor which corresponds to - * active pixels.</p> - * <p>This is the region of the sensor that actually receives light from the scene. - * Therefore, the size of this region determines the maximum field of view and the maximum - * number of pixels that an image from this sensor can contain.</p> - * <p>The rectangle is defined in terms of the full pixel array; (0,0) is the top-left of the - * full pixel array, and the size of the full pixel array is given by + * <p>The area of the image sensor which corresponds to active pixels after any geometric + * distortion correction has been applied.</p> + * <p>This is the rectangle representing the size of the active region of the sensor (i.e. + * the region that actually receives light from the scene) after any geometric correction + * has been applied, and should be treated as the maximum size in pixels of any of the + * image output formats aside from the raw formats.</p> + * <p>This rectangle is defined relative to the full pixel array; (0,0) is the top-left of + * the full pixel array, and the size of the full pixel array is given by * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.</p> - * <p>Most other keys listing pixel coordinates have their coordinate systems based on the - * active array, with <code>(0, 0)</code> being the top-left of the active array rectangle.</p> + * <p>The coordinate system for most other keys that list pixel coordinates, including + * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}, is defined relative to the active array rectangle given in + * this field, with <code>(0, 0)</code> being the top-left of this rectangle.</p> * <p>The active array may be smaller than the full pixel array, since the full array may - * include black calibration pixels or other inactive regions.</p> + * include black calibration pixels or other inactive regions, and geometric correction + * resulting in scaling or cropping may have been applied.</p> * <p><b>Units</b>: Pixel coordinates on the image sensor</p> - * <p><b>Range of valid values:</b><br></p> * <p>This key is available on all devices.</p> * + * @see CaptureRequest#SCALER_CROP_REGION * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE */ @PublicKey @@ -1982,6 +1999,70 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri new Key<android.graphics.Rect>("android.sensor.info.activeArraySize", android.graphics.Rect.class); /** + * <p>The area of the image sensor which corresponds to active pixels prior to the + * application of any geometric distortion correction.</p> + * <p>This is the rectangle representing the size of the active region of the sensor (i.e. + * the region that actually receives light from the scene) before any geometric correction + * has been applied, and should be treated as the active region rectangle for any of the + * raw formats. All metadata associated with raw processing (e.g. the lens shading + * correction map, and radial distortion fields) treats the top, left of this rectangle as + * the origin, (0,0).</p> + * <p>The size of this region determines the maximum field of view and the maximum number of + * pixels that an image from this sensor can contain, prior to the application of + * geometric distortion correction. The effective maximum pixel dimensions of a + * post-distortion-corrected image is given by the {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} + * field, and the effective maximum field of view for a post-distortion-corrected image + * can be calculated by applying the geometric distortion correction fields to this + * rectangle, and cropping to the rectangle given in {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p> + * <p>E.g. to calculate position of a pixel, (x,y), in a processed YUV output image with the + * dimensions in {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} given the position of a pixel, + * (x', y'), in the raw pixel array with dimensions give in + * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}:</p> + * <ol> + * <li>Choose a pixel (x', y') within the active array region of the raw buffer given in + * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, otherwise this pixel is considered + * to be outside of the FOV, and will not be shown in the processed output image.</li> + * <li>Apply geometric distortion correction to get the post-distortion pixel coordinate, + * (x_i, y_i). When applying geometric correction metadata, note that metadata for raw + * buffers is defined relative to the top, left of the + * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} rectangle.</li> + * <li>If the resulting corrected pixel coordinate is within the region given in + * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, then the position of this pixel in the + * processed output image buffer is <code>(x_i - activeArray.left, y_i - activeArray.top)</code>, + * when the top, left coordinate of that buffer is treated as (0, 0).</li> + * </ol> + * <p>Thus, for pixel x',y' = (25, 25) on a sensor where {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize} + * is (100,100), {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} is (10, 10, 100, 100), + * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} is (20, 20, 80, 80), and the geometric distortion + * correction doesn't change the pixel coordinate, the resulting pixel selected in + * pixel coordinates would be x,y = (25, 25) relative to the top,left of the raw buffer + * with dimensions given in {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}, and would be (5, 5) + * relative to the top,left of post-processed YUV output buffer with dimensions given in + * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p> + * <p>The currently supported fields that correct for geometric distortion are:</p> + * <ol> + * <li>android.lens.radialDistortion.</li> + * </ol> + * <p>If all of the geometric distortion fields are no-ops, this rectangle will be the same + * as the post-distortion-corrected rectangle given in + * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p> + * <p>This rectangle is defined relative to the full pixel array; (0,0) is the top-left of + * the full pixel array, and the size of the full pixel array is given by + * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.</p> + * <p>The pre-correction active array may be smaller than the full pixel array, since the + * full array may include black calibration pixels or other inactive regions.</p> + * <p><b>Units</b>: Pixel coordinates on the image sensor</p> + * <p>This key is available on all devices.</p> + * + * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE + * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE + * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE + */ + @PublicKey + public static final Key<android.graphics.Rect> SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE = + new Key<android.graphics.Rect>("android.sensor.info.preCorrectionActiveArraySize", android.graphics.Rect.class); + + /** * <p>Range of sensitivities for {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} supported by this * camera device.</p> * <p>The values are the standard ISO sensitivity values, @@ -2089,22 +2170,24 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri /** * <p>Dimensions of the full pixel array, possibly * including black calibration pixels.</p> - * <p>The pixel count of the full pixel array, - * which covers {@link CameraCharacteristics#SENSOR_INFO_PHYSICAL_SIZE android.sensor.info.physicalSize} area.</p> - * <p>If a camera device supports raw sensor formats, either this - * or {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} is the maximum output - * raw size listed in {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP android.scaler.streamConfigurationMap}. - * If a size corresponding to pixelArraySize is listed, the resulting - * raw sensor image will include black pixels.</p> + * <p>The pixel count of the full pixel array of the image sensor, which covers + * {@link CameraCharacteristics#SENSOR_INFO_PHYSICAL_SIZE android.sensor.info.physicalSize} area. This represents the full pixel dimensions of + * the raw buffers produced by this sensor.</p> + * <p>If a camera device supports raw sensor formats, either this or + * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} is the maximum dimensions for the raw + * output formats listed in {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP android.scaler.streamConfigurationMap} (this depends on + * whether or not the image sensor returns buffers containing pixels that are not + * part of the active array region for blacklevel calibration or other purposes).</p> * <p>Some parts of the full pixel array may not receive light from the scene, - * or are otherwise inactive. The {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} key - * defines the rectangle of active pixels that actually forms an image.</p> + * or be otherwise inactive. The {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} key + * defines the rectangle of active pixels that will be included in processed image + * formats.</p> * <p><b>Units</b>: Pixels</p> * <p>This key is available on all devices.</p> * * @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP - * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE * @see CameraCharacteristics#SENSOR_INFO_PHYSICAL_SIZE + * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE */ @PublicKey public static final Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE = diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 479583c..da216aa 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2655,14 +2655,28 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { * <p>so <code>[x_s, y_s]</code> is the pixel coordinates of the world * point, <code>z_s = 1</code>, and <code>w_s</code> is a measurement of disparity * (depth) in pixel coordinates.</p> + * <p>Note that the coordinate system for this transform is the + * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} system, + * where <code>(0,0)</code> is the top-left of the + * preCorrectionActiveArraySize rectangle. Once the pose and + * intrinsic calibration transforms have been applied to a + * world point, then the android.lens.radialDistortion + * transform needs to be applied, and the result adjusted to + * be in the {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} coordinate + * system (where <code>(0, 0)</code> is the top-left of the + * activeArraySize rectangle), to determine the final pixel + * coordinate of the world point for processed (non-RAW) + * output buffers.</p> * <p><b>Units</b>: - * Pixels in the {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} coordinate - * system.</p> + * Pixels in the + * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} + * coordinate system.</p> * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * * @see CameraCharacteristics#LENS_POSE_ROTATION * @see CameraCharacteristics#LENS_POSE_TRANSLATION * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE + * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE */ @PublicKey public static final Key<float[]> LENS_INTRINSIC_CALIBRATION = diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 3a3c47d..a2ca41c 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -801,28 +801,6 @@ public class ConnectivityManager { } /** - * Returns details about the Provisioning or currently active default data network. When - * connected, this network is the default route for outgoing connections. - * You should always check {@link NetworkInfo#isConnected()} before initiating - * network traffic. This may return {@code null} when there is no default - * network. - * <p>This method requires the caller to hold the permission - * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. - * - * @return a {@link NetworkInfo} object for the current default network - * or {@code null} if no default network is currently active - * - * {@hide} - */ - public NetworkInfo getProvisioningOrActiveNetworkInfo() { - try { - return mService.getProvisioningOrActiveNetworkInfo(); - } catch (RemoteException e) { - return null; - } - } - - /** * Returns the IP information for the current default network. * <p>This method requires the caller to hold the permission * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. @@ -2007,24 +1985,6 @@ public class ConnectivityManager { } /** - * Signal that the captive portal check on the indicated network - * is complete and whether its a captive portal or not. - * <p>This method requires the caller to hold the permission - * {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}. - * - * @param info the {@link NetworkInfo} object for the networkType - * in question. - * @param isCaptivePortal true/false. - * {@hide} - */ - public void captivePortalCheckCompleted(NetworkInfo info, boolean isCaptivePortal) { - try { - mService.captivePortalCheckCompleted(info, isCaptivePortal); - } catch (RemoteException e) { - } - } - - /** * Check mobile provisioning. * * @param suggestedTimeOutMs, timeout in milliseconds @@ -2056,18 +2016,6 @@ public class ConnectivityManager { } /** - * Get the mobile redirected provisioning url. - * {@hide} - */ - public String getMobileRedirectedProvisioningUrl() { - try { - return mService.getMobileRedirectedProvisioningUrl(); - } catch (RemoteException e) { - } - return null; - } - - /** * Set sign in error notification to visible or in visible * * @param visible diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl index 89d23a2..29557bb 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -53,8 +53,6 @@ interface IConnectivityManager Network[] getAllNetworks(); NetworkCapabilities[] getDefaultNetworkCapabilitiesForUser(int userId); - NetworkInfo getProvisioningOrActiveNetworkInfo(); - boolean isNetworkSupported(int networkType); LinkProperties getActiveLinkProperties(); @@ -122,14 +120,10 @@ interface IConnectivityManager boolean updateLockdownVpn(); - void captivePortalCheckCompleted(in NetworkInfo info, boolean isCaptivePortal); - int checkMobileProvisioning(int suggestedTimeOutMs); String getMobileProvisioningUrl(); - String getMobileRedirectedProvisioningUrl(); - void setProvisioningNotificationVisible(boolean visible, int networkType, in String action); void setAirplaneMode(boolean enable); diff --git a/core/java/android/net/Network.java b/core/java/android/net/Network.java index 9628bae..fe69320 100644 --- a/core/java/android/net/Network.java +++ b/core/java/android/net/Network.java @@ -378,6 +378,9 @@ public class Network implements Parcelable { // // The HANDLE_MAGIC value MUST be kept in sync with the corresponding // value in the native/android/net.c NDK implementation. + if (netId == 0) { + return 0L; // make this zero condition obvious for debugging + } final long HANDLE_MAGIC = 0xfacade; return (((long) netId) << 32) | HANDLE_MAGIC; } diff --git a/core/java/android/net/NetworkInfo.java b/core/java/android/net/NetworkInfo.java index 393637e..af7a465 100644 --- a/core/java/android/net/NetworkInfo.java +++ b/core/java/android/net/NetworkInfo.java @@ -120,7 +120,6 @@ public class NetworkInfo implements Parcelable { private String mExtraInfo; private boolean mIsFailover; private boolean mIsRoaming; - private boolean mIsConnectedToProvisioningNetwork; /** * Indicates whether network connectivity is possible: @@ -142,7 +141,6 @@ public class NetworkInfo implements Parcelable { mState = State.UNKNOWN; mIsAvailable = false; // until we're told otherwise, assume unavailable mIsRoaming = false; - mIsConnectedToProvisioningNetwork = false; } /** {@hide} */ @@ -160,7 +158,6 @@ public class NetworkInfo implements Parcelable { mIsFailover = source.mIsFailover; mIsRoaming = source.mIsRoaming; mIsAvailable = source.mIsAvailable; - mIsConnectedToProvisioningNetwork = source.mIsConnectedToProvisioningNetwork; } } } @@ -332,22 +329,6 @@ public class NetworkInfo implements Parcelable { } } - /** {@hide} */ - @VisibleForTesting - public boolean isConnectedToProvisioningNetwork() { - synchronized (this) { - return mIsConnectedToProvisioningNetwork; - } - } - - /** {@hide} */ - @VisibleForTesting - public void setIsConnectedToProvisioningNetwork(boolean val) { - synchronized (this) { - mIsConnectedToProvisioningNetwork = val; - } - } - /** * Reports the current coarse-grained state of the network. * @return the coarse-grained state @@ -431,8 +412,6 @@ public class NetworkInfo implements Parcelable { append(", roaming: ").append(mIsRoaming). append(", failover: ").append(mIsFailover). append(", isAvailable: ").append(mIsAvailable). - append(", isConnectedToProvisioningNetwork: "). - append(mIsConnectedToProvisioningNetwork). append("]"); return builder.toString(); } @@ -461,7 +440,6 @@ public class NetworkInfo implements Parcelable { dest.writeInt(mIsFailover ? 1 : 0); dest.writeInt(mIsAvailable ? 1 : 0); dest.writeInt(mIsRoaming ? 1 : 0); - dest.writeInt(mIsConnectedToProvisioningNetwork ? 1 : 0); dest.writeString(mReason); dest.writeString(mExtraInfo); } @@ -484,7 +462,6 @@ public class NetworkInfo implements Parcelable { netInfo.mIsFailover = in.readInt() != 0; netInfo.mIsAvailable = in.readInt() != 0; netInfo.mIsRoaming = in.readInt() != 0; - netInfo.mIsConnectedToProvisioningNetwork = in.readInt() != 0; netInfo.mReason = in.readString(); netInfo.mExtraInfo = in.readString(); return netInfo; diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java index ff3de2b..bb08be2 100644 --- a/core/java/android/net/TrafficStats.java +++ b/core/java/android/net/TrafficStats.java @@ -53,6 +53,8 @@ public class TrafficStats { public static final long GB_IN_BYTES = MB_IN_BYTES * 1024; /** @hide */ public static final long TB_IN_BYTES = GB_IN_BYTES * 1024; + /** @hide */ + public static final long PB_IN_BYTES = TB_IN_BYTES * 1024; /** * Special UID value used when collecting {@link NetworkStatsHistory} for diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index ef7e747..00350ec 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -362,6 +362,18 @@ public class UserManager { public static final String DISALLOW_SMS = "no_sms"; /** + * Specifies if the user is not allowed to have fun. In some cases, the + * device owner may wish to prevent the user from experiencing amusement or + * joy while using the device. The default value is <code>false</code>. + * + * <p/>Key for user restrictions. + * <p/>Type: Boolean + * @see #setUserRestrictions(Bundle) + * @see #getUserRestrictions() + */ + public static final String DISALLOW_FUN = "no_fun"; + + /** * Specifies that windows besides app windows should not be * created. This will block the creation of the following types of windows. * <li>{@link LayoutParams#TYPE_TOAST}</li> diff --git a/core/java/android/text/format/Formatter.java b/core/java/android/text/format/Formatter.java index b467f5a..13a959e 100644 --- a/core/java/android/text/format/Formatter.java +++ b/core/java/android/text/format/Formatter.java @@ -17,7 +17,9 @@ package android.text.format; import android.content.Context; +import android.content.res.Resources; import android.net.NetworkUtils; +import android.net.TrafficStats; /** * Utility class to aid in formatting common values that are not covered @@ -25,63 +27,88 @@ import android.net.NetworkUtils; */ public final class Formatter { + /** {@hide} */ + public static final int FLAG_SHORTER = 1 << 0; + /** {@hide} */ + public static final int FLAG_CALCULATE_ROUNDED = 1 << 1; + + /** {@hide} */ + public static class BytesResult { + public final String value; + public final String units; + public final long roundedBytes; + + public BytesResult(String value, String units, long roundedBytes) { + this.value = value; + this.units = units; + this.roundedBytes = roundedBytes; + } + } + /** * Formats a content size to be in the form of bytes, kilobytes, megabytes, etc * * @param context Context to use to load the localized units - * @param number size value to be formatted + * @param sizeBytes size value to be formatted, in bytes * @return formatted string with the number */ - public static String formatFileSize(Context context, long number) { - return formatFileSize(context, number, false); + public static String formatFileSize(Context context, long sizeBytes) { + final BytesResult res = formatBytes(context.getResources(), sizeBytes, 0); + return context.getString(com.android.internal.R.string.fileSizeSuffix, + res.value, res.units); } /** * Like {@link #formatFileSize}, but trying to generate shorter numbers * (showing fewer digits of precision). */ - public static String formatShortFileSize(Context context, long number) { - return formatFileSize(context, number, true); + public static String formatShortFileSize(Context context, long sizeBytes) { + final BytesResult res = formatBytes(context.getResources(), sizeBytes, FLAG_SHORTER); + return context.getString(com.android.internal.R.string.fileSizeSuffix, + res.value, res.units); } - private static String formatFileSize(Context context, long number, boolean shorter) { - if (context == null) { - return ""; - } - - float result = number; + /** {@hide} */ + public static BytesResult formatBytes(Resources res, long sizeBytes, int flags) { + float result = sizeBytes; int suffix = com.android.internal.R.string.byteShort; + long mult = 1; if (result > 900) { suffix = com.android.internal.R.string.kilobyteShort; + mult = TrafficStats.KB_IN_BYTES; result = result / 1024; } if (result > 900) { suffix = com.android.internal.R.string.megabyteShort; + mult = TrafficStats.MB_IN_BYTES; result = result / 1024; } if (result > 900) { suffix = com.android.internal.R.string.gigabyteShort; + mult = TrafficStats.GB_IN_BYTES; result = result / 1024; } if (result > 900) { suffix = com.android.internal.R.string.terabyteShort; + mult = TrafficStats.TB_IN_BYTES; result = result / 1024; } if (result > 900) { suffix = com.android.internal.R.string.petabyteShort; + mult = TrafficStats.PB_IN_BYTES; result = result / 1024; } String value; if (result < 1) { value = String.format("%.2f", result); } else if (result < 10) { - if (shorter) { + if ((flags & FLAG_SHORTER) != 0) { value = String.format("%.1f", result); } else { value = String.format("%.2f", result); } } else if (result < 100) { - if (shorter) { + if ((flags & FLAG_SHORTER) != 0) { value = String.format("%.0f", result); } else { value = String.format("%.2f", result); @@ -89,9 +116,14 @@ public final class Formatter { } else { value = String.format("%.0f", result); } - return context.getResources(). - getString(com.android.internal.R.string.fileSizeSuffix, - value, context.getString(suffix)); + final String units = res.getString(suffix); + final long roundedBytes; + if ((flags & FLAG_CALCULATE_ROUNDED) != 0) { + roundedBytes = (long) (Double.parseDouble(value) * mult); + } else { + roundedBytes = 0; + } + return new BytesResult(value, units, roundedBytes); } /** diff --git a/core/java/android/transition/Visibility.java b/core/java/android/transition/Visibility.java index bac668a..8b74a1e 100644 --- a/core/java/android/transition/Visibility.java +++ b/core/java/android/transition/Visibility.java @@ -557,7 +557,7 @@ public abstract class Visibility extends Transition { if (mIsForcedVisibility) { mView.setTransitionAlpha(0); } else { - mView.setTransitionVisibility(mFinalVisibility); + mView.setVisibility(mFinalVisibility); } } } diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index cf6a018..f89ee91 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -244,15 +244,6 @@ public class Editor { final CursorAnchorInfoNotifier mCursorAnchorInfoNotifier = new CursorAnchorInfoNotifier(); - private final Runnable mHideFloatingToolbar = new Runnable() { - @Override - public void run() { - if (mTextActionMode != null) { - mTextActionMode.hide(ActionMode.DEFAULT_HIDE_DURATION); - } - } - }; - private final Runnable mShowFloatingToolbar = new Runnable() { @Override public void run() { @@ -389,7 +380,6 @@ public class Editor { mTextView.removeCallbacks(mInsertionActionModeRunnable); } - mTextView.removeCallbacks(mHideFloatingToolbar); mTextView.removeCallbacks(mShowFloatingToolbar); destroyDisplayListsData(); @@ -1248,14 +1238,12 @@ public class Editor { private void hideFloatingToolbar() { if (mTextActionMode != null) { mTextView.removeCallbacks(mShowFloatingToolbar); - // Delay the "hide" a little bit just in case a "show" will happen almost immediately. - mTextView.postDelayed(mHideFloatingToolbar, 100); + mTextActionMode.hide(ActionMode.DEFAULT_HIDE_DURATION); } } private void showFloatingToolbar() { if (mTextActionMode != null) { - mTextView.removeCallbacks(mHideFloatingToolbar); // Delay "show" so it doesn't interfere with click confirmations // or double-clicks that could "dismiss" the floating toolbar. int delay = ViewConfiguration.getDoubleTapTimeout(); diff --git a/core/java/com/android/internal/app/AssistUtils.java b/core/java/com/android/internal/app/AssistUtils.java new file mode 100644 index 0000000..b520384 --- /dev/null +++ b/core/java/com/android/internal/app/AssistUtils.java @@ -0,0 +1,129 @@ +/* + * 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 + */ + +package com.android.internal.app; + +import android.app.SearchManager; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.provider.Settings; +import android.util.Log; + +/** + * Utility method for dealing with the assistant aspects of + * {@link com.android.internal.app.IVoiceInteractionManagerService IVoiceInteractionManagerService}. + */ +public class AssistUtils { + + private static final String TAG = "AssistUtils"; + + private final Context mContext; + private final IVoiceInteractionManagerService mVoiceInteractionManagerService; + + public AssistUtils(Context context) { + mContext = context; + mVoiceInteractionManagerService = IVoiceInteractionManagerService.Stub.asInterface( + ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE)); + } + + public void showSessionForActiveService(IVoiceInteractionSessionShowCallback showCallback) { + try { + mVoiceInteractionManagerService.showSessionForActiveService(showCallback); + } catch (RemoteException e) { + Log.w(TAG, "Failed to call showSessionForActiveService", e); + } + } + + public void launchVoiceAssistFromKeyguard() { + try { + mVoiceInteractionManagerService.launchVoiceAssistFromKeyguard(); + } catch (RemoteException e) { + Log.w(TAG, "Failed to call launchVoiceAssistFromKeyguard", e); + } + } + + public boolean activeServiceSupportsAssistGesture() { + try { + return mVoiceInteractionManagerService != null + && mVoiceInteractionManagerService.activeServiceSupportsAssist(); + } catch (RemoteException e) { + Log.w(TAG, "Failed to call activeServiceSupportsAssistGesture", e); + return false; + } + } + + public boolean activeServiceSupportsLaunchFromKeyguard() { + try { + return mVoiceInteractionManagerService != null + && mVoiceInteractionManagerService.activeServiceSupportsLaunchFromKeyguard(); + } catch (RemoteException e) { + Log.w(TAG, "Failed to call activeServiceSupportsLaunchFromKeyguard", e); + return false; + } + } + + public ComponentName getActiveServiceComponentName() { + try { + return mVoiceInteractionManagerService.getActiveServiceComponentName(); + } catch (RemoteException e) { + Log.w(TAG, "Failed to call getActiveServiceComponentName", e); + return null; + } + } + + public boolean isSessionRunning() { + try { + return mVoiceInteractionManagerService != null + && mVoiceInteractionManagerService.isSessionRunning(); + } catch (RemoteException e) { + Log.w(TAG, "Failed to call isSessionRunning", e); + return false; + } + } + + public void hideCurrentSession() { + try { + mVoiceInteractionManagerService.hideCurrentSession(); + } catch (RemoteException e) { + Log.w(TAG, "Failed to call hideCurrentSession", e); + } + } + + public ComponentName getAssistComponentForUser(int userId) { + final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(), + Settings.Secure.ASSISTANT, userId); + if (setting != null) { + return ComponentName.unflattenFromString(setting); + } + + // Fallback to keep backward compatible behavior when there is no user setting. + if (activeServiceSupportsAssistGesture()) { + return getActiveServiceComponentName(); + } + + Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) + .getAssistIntent(mContext, false, userId); + if (intent != null) { + return intent.getComponent(); + } + + return null; + } + +} diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java index 2539a35..f81658e 100644 --- a/core/java/com/android/internal/os/RuntimeInit.java +++ b/core/java/com/android/internal/os/RuntimeInit.java @@ -24,6 +24,7 @@ import android.os.Debug; import android.os.IBinder; import android.os.Process; import android.os.SystemProperties; +import android.os.Trace; import android.util.Log; import android.util.Slog; import com.android.internal.logging.AndroidConfig; @@ -269,11 +270,11 @@ public class RuntimeInit { throws ZygoteInit.MethodAndArgsCaller { if (DEBUG) Slog.d(TAG, "RuntimeInit: Starting application from zygote"); + Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "RuntimeInit"); redirectLogStreams(); commonInit(); nativeZygoteInit(); - applicationInit(targetSdkVersion, argv, classLoader); } @@ -318,6 +319,9 @@ public class RuntimeInit { return; } + // The end of of the RuntimeInit event (see #zygoteInit). + Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); + // Remaining arguments are passed to the start class's static main invokeStaticMain(args.startClass, args.startArgs, classLoader); } diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 1e7ee5a..4f6d781 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -17,6 +17,7 @@ package com.android.internal.os; +import android.os.Trace; import dalvik.system.ZygoteHooks; import android.system.ErrnoException; import android.system.Os; @@ -88,6 +89,13 @@ public final class Zygote { int pid = nativeForkAndSpecialize( uid, gid, gids, debugFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose, instructionSet, appDataDir); + // Enable tracing as soon as possible for the child process. + if (pid == 0) { + Trace.setTracingEnabled(true); + + // Note that this event ends at the end of handleChildProc, + Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); + } VM_HOOKS.postForkCommon(); return pid; } @@ -124,6 +132,10 @@ public final class Zygote { VM_HOOKS.preFork(); int pid = nativeForkSystemServer( uid, gid, gids, debugFlags, rlimits, permittedCapabilities, effectiveCapabilities); + // Enable tracing as soon as we enter the system_server. + if (pid == 0) { + Trace.setTracingEnabled(true); + } VM_HOOKS.postForkCommon(); return pid; } diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java index 969d236..1a0345b 100644 --- a/core/java/com/android/internal/os/ZygoteConnection.java +++ b/core/java/com/android/internal/os/ZygoteConnection.java @@ -27,6 +27,7 @@ import android.net.LocalSocket; import android.os.Process; import android.os.SELinux; import android.os.SystemProperties; +import android.os.Trace; import android.system.ErrnoException; import android.system.Os; import android.util.Log; @@ -711,7 +712,6 @@ class ZygoteConnection { private void handleChildProc(Arguments parsedArgs, FileDescriptor[] descriptors, FileDescriptor pipeFd, PrintStream newStderr) throws ZygoteInit.MethodAndArgsCaller { - /** * By the time we get here, the native code has closed the two actual Zygote * socket connections, and substituted /dev/null in their place. The LocalSocket @@ -740,6 +740,8 @@ class ZygoteConnection { Process.setArgV0(parsedArgs.niceName); } + // End of the postFork event. + Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); if (parsedArgs.invokeWith != null) { WrapperInit.execApplication(parsedArgs.invokeWith, parsedArgs.niceName, parsedArgs.targetSdkVersion, diff --git a/core/java/com/android/internal/view/FloatingActionMode.java b/core/java/com/android/internal/view/FloatingActionMode.java index 661dce1..99c1277 100644 --- a/core/java/com/android/internal/view/FloatingActionMode.java +++ b/core/java/com/android/internal/view/FloatingActionMode.java @@ -48,12 +48,14 @@ public class FloatingActionMode extends ActionMode { private final Runnable mMovingOff = new Runnable() { public void run() { mFloatingToolbarVisibilityHelper.setMoving(false); + mFloatingToolbarVisibilityHelper.updateToolbarVisibility(); } }; private final Runnable mHideOff = new Runnable() { public void run() { mFloatingToolbarVisibilityHelper.setHideRequested(false); + mFloatingToolbarVisibilityHelper.updateToolbarVisibility(); } }; @@ -87,6 +89,7 @@ public class FloatingActionMode extends ActionMode { } }); mFloatingToolbarVisibilityHelper = new FloatingToolbarVisibilityHelper(mFloatingToolbar); + mFloatingToolbarVisibilityHelper.activate(); } @Override @@ -108,8 +111,7 @@ public class FloatingActionMode extends ActionMode { public void invalidate() { checkToolbarInitialized(); mCallback.onPrepareActionMode(this, mMenu); - mFloatingToolbar.updateLayout(); - invalidateContentRect(); + invalidateContentRect(); // Will re-layout and show the toolbar if necessary. } @Override @@ -131,44 +133,43 @@ public class FloatingActionMode extends ActionMode { mContentRectOnWindow.set(mContentRect); mContentRectOnWindow.offset(mViewPosition[0], mViewPosition[1]); - // Make sure that content rect is not out of the view's visible bounds. - mContentRectOnWindow.set( - Math.max(mContentRectOnWindow.left, mViewRect.left), - Math.max(mContentRectOnWindow.top, mViewRect.top), - Math.min(mContentRectOnWindow.right, mViewRect.right), - Math.min(mContentRectOnWindow.bottom, mViewRect.bottom)); - - if (!mContentRectOnWindow.equals(mPreviousContentRectOnWindow)) { - if (!mPreviousContentRectOnWindow.isEmpty()) { - notifyContentRectMoving(); - } - mFloatingToolbar.setContentRect(mContentRectOnWindow); - mFloatingToolbar.updateLayout(); - } - mPreviousContentRectOnWindow.set(mContentRectOnWindow); if (isContentRectWithinBounds()) { mFloatingToolbarVisibilityHelper.setOutOfBounds(false); + // Make sure that content rect is not out of the view's visible bounds. + mContentRectOnWindow.set( + Math.max(mContentRectOnWindow.left, mViewRect.left), + Math.max(mContentRectOnWindow.top, mViewRect.top), + Math.min(mContentRectOnWindow.right, mViewRect.right), + Math.min(mContentRectOnWindow.bottom, mViewRect.bottom)); + + if (!mContentRectOnWindow.equals(mPreviousContentRectOnWindow)) { + // Content rect is moving. + mOriginatingView.removeCallbacks(mMovingOff); + mFloatingToolbarVisibilityHelper.setMoving(true); + mOriginatingView.postDelayed(mMovingOff, MOVING_HIDE_DELAY); + + mFloatingToolbar.setContentRect(mContentRectOnWindow); + mFloatingToolbar.updateLayout(); + } } else { mFloatingToolbarVisibilityHelper.setOutOfBounds(true); + mContentRectOnWindow.setEmpty(); } - } + mFloatingToolbarVisibilityHelper.updateToolbarVisibility(); - private boolean isContentRectWithinBounds() { - mScreenRect.set( - 0, - 0, - mContext.getResources().getDisplayMetrics().widthPixels, - mContext.getResources().getDisplayMetrics().heightPixels); - - return Rect.intersects(mContentRectOnWindow, mScreenRect) - && Rect.intersects(mContentRectOnWindow, mViewRect); + mPreviousContentRectOnWindow.set(mContentRectOnWindow); } - private void notifyContentRectMoving() { - mOriginatingView.removeCallbacks(mMovingOff); - mFloatingToolbarVisibilityHelper.setMoving(true); - mOriginatingView.postDelayed(mMovingOff, MOVING_HIDE_DELAY); + private boolean isContentRectWithinBounds() { + mScreenRect.set( + 0, + 0, + mContext.getResources().getDisplayMetrics().widthPixels, + mContext.getResources().getDisplayMetrics().heightPixels); + + return Rect.intersects(mContentRectOnWindow, mScreenRect) + && Rect.intersects(mContentRectOnWindow, mViewRect); } @Override @@ -184,6 +185,7 @@ public class FloatingActionMode extends ActionMode { mHideOff.run(); } else { mFloatingToolbarVisibilityHelper.setHideRequested(true); + mFloatingToolbarVisibilityHelper.updateToolbarVisibility(); mOriginatingView.postDelayed(mHideOff, duration); } } @@ -221,7 +223,7 @@ public class FloatingActionMode extends ActionMode { } /** - * @throws IlllegalStateException + * @throws IllegalStateException */ private void checkToolbarInitialized() { Preconditions.checkState(mFloatingToolbar != null); @@ -229,13 +231,14 @@ public class FloatingActionMode extends ActionMode { } private void reset() { + mFloatingToolbarVisibilityHelper.deactivate(); mOriginatingView.removeCallbacks(mMovingOff); mOriginatingView.removeCallbacks(mHideOff); } /** - * A helper that shows/hides the floating toolbar depending on certain states. + * A helper for showing/hiding the floating toolbar depending on certain states. */ private static final class FloatingToolbarVisibilityHelper { @@ -245,29 +248,45 @@ public class FloatingActionMode extends ActionMode { private boolean mMoving; private boolean mOutOfBounds; + private boolean mActive; + public FloatingToolbarVisibilityHelper(FloatingToolbar toolbar) { mToolbar = Preconditions.checkNotNull(toolbar); } + public void activate() { + mHideRequested = false; + mMoving = false; + mOutOfBounds = false; + + mActive = true; + } + + public void deactivate() { + mActive = false; + mToolbar.dismiss(); + } + public void setHideRequested(boolean hide) { mHideRequested = hide; - updateToolbarVisibility(); } public void setMoving(boolean moving) { mMoving = moving; - updateToolbarVisibility(); } public void setOutOfBounds(boolean outOfBounds) { mOutOfBounds = outOfBounds; - updateToolbarVisibility(); } - private void updateToolbarVisibility() { + public void updateToolbarVisibility() { + if (!mActive) { + return; + } + if (mHideRequested || mMoving || mOutOfBounds) { mToolbar.hide(); - } else if (mToolbar.isHidden()) { + } else { mToolbar.show(); } } diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java index 2d0989f..53ebc23 100644 --- a/core/java/com/android/internal/widget/FloatingToolbar.java +++ b/core/java/com/android/internal/widget/FloatingToolbar.java @@ -37,7 +37,6 @@ import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.Window; -import android.view.WindowInsets; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.AnimationSet; @@ -436,8 +435,6 @@ public final class FloatingToolbar { // The "show" animation will make this visible. mContentContainer.setAlpha(0); } - refreshViewPort(); - updateOverflowHeight(contentRect.top - (mMarginVertical * 2) - mViewPort.top); refreshCoordinatesAndOverflowDirection(contentRect); preparePopupContent(); mPopupWindow.showAtLocation(mParent, Gravity.NO_GRAVITY, mCoords.x, mCoords.y); @@ -501,7 +498,6 @@ public final class FloatingToolbar { } cancelOverflowAnimations(); - refreshViewPort(); refreshCoordinatesAndOverflowDirection(contentRect); preparePopupContent(); mPopupWindow.update(mCoords.x, mCoords.y, getWidth(), getHeight()); @@ -529,28 +525,65 @@ public final class FloatingToolbar { } private void refreshCoordinatesAndOverflowDirection(Rect contentRect) { - // NOTE: Ensure that mViewPort has been refreshed before this. + refreshViewPort(); - int x = contentRect.centerX() - getWidth() / 2; - int y; - if (contentRect.top - getHeight() > mViewPort.top) { - y = contentRect.top - getHeight(); - mOverflowDirection = FloatingToolbarPopup.OVERFLOW_DIRECTION_UP; - } else if (contentRect.top - getToolbarHeightWithVerticalMargin() > mViewPort.top) { - y = contentRect.top - getToolbarHeightWithVerticalMargin(); - mOverflowDirection = FloatingToolbarPopup.OVERFLOW_DIRECTION_DOWN; - } else { - y = contentRect.bottom; - mOverflowDirection = FloatingToolbarPopup.OVERFLOW_DIRECTION_DOWN; - } + int availableHeightAboveContent = + contentRect.top - mViewPort.top - 2 * mMarginVertical; + int availableHeightBelowContent = + mViewPort.bottom - contentRect.bottom - 2 * mMarginVertical; + int availableHeightThroughContent = + mViewPort.bottom - contentRect.top + getToolbarHeightWithVerticalMargin(); + int x = contentRect.centerX() - getWidth() / 2; // Update x so that the toolbar isn't rendered behind the nav bar in landscape. x = Math.max(0, Math.min(x, mViewPort.right - getWidth())); - mCoords.set(x, y); - if (mOverflowPanel != null) { + int y; + if (mOverflowPanel == null) { // There is no overflow. + if (availableHeightAboveContent > getToolbarHeightWithVerticalMargin()) { + // There is enough space at the top of the content. + y = contentRect.top - getToolbarHeightWithVerticalMargin(); + } else if (availableHeightBelowContent > getToolbarHeightWithVerticalMargin()) { + // There is enough space at the bottom of the content. + y = contentRect.bottom; + } else { + // Not enough space. Prefer to position as high as possible. + y = Math.max( + mViewPort.top, + contentRect.top - getToolbarHeightWithVerticalMargin()); + } + } else { // There is an overflow. + if (availableHeightAboveContent > mOverflowPanel.getMinimumHeight()) { + // There is enough space at the top of the content rect for the overflow. + // Position above and open upwards. + updateOverflowHeight(availableHeightAboveContent); + y = contentRect.top - getHeight(); + mOverflowDirection = OVERFLOW_DIRECTION_UP; + } else if (availableHeightAboveContent > getToolbarHeightWithVerticalMargin() + && availableHeightThroughContent > mOverflowPanel.getMinimumHeight()) { + // There is enough space at the top of the content rect for the main panel + // but not the overflow. + // Position above but open downwards. + updateOverflowHeight(availableHeightThroughContent); + y = contentRect.top - getToolbarHeightWithVerticalMargin(); + mOverflowDirection = OVERFLOW_DIRECTION_DOWN; + } else if (availableHeightBelowContent > mOverflowPanel.getMinimumHeight()) { + // There is enough space at the bottom of the content rect for the overflow. + // Position below and open downwards. + updateOverflowHeight(availableHeightBelowContent); + y = contentRect.bottom; + mOverflowDirection = OVERFLOW_DIRECTION_DOWN; + } else { + // Not enough space. + // Position at the bottom of the view port and open upwards. + updateOverflowHeight(mViewPort.height()); + y = mViewPort.bottom - getHeight(); + mOverflowDirection = OVERFLOW_DIRECTION_UP; + } mOverflowPanel.setOverflowDirection(mOverflowDirection); } + + mCoords.set(x, y); } private int getToolbarHeightWithVerticalMargin() { @@ -837,13 +870,7 @@ public final class FloatingToolbar { private void refreshViewPort() { - mParent.getGlobalVisibleRect(mViewPort); - WindowInsets windowInsets = mParent.getRootWindowInsets(); - mViewPort.set( - mViewPort.left + windowInsets.getStableInsetLeft(), - mViewPort.top + windowInsets.getStableInsetTop(), - mViewPort.right - windowInsets.getStableInsetRight(), - mViewPort.bottom - windowInsets.getStableInsetBottom()); + mParent.getWindowVisibleDisplayFrame(mViewPort); } private int getToolbarWidth(int suggestedWidth) { @@ -1139,6 +1166,12 @@ public final class FloatingToolbar { setListViewHeight(); } + public int getMinimumHeight() { + return mContentView.getContext().getResources(). + getDimensionPixelSize(R.dimen.floating_toolbar_minimum_overflow_height) + + getEstimatedToolbarHeight(mContentView.getContext()); + } + /** * Returns the content view of the overflow. */ @@ -1173,13 +1206,18 @@ public final class FloatingToolbar { getDimensionPixelSize(R.dimen.floating_toolbar_maximum_overflow_height); int minHeight = mContentView.getContext().getResources(). getDimensionPixelSize(R.dimen.floating_toolbar_minimum_overflow_height); - int availableHeight = mSuggestedHeight - (mSuggestedHeight % itemHeight) + int suggestedListViewHeight = mSuggestedHeight - (mSuggestedHeight % itemHeight) - itemHeight; // reserve space for the back button. ViewGroup.LayoutParams params = mListView.getLayoutParams(); - if (availableHeight >= minHeight) { - params.height = Math.min(Math.min(availableHeight, maxHeight), height); - } else { + if (suggestedListViewHeight <= 0) { + // Invalid height. Use the maximum height available. params.height = Math.min(maxHeight, height); + } else if (suggestedListViewHeight < minHeight) { + // Height is smaller than minimum allowed. Use minimum height. + params.height = minHeight; + } else { + // Use the suggested height. Cap it at the maximum available height. + params.height = Math.min(Math.min(suggestedListViewHeight, maxHeight), height); } mListView.setLayoutParams(params); } @@ -1360,6 +1398,7 @@ public final class FloatingToolbar { PopupWindow popupWindow = new PopupWindow(popupContentHolder); popupWindow.setWindowLayoutType( WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL); + popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); popupWindow.setAnimationStyle(0); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); content.setLayoutParams(new ViewGroup.LayoutParams( diff --git a/core/jni/android_util_Log.cpp b/core/jni/android_util_Log.cpp index 9a80f1d..2b1067b 100644 --- a/core/jni/android_util_Log.cpp +++ b/core/jni/android_util_Log.cpp @@ -41,32 +41,8 @@ struct levels_t { }; static levels_t levels; -static int toLevel(const char* value) -{ - switch (value[0]) { - case 'V': return levels.verbose; - case 'D': return levels.debug; - case 'I': return levels.info; - case 'W': return levels.warn; - case 'E': return levels.error; - case 'A': return levels.assert; - case 'S': return -1; // SUPPRESS - } - return levels.info; -} - static jboolean isLoggable(const char* tag, jint level) { - String8 key; - key.append(LOG_NAMESPACE); - key.append(tag); - - char buf[PROPERTY_VALUE_MAX]; - if (property_get(key.string(), buf, "") <= 0) { - buf[0] = '\0'; - } - - int logLevel = toLevel(buf); - return logLevel >= 0 && level >= logLevel; + return __android_log_is_loggable(level, tag, ANDROID_LOG_INFO); } static jboolean android_util_Log_isLoggable(JNIEnv* env, jobject clazz, jstring tag, jint level) diff --git a/core/res/res/values-sw600dp/dimens.xml b/core/res/res/values-sw600dp/dimens.xml index c0d9995..94e9c4e 100644 --- a/core/res/res/values-sw600dp/dimens.xml +++ b/core/res/res/values-sw600dp/dimens.xml @@ -115,4 +115,6 @@ <!-- width of ImmersiveModeConfirmation (-1 for match_parent) --> <dimen name="immersive_mode_cling_width">380dp</dimen> + + <dimen name="floating_toolbar_preferred_width">544dp</dimen> </resources> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index e7811df..7272ae3 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1271,11 +1271,6 @@ an mcc/mnc specific config.xml --> <string name="mobile_provisioning_url" translatable="false"></string> - <!-- This url is used as the default url when redirection is detected. Any - should work as all url's get redirected. But maybe overridden by - if needed. --> - <string name="mobile_redirected_provisioning_url" translatable="false">http://google.com</string> - <!-- The default character set for GsmAlphabet --> <!-- Empty string means MBCS is not considered --> <string name="gsm_alphabet_default_charset" translatable="false"></string> @@ -2196,6 +2191,9 @@ <!-- Keyguard component --> <string name="config_keyguardComponent" translatable="false">com.android.systemui/com.android.systemui.keyguard.KeyguardService</string> + <!-- For performance and storage reasons, limit the number of fingerprints per user --> + <integer name="config_fingerprintMaxTemplatesPerUser">5</integer> + <!-- This config is used to force VoiceInteractionService to start on certain low ram devices. It declares the package name of VoiceInteractionService that should be started. --> <string translatable="false" name="config_forceVoiceInteractionServicePackage"></string> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 2908cc5..fb0455d 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -34,7 +34,7 @@ to display a size in kilobytes, megabytes, or other size units. Some languages (like French) will want to add a space between the placeholders. --> - <string name="fileSizeSuffix"><xliff:g id="number" example="123">%1$s</xliff:g><xliff:g id="unit" example="KB">%2$s</xliff:g></string> + <string name="fileSizeSuffix"><xliff:g id="number" example="123">%1$s</xliff:g> <xliff:g id="unit" example="KB">%2$s</xliff:g></string> <!-- [CHAR_LIMIT=10] Suffix added to signify duration in days --> <string name="durationDays"><xliff:g id="days">%1$d</xliff:g> days</string> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 45e5d17..5ba57c4 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -818,7 +818,6 @@ <java-symbol type="string" name="progress_unmounting" /> <java-symbol type="string" name="mobile_provisioning_apn" /> <java-symbol type="string" name="mobile_provisioning_url" /> - <java-symbol type="string" name="mobile_redirected_provisioning_url" /> <java-symbol type="string" name="quick_contacts_not_available" /> <java-symbol type="string" name="reboot_to_update_package" /> <java-symbol type="string" name="reboot_to_update_prepare" /> @@ -2125,6 +2124,9 @@ <java-symbol type="string" name="fingerprint_error_lockout" /> <java-symbol type="string" name="fingerprint_name_template" /> + <!-- Fingerprint config --> + <java-symbol type="integer" name="config_fingerprintMaxTemplatesPerUser"/> + <!-- From various Material changes --> <java-symbol type="attr" name="titleTextAppearance" /> <java-symbol type="attr" name="subtitleTextAppearance" /> @@ -2309,5 +2311,6 @@ <java-symbol type="string" name="ext_media_unsupported_notification_message" /> <java-symbol type="string" name="ext_media_unsupported_notification_title" /> <java-symbol type="plurals" name="selected_count" /> + <java-symbol type="drawable" name="ic_dialog_alert_material" /> </resources> diff --git a/core/tests/coretests/src/android/net/NetworkTest.java b/core/tests/coretests/src/android/net/NetworkTest.java index b0ecb04..74b6d98 100644 --- a/core/tests/coretests/src/android/net/NetworkTest.java +++ b/core/tests/coretests/src/android/net/NetworkTest.java @@ -16,11 +16,14 @@ package android.net; +import static android.test.MoreAsserts.assertNotEqual; + import android.net.LocalServerSocket; import android.net.LocalSocket; import android.net.LocalSocketAddress; import android.net.Network; import android.test.suitebuilder.annotation.SmallTest; + import java.io.File; import java.io.FileDescriptor; import java.io.FileInputStream; @@ -29,6 +32,7 @@ import java.net.DatagramSocket; import java.net.InetAddress; import java.net.Inet6Address; import java.net.SocketException; + import junit.framework.TestCase; public class NetworkTest extends TestCase { @@ -93,4 +97,50 @@ public class NetworkTest extends TestCase { fail("SocketException not thrown"); } catch (SocketException expected) {} } + + @SmallTest + public void testZeroIsObviousForDebugging() { + Network zero = new Network(0); + assertEquals(0, zero.hashCode()); + assertEquals(0, zero.getNetworkHandle()); + assertEquals("0", zero.toString()); + } + + @SmallTest + public void testGetNetworkHandle() { + Network one = new Network(1); + Network two = new Network(2); + Network three = new Network(3); + + // None of the hashcodes are zero. + assertNotEqual(0, one.hashCode()); + assertNotEqual(0, two.hashCode()); + assertNotEqual(0, three.hashCode()); + + // All the hashcodes are distinct. + assertNotEqual(one.hashCode(), two.hashCode()); + assertNotEqual(one.hashCode(), three.hashCode()); + assertNotEqual(two.hashCode(), three.hashCode()); + + // None of the handles are zero. + assertNotEqual(0, one.getNetworkHandle()); + assertNotEqual(0, two.getNetworkHandle()); + assertNotEqual(0, three.getNetworkHandle()); + + // All the handles are distinct. + assertNotEqual(one.getNetworkHandle(), two.getNetworkHandle()); + assertNotEqual(one.getNetworkHandle(), three.getNetworkHandle()); + assertNotEqual(two.getNetworkHandle(), three.getNetworkHandle()); + + // The handles are not equal to the hashcodes. + assertNotEqual(one.hashCode(), one.getNetworkHandle()); + assertNotEqual(two.hashCode(), two.getNetworkHandle()); + assertNotEqual(three.hashCode(), three.getNetworkHandle()); + + // Adjust as necessary to test an implementation's specific constants. + // When running with runtest, "adb logcat -s TestRunner" can be useful. + assertEquals(4311403230L, one.getNetworkHandle()); + assertEquals(8606370526L, two.getNetworkHandle()); + assertEquals(12901337822L, three.getNetworkHandle()); + } } diff --git a/docs/html/training/tv/publishing/checklist.jd b/docs/html/training/tv/publishing/checklist.jd index 865a89b..6259721 100644 --- a/docs/html/training/tv/publishing/checklist.jd +++ b/docs/html/training/tv/publishing/checklist.jd @@ -67,12 +67,12 @@ page.article=true <li> Eliminate requirements for unsupported hardware in your app. - <p>See <a href="training/tv/start/hardware.html#declare-hardware-requirements">Declaring hardware requirements for TV</a>.</p> + <p>See <a href="{@docRoot}training/tv/start/hardware.html#declare-hardware-requirements">Declaring hardware requirements for TV</a>.</p> </li> <li> Ensure permissions do not imply hardware requirements - <p>See <a href="training/tv/start/hardware.html#hardware-permissions">Declaring permissions that imply hardware features</a>.</p> + <p>See <a href="{@docRoot}training/tv/start/hardware.html#hardware-permissions">Declaring permissions that imply hardware features</a>.</p> </li> </ol> diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index b4cbc36..fc18491 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -241,8 +241,12 @@ void RenderNode::prepareTreeImpl(TreeInfo& info, bool functorsNeedLayer) { animatorDirtyMask = mAnimatorManager.animate(info); } - bool willHaveFunctor = info.mode == TreeInfo::MODE_FULL && mStagingDisplayListData - ? !mStagingDisplayListData->functors.isEmpty() : !mDisplayListData->functors.isEmpty(); + bool willHaveFunctor = false; + if (info.mode == TreeInfo::MODE_FULL && mStagingDisplayListData) { + willHaveFunctor = !mStagingDisplayListData->functors.isEmpty(); + } else if (mDisplayListData) { + willHaveFunctor = !mDisplayListData->functors.isEmpty(); + } bool childFunctorsNeedLayer = mProperties.prepareForFunctorPresence( willHaveFunctor, functorsNeedLayer); diff --git a/media/java/android/mtp/MtpDevice.java b/media/java/android/mtp/MtpDevice.java index 72dcaa8..a68361b 100644 --- a/media/java/android/mtp/MtpDevice.java +++ b/media/java/android/mtp/MtpDevice.java @@ -132,7 +132,8 @@ public final class MtpDevice { * * @param storageId the storage unit to query * @param format the format of the object to return, or zero for all formats - * @param objectHandle the parent object to query, or zero for the storage root + * @param objectHandle the parent object to query, -1 for the storage root, + * or zero for all objects * @return the object handles */ public int[] getObjectHandles(int storageId, int format, int objectHandle) { diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java index 73a723d..4143e15 100644 --- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java +++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java @@ -120,13 +120,20 @@ public class ExternalStorageProvider extends DocumentsProvider { if (!volume.isMountedReadable()) continue; final String rootId; - if (VolumeInfo.ID_EMULATED_INTERNAL.equals(volume.getId())) { + final String title; + if (volume.getType() == VolumeInfo.TYPE_EMULATED) { + // We currently only support a single emulated volume mounted at + // a time, and it's always considered the primary rootId = ROOT_ID_PRIMARY_EMULATED; - } else if (volume.getType() == VolumeInfo.TYPE_EMULATED) { - final VolumeInfo privateVol = mStorageManager.findPrivateForEmulated(volume); - rootId = privateVol.getFsUuid(); + if (VolumeInfo.ID_EMULATED_INTERNAL.equals(volume.getId())) { + title = getContext().getString(R.string.root_internal_storage); + } else { + final VolumeInfo privateVol = mStorageManager.findPrivateForEmulated(volume); + title = mStorageManager.getBestVolumeDescription(privateVol); + } } else if (volume.getType() == VolumeInfo.TYPE_PUBLIC) { rootId = volume.getFsUuid(); + title = mStorageManager.getBestVolumeDescription(volume); } else { // Unsupported volume; ignore continue; @@ -148,11 +155,7 @@ public class ExternalStorageProvider extends DocumentsProvider { root.rootId = rootId; root.flags = Root.FLAG_SUPPORTS_CREATE | Root.FLAG_LOCAL_ONLY | Root.FLAG_ADVANCED | Root.FLAG_SUPPORTS_SEARCH | Root.FLAG_SUPPORTS_IS_CHILD; - if (ROOT_ID_PRIMARY_EMULATED.equals(rootId)) { - root.title = getContext().getString(R.string.root_internal_storage); - } else { - root.title = mStorageManager.getBestVolumeDescription(volume); - } + root.title = title; if (volume.getType() == VolumeInfo.TYPE_PUBLIC) { root.flags |= Root.FLAG_HAS_SETTINGS; } diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java index e1bfc43..13747ed 100644 --- a/packages/Shell/src/com/android/shell/BugreportReceiver.java +++ b/packages/Shell/src/com/android/shell/BugreportReceiver.java @@ -33,11 +33,23 @@ import android.os.FileUtils; import android.os.SystemProperties; import android.support.v4.content.FileProvider; import android.text.format.DateUtils; +import android.util.Log; import android.util.Patterns; import com.google.android.collect.Lists; +import libcore.io.Streams; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.Closeable; import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; import java.util.ArrayList; /** @@ -73,30 +85,14 @@ public class BugreportReceiver extends BroadcastReceiver { final Uri bugreportUri = FileProvider.getUriForFile(context, AUTHORITY, bugreportFile); final Uri screenshotUri = FileProvider.getUriForFile(context, AUTHORITY, screenshotFile); - Intent sendIntent = buildSendIntent(context, bugreportUri, screenshotUri); - Intent notifIntent; - - // Send through warning dialog by default - if (getWarningState(context, STATE_SHOW) == STATE_SHOW) { - notifIntent = buildWarningIntent(context, sendIntent); + boolean isPlainText = bugreportFile.getName().toLowerCase().endsWith(".txt"); + if (!isPlainText) { + // Already zipped, send it right away. + sendBugreportNotification(context, bugreportFile, screenshotFile); } else { - notifIntent = sendIntent; + // Asynchronously zip the file first, then send it. + sendZippedBugreportNotification(context, bugreportFile, screenshotFile); } - notifIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - - final Notification.Builder builder = new Notification.Builder(context) - .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) - .setContentTitle(context.getString(R.string.bugreport_finished_title)) - .setTicker(context.getString(R.string.bugreport_finished_title)) - .setContentText(context.getString(R.string.bugreport_finished_text)) - .setContentIntent(PendingIntent.getActivity( - context, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT)) - .setAutoCancel(true) - .setLocalOnly(true) - .setColor(context.getColor( - com.android.internal.R.color.system_notification_accent_color)); - - NotificationManager.from(context).notify(TAG, 0, builder.build()); // Clean up older bugreports in background final PendingResult result = goAsync(); @@ -141,6 +137,88 @@ public class BugreportReceiver extends BroadcastReceiver { } /** + * Sends a bugreport notitication. + */ + private static void sendBugreportNotification(Context context, File bugreportFile, + File screenshotFile) { + // Files are kept on private storage, so turn into Uris that we can + // grant temporary permissions for. + final Uri bugreportUri = FileProvider.getUriForFile(context, AUTHORITY, bugreportFile); + final Uri screenshotUri = FileProvider.getUriForFile(context, AUTHORITY, screenshotFile); + + Intent sendIntent = buildSendIntent(context, bugreportUri, screenshotUri); + Intent notifIntent; + + // Send through warning dialog by default + if (getWarningState(context, STATE_SHOW) == STATE_SHOW) { + notifIntent = buildWarningIntent(context, sendIntent); + } else { + notifIntent = sendIntent; + } + notifIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + + final Notification.Builder builder = new Notification.Builder(context) + .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) + .setContentTitle(context.getString(R.string.bugreport_finished_title)) + .setTicker(context.getString(R.string.bugreport_finished_title)) + .setContentText(context.getString(R.string.bugreport_finished_text)) + .setContentIntent(PendingIntent.getActivity( + context, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT)) + .setAutoCancel(true) + .setLocalOnly(true) + .setColor(context.getColor( + com.android.internal.R.color.system_notification_accent_color)); + + NotificationManager.from(context).notify(TAG, 0, builder.build()); + } + + /** + * Sends a zipped bugreport notification. + */ + private static void sendZippedBugreportNotification(final Context context, + final File bugreportFile, final File screenshotFile) { + new AsyncTask<Void, Void, Void>() { + @Override + protected Void doInBackground(Void... params) { + File zippedFile = zipBugreport(bugreportFile); + sendBugreportNotification(context, zippedFile, screenshotFile); + return null; + } + }.execute(); + } + + /** + * Zips a bugreport file, returning the path to the new file (or to the + * original in case of failure). + */ + private static File zipBugreport(File bugreportFile) { + String bugreportPath = bugreportFile.getAbsolutePath(); + String zippedPath = bugreportPath.replace(".txt", ".zip"); + Log.v(TAG, "zipping " + bugreportPath + " as " + zippedPath); + File bugreportZippedFile = new File(zippedPath); + try (InputStream is = new FileInputStream(bugreportFile); + ZipOutputStream zos = new ZipOutputStream( + new BufferedOutputStream(new FileOutputStream(bugreportZippedFile)))) { + ZipEntry entry = new ZipEntry("bugreport.txt"); + zos.putNextEntry(entry); + int totalBytes = Streams.copy(is, zos); + Log.v(TAG, "size of original bugreport: " + totalBytes + " bytes"); + zos.closeEntry(); + // Delete old file; + boolean deleted = bugreportFile.delete(); + if (deleted) { + Log.v(TAG, "deleted original bugreport (" + bugreportPath + ")"); + } else { + Log.e(TAG, "could not delete original bugreport (" + bugreportPath + ")"); + } + return bugreportZippedFile; + } catch (IOException e) { + Log.e(TAG, "exception zipping file " + zippedPath, e); + return bugreportFile; // Return original. + } + } + + /** * Find the best matching {@link Account} based on build properties. */ private static Account findSendToAccount(Context context) { diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 1e7ee98..445ecb6 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -16,7 +16,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; -import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; @@ -28,12 +27,15 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ImageView; -import com.android.internal.app.IVoiceInteractionManagerService; +import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.systemui.R; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.phone.PhoneStatusBar; +import java.io.FileDescriptor; +import java.io.PrintWriter; + /** * Class to manage everything related to assist in SystemUI. */ @@ -55,7 +57,7 @@ public class AssistManager { private final WindowManager mWindowManager; private AssistOrbContainer mView; private final PhoneStatusBar mBar; - private final IVoiceInteractionManagerService mVoiceInteractionManagerService; + private final AssistUtils mAssistUtils; private ComponentName mAssistComponent; @@ -92,8 +94,7 @@ public class AssistManager { mContext = context; mBar = bar; mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); - mVoiceInteractionManagerService = IVoiceInteractionManagerService.Stub.asInterface( - ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE)); + mAssistUtils = new AssistUtils(context); mContext.getContentResolver().registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false, @@ -140,11 +141,7 @@ public class AssistManager { } public void hideAssist() { - try { - mVoiceInteractionManagerService.hideCurrentSession(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call hideCurrentSession", e); - } + mAssistUtils.hideCurrentSession(); } private WindowManager.LayoutParams getLayoutParams() { @@ -216,58 +213,27 @@ public class AssistManager { } private void startVoiceInteractor() { - try { - mVoiceInteractionManagerService.showSessionForActiveService(mShowCallback); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call showSessionForActiveService", e); - } + mAssistUtils.showSessionForActiveService(mShowCallback); } public void launchVoiceAssistFromKeyguard() { - try { - mVoiceInteractionManagerService.launchVoiceAssistFromKeyguard(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call launchVoiceAssistFromKeyguard", e); - } + mAssistUtils.launchVoiceAssistFromKeyguard(); } private boolean getVoiceInteractorSupportsAssistGesture() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.activeServiceSupportsAssist(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call activeServiceSupportsAssistGesture", e); - return false; - } + return mAssistUtils.activeServiceSupportsAssistGesture(); } public boolean canVoiceAssistBeLaunchedFromKeyguard() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.activeServiceSupportsLaunchFromKeyguard(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call activeServiceSupportsLaunchFromKeyguard", e); - return false; - } + return mAssistUtils.activeServiceSupportsLaunchFromKeyguard(); } public ComponentName getVoiceInteractorComponentName() { - try { - return mVoiceInteractionManagerService.getActiveServiceComponentName(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call getActiveServiceComponentName", e); - return null; - } + return mAssistUtils.getActiveServiceComponentName(); } private boolean isVoiceSessionRunning() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.isSessionRunning(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call isSessionRunning", e); - return false; - } + return mAssistUtils.isSessionRunning(); } public void destroy() { @@ -324,26 +290,11 @@ public class AssistManager { } private void updateAssistInfo() { - final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(), - Settings.Secure.ASSISTANT, UserHandle.USER_CURRENT); - if (setting != null) { - mAssistComponent = ComponentName.unflattenFromString(setting); - return; - } - - // Fallback to keep backward compatible behavior when there is no user setting. - if (getVoiceInteractorSupportsAssistGesture()) { - mAssistComponent = getVoiceInteractorComponentName(); - return; - } - - Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) - .getAssistIntent(mContext, false, UserHandle.USER_CURRENT); - if (intent != null) { - mAssistComponent = intent.getComponent(); - return; - } + mAssistComponent = mAssistUtils.getAssistComponentForUser(UserHandle.USER_CURRENT); + } - mAssistComponent = null; + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + pw.println("AssistManager state:"); + pw.print(" mAssistComponent="); pw.println(mAssistComponent); } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index f00fed5..c06b34f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -371,7 +371,6 @@ public class KeyguardViewMediator extends SystemUI { @Override public void onDeviceProvisioned() { sendUserPresentBroadcast(); - updateInputRestricted(); } @Override @@ -947,7 +946,7 @@ public class KeyguardViewMediator extends SystemUI { * was suppressed by an app that disabled the keyguard or we haven't been provisioned yet. */ public boolean isInputRestricted() { - return mShowing || mNeedToReshowWhenReenabled || shouldWaitForProvisioning(); + return mShowing || mNeedToReshowWhenReenabled; } private void updateInputRestricted() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index c8212c2..9761cd1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -242,6 +242,9 @@ public class QSPanel extends ViewGroup { } private void handleSetTileVisibility(View v, int visibility) { + if (visibility == VISIBLE && !mGridContentVisible) { + visibility = INVISIBLE; + } if (visibility == v.getVisibility()) return; v.setVisibility(visibility); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index a750572..5ac436a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -1180,7 +1180,9 @@ public class NotificationPanelView extends PanelView implements } else if (statusBarState == StatusBarState.KEYGUARD || statusBarState == StatusBarState.SHADE_LOCKED) { mKeyguardBottomArea.animate().cancel(); - mKeyguardBottomArea.setVisibility(View.VISIBLE); + if (!mDozing) { + mKeyguardBottomArea.setVisibility(View.VISIBLE); + } mKeyguardBottomArea.setAlpha(1f); } else { mKeyguardBottomArea.animate().cancel(); @@ -1263,7 +1265,7 @@ public class NotificationPanelView extends PanelView implements setQsExpanded(true); } else if (height <= mQsMinExpansionHeight && mQsExpanded) { setQsExpanded(false); - if (mLastAnnouncementWasQuickSettings && !mTracking) { + if (mLastAnnouncementWasQuickSettings && !mTracking && !isCollapsing()) { announceForAccessibility(getKeyguardOrLockScreenString()); mLastAnnouncementWasQuickSettings = false; } @@ -1717,7 +1719,8 @@ public class NotificationPanelView extends PanelView implements float alphaQsExpansion = 1 - Math.min(1, getQsExpansionFraction() * 2); mKeyguardStatusBar.setAlpha(Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) * mKeyguardStatusBarAnimateAlpha); - mKeyguardStatusBar.setVisibility(mKeyguardStatusBar.getAlpha() != 0f ? VISIBLE : INVISIBLE); + mKeyguardStatusBar.setVisibility(mKeyguardStatusBar.getAlpha() != 0f + && !mDozing ? VISIBLE : INVISIBLE); setQsTranslation(mQsExpansionHeight); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index c77e7f0..69198ed 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -2687,6 +2687,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (mNextAlarmController != null) { mNextAlarmController.dump(fd, pw, args); } + if (mAssistManager != null) { + mAssistManager.dump(fd, pw, args); + } if (mSecurityController != null) { mSecurityController.dump(fd, pw, args); } diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index f645764..82399da 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -960,44 +960,6 @@ public class ConnectivityService extends IConnectivityManager.Stub return nai != null ? nai.network : null; } - /** - * Find the first Provisioning network. - * - * @return NetworkInfo or null if none. - */ - private NetworkInfo getProvisioningNetworkInfo() { - enforceAccessPermission(); - - // Find the first Provisioning Network - NetworkInfo provNi = null; - for (NetworkInfo ni : getAllNetworkInfo()) { - if (ni.isConnectedToProvisioningNetwork()) { - provNi = ni; - break; - } - } - if (DBG) log("getProvisioningNetworkInfo: X provNi=" + provNi); - return provNi; - } - - /** - * Find the first Provisioning network or the ActiveDefaultNetwork - * if there is no Provisioning network - * - * @return NetworkInfo or null if none. - */ - @Override - public NetworkInfo getProvisioningOrActiveNetworkInfo() { - enforceAccessPermission(); - - NetworkInfo provNi = getProvisioningNetworkInfo(); - if (provNi == null) { - provNi = getActiveNetworkInfo(); - } - if (DBG) log("getProvisioningOrActiveNetworkInfo: X provNi=" + provNi); - return provNi; - } - public NetworkInfo getActiveNetworkInfoUnfiltered() { enforceAccessPermission(); final int uid = Binder.getCallingUid(); @@ -1567,14 +1529,6 @@ public class ConnectivityService extends IConnectivityManager.Stub } }; - /** @hide */ - @Override - public void captivePortalCheckCompleted(NetworkInfo info, boolean isCaptivePortal) { - enforceConnectivityInternalPermission(); - if (DBG) log("captivePortalCheckCompleted: ni=" + info + " captive=" + isCaptivePortal); -// mNetTrackers[info.getType()].captivePortalCheckCompleted(isCaptivePortal); - } - /** * Setup data activity tracking for the given network. * @@ -3357,7 +3311,6 @@ public class ConnectivityService extends IConnectivityManager.Stub * <?xml version="1.0" encoding="utf-8"?> * <provisioningUrls> * <provisioningUrl mcc="310" mnc="4">http://myserver.com/foo?mdn=%3$s&iccid=%1$s&imei=%2$s</provisioningUrl> - * <redirectedUrl mcc="310" mnc="4">http://www.google.com</redirectedUrl> * </provisioningUrls> */ private static final String PROVISIONING_URL_PATH = @@ -3368,33 +3321,15 @@ public class ConnectivityService extends IConnectivityManager.Stub private static final String TAG_PROVISIONING_URLS = "provisioningUrls"; /** XML tag for individual url */ private static final String TAG_PROVISIONING_URL = "provisioningUrl"; - /** XML tag for redirected url */ - private static final String TAG_REDIRECTED_URL = "redirectedUrl"; /** XML attribute for mcc */ private static final String ATTR_MCC = "mcc"; /** XML attribute for mnc */ private static final String ATTR_MNC = "mnc"; - private static final int REDIRECTED_PROVISIONING = 1; - private static final int PROVISIONING = 2; - - private String getProvisioningUrlBaseFromFile(int type) { + private String getProvisioningUrlBaseFromFile() { FileReader fileReader = null; XmlPullParser parser = null; Configuration config = mContext.getResources().getConfiguration(); - String tagType; - - switch (type) { - case PROVISIONING: - tagType = TAG_PROVISIONING_URL; - break; - case REDIRECTED_PROVISIONING: - tagType = TAG_REDIRECTED_URL; - break; - default: - throw new RuntimeException("getProvisioningUrlBaseFromFile: Unexpected parameter " + - type); - } try { fileReader = new FileReader(mProvisioningUrlFile); @@ -3408,7 +3343,7 @@ public class ConnectivityService extends IConnectivityManager.Stub String element = parser.getName(); if (element == null) break; - if (element.equals(tagType)) { + if (element.equals(TAG_PROVISIONING_URL)) { String mcc = parser.getAttributeValue(null, ATTR_MCC); try { if (mcc != null && Integer.parseInt(mcc) == config.mcc) { @@ -3443,19 +3378,9 @@ public class ConnectivityService extends IConnectivityManager.Stub } @Override - public String getMobileRedirectedProvisioningUrl() { - enforceConnectivityInternalPermission(); - String url = getProvisioningUrlBaseFromFile(REDIRECTED_PROVISIONING); - if (TextUtils.isEmpty(url)) { - url = mContext.getResources().getString(R.string.mobile_redirected_provisioning_url); - } - return url; - } - - @Override public String getMobileProvisioningUrl() { enforceConnectivityInternalPermission(); - String url = getProvisioningUrlBaseFromFile(PROVISIONING); + String url = getProvisioningUrlBaseFromFile(); if (TextUtils.isEmpty(url)) { url = mContext.getResources().getString(R.string.mobile_provisioning_url); log("getMobileProvisioningUrl: mobile_provisioining_url from resource =" + url); diff --git a/services/core/java/com/android/server/IntentResolver.java b/services/core/java/com/android/server/IntentResolver.java index 744156b..3359060 100644 --- a/services/core/java/com/android/server/IntentResolver.java +++ b/services/core/java/com/android/server/IntentResolver.java @@ -731,6 +731,10 @@ public abstract class IntentResolver<F extends IntentFilter, R extends Object> { if (filter.getAutoVerify()) { if (localVerificationLOGV || debug) { Slog.v(TAG, " Filter verified: " + isFilterVerified(filter)); + int authorities = filter.countDataAuthorities(); + for (int z = 0; z < authorities; z++) { + Slog.v(TAG, " " + filter.getDataAuthority(z).getHost()); + } } } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 421ba86..b262442 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -31,7 +31,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.*; import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID; import static com.android.server.am.TaskRecord.INVALID_TASK_ID; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_DONT_LOCK; -import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_LAUNCHABLE; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_LAUNCHABLE_PRIV; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_PINNABLE; import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT; @@ -5267,7 +5266,7 @@ public final class ActivityManagerService extends ActivityManagerNative } int callerUid = Binder.getCallingUid(); // Only the system server can kill an application - if (callerUid == Process.SYSTEM_UID) { + if (UserHandle.getAppId(callerUid) == Process.SYSTEM_UID) { // Post an aysnc message to kill the application Message msg = mHandler.obtainMessage(KILL_APPLICATION_MSG); msg.arg1 = appid; @@ -10338,11 +10337,12 @@ public final class ActivityManagerService extends ActivityManagerNative void startRunningVoiceLocked(IVoiceInteractionSession session, int targetUid) { mVoiceWakeLock.setWorkSource(new WorkSource(targetUid)); if (mRunningVoice == null || mRunningVoice.asBinder() != session.asBinder()) { - if (mRunningVoice == null) { + boolean wasRunningVoice = mRunningVoice != null; + mRunningVoice = session; + if (!wasRunningVoice) { mVoiceWakeLock.acquire(); updateSleepIfNeededLocked(); } - mRunningVoice = session; } } @@ -18595,29 +18595,24 @@ public final class ActivityManagerService extends ActivityManagerNative return; } boolean isInteraction; - if (!mSleeping) { - isInteraction = app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; + // To avoid some abuse patterns, we are going to be careful about what we consider + // to be an app interaction. Being the top activity doesn't count while the display + // is sleeping, nor do short foreground services. + if (app.curProcState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE) { + isInteraction = true; app.fgInteractionTime = 0; - } else { - // If the display is off, we are going to be more restrictive about what we consider - // to be an app interaction. Being the top activity doesn't count, nor do generally - // foreground services. - if (app.curProcState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE) { - isInteraction = true; - app.fgInteractionTime = 0; - } else if (app.curProcState <= ActivityManager.PROCESS_STATE_TOP_SLEEPING) { - final long now = SystemClock.elapsedRealtime(); - if (app.fgInteractionTime == 0) { - app.fgInteractionTime = now; - isInteraction = false; - } else { - isInteraction = now > app.fgInteractionTime + SERVICE_USAGE_INTERACTION_TIME; - } + } else if (app.curProcState <= ActivityManager.PROCESS_STATE_TOP_SLEEPING) { + final long now = SystemClock.elapsedRealtime(); + if (app.fgInteractionTime == 0) { + app.fgInteractionTime = now; + isInteraction = false; } else { - isInteraction = app.curProcState - <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; - app.fgInteractionTime = 0; + isInteraction = now > app.fgInteractionTime + SERVICE_USAGE_INTERACTION_TIME; } + } else { + isInteraction = app.curProcState + <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; + app.fgInteractionTime = 0; } if (isInteraction && !app.reportedInteraction) { String[] packages = app.getPackageList(); diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java index b56e326..c973386 100644 --- a/services/core/java/com/android/server/am/BatteryStatsService.java +++ b/services/core/java/com/android/server/am/BatteryStatsService.java @@ -1167,6 +1167,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub BluetoothActivityEnergyInfo info = adapter.getControllerActivityEnergyInfo( BluetoothAdapter.ACTIVITY_ENERGY_INFO_REFRESHED); if (info != null && info.isValid()) { + if (info.getControllerEnergyUsed() < 0 || info.getControllerIdleTimeMillis() < 0 || + info.getControllerRxTimeMillis() < 0 || info.getControllerTxTimeMillis() < 0) { + Slog.wtf(TAG, "Bluetooth energy data is invalid: " + info); + } return info; } } diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index 7f0be57..c52a1c1 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -33,6 +33,7 @@ import android.os.MessageQueue; import android.os.RemoteException; import android.os.SELinux; import android.os.ServiceManager; +import android.os.UserHandle; import android.util.Slog; import com.android.server.SystemService; @@ -389,12 +390,12 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe } } - public List<Fingerprint> getEnrolledFingerprints(int groupId) { - return mFingerprintUtils.getFingerprintsForUser(mContext, groupId); + public List<Fingerprint> getEnrolledFingerprints(int userId) { + return mFingerprintUtils.getFingerprintsForUser(mContext, userId); } - public boolean hasEnrolledFingerprints(int groupId) { - return mFingerprintUtils.getFingerprintsForUser(mContext, groupId).size() > 0; + public boolean hasEnrolledFingerprints(int userId) { + return mFingerprintUtils.getFingerprintsForUser(mContext, userId).size() > 0; } boolean hasPermission(String permission) { @@ -598,6 +599,15 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe public void enroll(final IBinder token, final byte[] cryptoToken, final int groupId, final IFingerprintServiceReceiver receiver, final int flags) { checkPermission(MANAGE_FINGERPRINT); + final int limit = mContext.getResources().getInteger( + com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser); + final int callingUid = Binder.getCallingUid(); + final int userId = UserHandle.getUserId(callingUid); + final int enrolled = FingerprintService.this.getEnrolledFingerprints(userId).size(); + if (enrolled >= limit) { + Slog.w(TAG, "Too many fingerprints registered"); + return; + } final byte [] cryptoClone = Arrays.copyOf(cryptoToken, cryptoToken.length); final boolean restricted = isRestricted(); @@ -689,11 +699,11 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe } @Override // Binder call - public List<Fingerprint> getEnrolledFingerprints(int groupId, String opPackageName) { + public List<Fingerprint> getEnrolledFingerprints(int userId, String opPackageName) { if (!canUseFingerprint(opPackageName)) { return Collections.emptyList(); } - return FingerprintService.this.getEnrolledFingerprints(groupId); + return FingerprintService.this.getEnrolledFingerprints(userId); } @Override // Binder call diff --git a/services/core/java/com/android/server/notification/ValidateNotificationPeople.java b/services/core/java/com/android/server/notification/ValidateNotificationPeople.java index 10f1696..4af7d4e 100644 --- a/services/core/java/com/android/server/notification/ValidateNotificationPeople.java +++ b/services/core/java/com/android/server/notification/ValidateNotificationPeople.java @@ -51,7 +51,7 @@ import java.util.concurrent.TimeUnit; public class ValidateNotificationPeople implements NotificationSignalExtractor { // Using a shorter log tag since setprop has a limit of 32chars on variable name. private static final String TAG = "ValidateNoPeople"; - private static final boolean INFO = true; + private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final boolean ENABLE_PEOPLE_VALIDATOR = true; @@ -100,7 +100,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor { public void onChange(boolean selfChange, Uri uri, int userId) { super.onChange(selfChange, uri, userId); if (DEBUG || mEvictionCount % 100 == 0) { - if (INFO) Slog.i(TAG, "mEvictionCount: " + mEvictionCount); + if (VERBOSE) Slog.i(TAG, "mEvictionCount: " + mEvictionCount); } mPeopleCache.evictAll(); mEvictionCount++; @@ -113,20 +113,20 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor { public RankingReconsideration process(NotificationRecord record) { if (!mEnabled) { - if (INFO) Slog.i(TAG, "disabled"); + if (VERBOSE) Slog.i(TAG, "disabled"); return null; } if (record == null || record.getNotification() == null) { - if (INFO) Slog.i(TAG, "skipping empty notification"); + if (VERBOSE) Slog.i(TAG, "skipping empty notification"); return null; } if (record.getUserId() == UserHandle.USER_ALL) { - if (INFO) Slog.i(TAG, "skipping global notification"); + if (VERBOSE) Slog.i(TAG, "skipping global notification"); return null; } Context context = getContextAsUser(record.getUser()); if (context == null) { - if (INFO) Slog.i(TAG, "skipping notification that lacks a context"); + if (VERBOSE) Slog.i(TAG, "skipping notification that lacks a context"); return null; } return validatePeople(context, record); @@ -220,7 +220,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor { return null; } - if (INFO) Slog.i(TAG, "Validating: " + key + " for " + context.getUserId()); + if (VERBOSE) Slog.i(TAG, "Validating: " + key + " for " + context.getUserId()); final LinkedList<String> pendingLookups = new LinkedList<String>(); for (int personIdx = 0; personIdx < people.length && personIdx < MAX_PEOPLE; personIdx++) { final String handle = people[personIdx]; @@ -244,7 +244,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor { affinityOut[0] = affinity; if (pendingLookups.isEmpty()) { - if (INFO) Slog.i(TAG, "final affinity: " + affinity); + if (VERBOSE) Slog.i(TAG, "final affinity: " + affinity); if (affinity != NONE) MetricsLogger.count(mBaseContext, "note_with_people", 1); return null; } @@ -422,7 +422,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor { @Override public void work() { - if (INFO) Slog.i(TAG, "Executing: validation for: " + mKey); + if (VERBOSE) Slog.i(TAG, "Executing: validation for: " + mKey); long timeStartMs = System.currentTimeMillis(); for (final String handle: mPendingLookups) { LookupResult lookupResult = null; @@ -463,7 +463,7 @@ public class ValidateNotificationPeople implements NotificationSignalExtractor { public void applyChangesLocked(NotificationRecord operand) { float affinityBound = operand.getContactAffinity(); operand.setContactAffinity(Math.max(mContactAffinity, affinityBound)); - if (INFO) Slog.i(TAG, "final affinity: " + operand.getContactAffinity()); + if (VERBOSE) Slog.i(TAG, "final affinity: " + operand.getContactAffinity()); } public float getContactAffinity() { diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index a24bd52..548d93c 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -268,6 +268,7 @@ public class PackageManagerService extends IPackageManager.Stub { static final boolean DEBUG_SETTINGS = false; static final boolean DEBUG_PREFERRED = false; static final boolean DEBUG_UPGRADE = false; + static final boolean DEBUG_DOMAIN_VERIFICATION = false; private static final boolean DEBUG_BACKUP = true; private static final boolean DEBUG_INSTALL = false; private static final boolean DEBUG_REMOVE = false; @@ -279,7 +280,6 @@ public class PackageManagerService extends IPackageManager.Stub { private static final boolean DEBUG_VERIFY = false; private static final boolean DEBUG_DEXOPT = false; private static final boolean DEBUG_ABI_SELECTION = false; - private static final boolean DEBUG_DOMAIN_VERIFICATION = false; private static final int RADIO_UID = Process.PHONE_UID; private static final int LOG_UID = Process.LOG_UID; @@ -11818,50 +11818,45 @@ public class PackageManagerService extends IPackageManager.Stub { final int verificationId = mIntentFilterVerificationToken++; int count = 0; final String packageName = pkg.packageName; - ArrayList<String> allHosts = new ArrayList<>(); + boolean needToVerify = false; synchronized (mPackages) { + // If any filters need to be verified, then all need to be. for (PackageParser.Activity a : pkg.activities) { for (ActivityIntentInfo filter : a.intents) { - boolean needsFilterVerification = filter.needsVerification(); - if (needsFilterVerification && needsNetworkVerificationLPr(filter)) { - if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, - "Verification needed for IntentFilter:" + filter.toString()); - mIntentFilterVerifier.addOneIntentFilterVerification( - verifierUid, userId, verificationId, filter, packageName); - count++; - } else if (!needsFilterVerification) { - if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, - "No verification needed for IntentFilter:" + filter.toString()); - if (hasValidDomains(filter)) { - ArrayList<String> hosts = filter.getHostsList(); - if (hosts.size() > 0) { - allHosts.addAll(hosts); - } else { - if (allHosts.isEmpty()) { - allHosts.add("*"); - } - } + if (filter.needsVerification() && needsNetworkVerificationLPr(filter)) { + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.d(TAG, "Intent filter needs verification, so processing all filters"); + } + needToVerify = true; + break; + } + } + } + if (needToVerify) { + for (PackageParser.Activity a : pkg.activities) { + for (ActivityIntentInfo filter : a.intents) { + boolean needsFilterVerification = filter.hasWebDataURI(); + if (needsFilterVerification && needsNetworkVerificationLPr(filter)) { + if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, + "Verification needed for IntentFilter:" + filter.toString()); + mIntentFilterVerifier.addOneIntentFilterVerification( + verifierUid, userId, verificationId, filter, packageName); + count++; } - } else { - if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, - "Verification already done for IntentFilter:" + filter.toString()); } } } } if (count > 0) { - mIntentFilterVerifier.startVerifications(userId); - if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Started " + count + if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Starting " + count + " IntentFilter verification" + (count > 1 ? "s" : "") - + " for userId:" + userId + "!"); + + " for userId:" + userId); + mIntentFilterVerifier.startVerifications(userId); } else { - if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, - "No need to start any IntentFilter verification!"); - if (allHosts.size() > 0 && mSettings.createIntentFilterVerificationIfNeededLPw( - packageName, allHosts) != null) { - scheduleWriteSettingsLocked(); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.d(TAG, "No filters or not all autoVerify for " + packageName); } } } diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 8f2db30..cd50946 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -27,6 +27,7 @@ import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATIO import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED; import static android.os.Process.SYSTEM_UID; import static android.os.Process.PACKAGE_INFO_GID; +import static com.android.server.pm.PackageManagerService.DEBUG_DOMAIN_VERIFICATION; import android.content.IntentFilter; import android.content.pm.ActivityInfo; @@ -977,7 +978,9 @@ final class Settings { IntentFilterVerificationInfo getIntentFilterVerificationLPr(String packageName) { PackageSetting ps = mPackages.get(packageName); if (ps == null) { - Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.w(PackageManagerService.TAG, "No package known: " + packageName); + } return null; } return ps.getIntentFilterVerificationInfo(); @@ -988,20 +991,26 @@ final class Settings { ArrayList<String> domains) { PackageSetting ps = mPackages.get(packageName); if (ps == null) { - Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.w(PackageManagerService.TAG, "No package known: " + packageName); + } return null; } IntentFilterVerificationInfo ivi = ps.getIntentFilterVerificationInfo(); if (ivi == null) { ivi = new IntentFilterVerificationInfo(packageName, domains); ps.setIntentFilterVerificationInfo(ivi); - Slog.d(PackageManagerService.TAG, - "Creating new IntentFilterVerificationInfo for packageName: " + packageName); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.d(PackageManagerService.TAG, + "Creating new IntentFilterVerificationInfo for pkg: " + packageName); + } } else { ivi.setDomains(domains); - Slog.d(PackageManagerService.TAG, - "Setting domains to existing IntentFilterVerificationInfo for packageName: " + - packageName + " and with domains: " + ivi.getDomainsString()); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.d(PackageManagerService.TAG, + "Setting domains to existing IntentFilterVerificationInfo for pkg: " + + packageName + " and with domains: " + ivi.getDomainsString()); + } } return ivi; } @@ -1009,7 +1018,9 @@ final class Settings { int getIntentFilterVerificationStatusLPr(String packageName, int userId) { PackageSetting ps = mPackages.get(packageName); if (ps == null) { - Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.w(PackageManagerService.TAG, "No package known: " + packageName); + } return INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED; } int status = ps.getDomainVerificationStatusForUser(userId); @@ -1025,14 +1036,18 @@ final class Settings { // Update the status for the current package PackageSetting current = mPackages.get(packageName); if (current == null) { - Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.w(PackageManagerService.TAG, "No package known: " + packageName); + } return false; } current.setDomainVerificationStatusForUser(status, userId); if (current.getIntentFilterVerificationInfo() == null) { - Slog.w(PackageManagerService.TAG, - "No IntentFilterVerificationInfo known for name: " + packageName); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.w(PackageManagerService.TAG, + "No IntentFilterVerificationInfo known: " + packageName); + } return false; } @@ -1080,7 +1095,9 @@ final class Settings { boolean removeIntentFilterVerificationLPw(String packageName, int userId) { PackageSetting ps = mPackages.get(packageName); if (ps == null) { - Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.w(PackageManagerService.TAG, "No package known: " + packageName); + } return false; } ps.clearDomainVerificationStatusForUser(userId); @@ -1549,8 +1566,10 @@ final class Settings { if (verificationInfo != null && verificationInfo.getPackageName() != null) { serializer.startTag(null, TAG_DOMAIN_VERIFICATION); verificationInfo.writeToXml(serializer); - Log.d(TAG, "Wrote domain verification for package: " - + verificationInfo.getPackageName()); + if (DEBUG_DOMAIN_VERIFICATION) { + Slog.d(TAG, "Wrote domain verification for package: " + + verificationInfo.getPackageName()); + } serializer.endTag(null, TAG_DOMAIN_VERIFICATION); } } diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index 095b7d7..4082ff3 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -966,6 +966,7 @@ public class UserManagerService extends IUserManager.Stub { writeBoolean(serializer, restrictions, UserManager.DISALLOW_ADJUST_VOLUME); writeBoolean(serializer, restrictions, UserManager.DISALLOW_OUTGOING_CALLS); writeBoolean(serializer, restrictions, UserManager.DISALLOW_SMS); + writeBoolean(serializer, restrictions, UserManager.DISALLOW_FUN); writeBoolean(serializer, restrictions, UserManager.DISALLOW_CREATE_WINDOWS); writeBoolean(serializer, restrictions, UserManager.DISALLOW_CROSS_PROFILE_COPY_PASTE); writeBoolean(serializer, restrictions, UserManager.DISALLOW_OUTGOING_BEAM); @@ -1096,6 +1097,7 @@ public class UserManagerService extends IUserManager.Stub { readBoolean(parser, restrictions, UserManager.DISALLOW_ADJUST_VOLUME); readBoolean(parser, restrictions, UserManager.DISALLOW_OUTGOING_CALLS); readBoolean(parser, restrictions, UserManager.DISALLOW_SMS); + readBoolean(parser, restrictions, UserManager.DISALLOW_FUN); readBoolean(parser, restrictions, UserManager.DISALLOW_CREATE_WINDOWS); readBoolean(parser, restrictions, UserManager.DISALLOW_CROSS_PROFILE_COPY_PASTE); readBoolean(parser, restrictions, UserManager.DISALLOW_OUTGOING_BEAM); diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index ea66a04..f1f61f3 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -209,6 +209,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_UNMUTE_MICROPHONE); DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_ADJUST_VOLUME); DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_SMS); + DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_FUN); DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_SAFE_BOOT); } diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java index b0fca95..fafe44a 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java @@ -853,7 +853,38 @@ public class VoiceInteractionManagerService extends SystemService { PackageMonitor mPackageMonitor = new PackageMonitor() { @Override public boolean onHandleForceStop(Intent intent, String[] packages, int uid, boolean doit) { - return super.onHandleForceStop(intent, packages, uid, doit); + if (DEBUG) Slog.d(TAG, "onHandleForceStop uid=" + uid + " doit=" + doit); + + int userHandle = UserHandle.getUserId(uid); + ComponentName curInteractor = getCurInteractor(userHandle); + ComponentName curRecognizer = getCurRecognizer(userHandle); + boolean hit = false; + for (String pkg : packages) { + if (curInteractor != null && pkg.equals(curInteractor.getPackageName())) { + hit = true; + break; + } else if (curRecognizer != null + && pkg.equals(curRecognizer.getPackageName())) { + hit = true; + break; + } + } + if (hit && doit) { + // The user is force stopping our current interactor/recognizer. + // Clear the current settings and restore default state. + synchronized (VoiceInteractionManagerService.this) { + mSoundTriggerHelper.stopAllRecognitions(); + if (mImpl != null) { + mImpl.shutdownLocked(); + mImpl = null; + } + setCurInteractor(null, userHandle); + setCurRecognizer(null, userHandle); + initForUser(userHandle); + switchImplementationIfNeededLocked(true); + } + } + return hit; } @Override @@ -865,51 +896,53 @@ public class VoiceInteractionManagerService extends SystemService { int userHandle = getChangingUserId(); if (DEBUG) Slog.d(TAG, "onSomePackagesChanged user=" + userHandle); - ComponentName curInteractor = getCurInteractor(userHandle); - ComponentName curRecognizer = getCurRecognizer(userHandle); - if (curRecognizer == null) { - // Could a new recognizer appear when we don't have one pre-installed? - if (anyPackagesAppearing()) { - curRecognizer = findAvailRecognizer(null, userHandle); - if (curRecognizer != null) { - setCurRecognizer(curRecognizer, userHandle); + synchronized (VoiceInteractionManagerService.this) { + ComponentName curInteractor = getCurInteractor(userHandle); + ComponentName curRecognizer = getCurRecognizer(userHandle); + if (curRecognizer == null) { + // Could a new recognizer appear when we don't have one pre-installed? + if (anyPackagesAppearing()) { + curRecognizer = findAvailRecognizer(null, userHandle); + if (curRecognizer != null) { + setCurRecognizer(curRecognizer, userHandle); + } } - } - return; - } - - if (curInteractor != null) { - int change = isPackageDisappearing(curInteractor.getPackageName()); - if (change == PACKAGE_PERMANENT_CHANGE) { - // The currently set interactor is permanently gone; fall back to - // the default config. - setCurInteractor(null, userHandle); - setCurRecognizer(null, userHandle); - initForUser(userHandle); return; } - change = isPackageAppearing(curInteractor.getPackageName()); - if (change != PACKAGE_UNCHANGED) { - // If current interactor is now appearing, for any reason, then - // restart our connection with it. - if (mImpl != null && curInteractor.getPackageName().equals( - mImpl.mComponent.getPackageName())) { - switchImplementationIfNeededLocked(true); + if (curInteractor != null) { + int change = isPackageDisappearing(curInteractor.getPackageName()); + if (change == PACKAGE_PERMANENT_CHANGE) { + // The currently set interactor is permanently gone; fall back to + // the default config. + setCurInteractor(null, userHandle); + setCurRecognizer(null, userHandle); + initForUser(userHandle); + return; + } + + change = isPackageAppearing(curInteractor.getPackageName()); + if (change != PACKAGE_UNCHANGED) { + // If current interactor is now appearing, for any reason, then + // restart our connection with it. + if (mImpl != null && curInteractor.getPackageName().equals( + mImpl.mComponent.getPackageName())) { + switchImplementationIfNeededLocked(true); + } } + return; } - return; - } - // There is no interactor, so just deal with a simple recognizer. - int change = isPackageDisappearing(curRecognizer.getPackageName()); - if (change == PACKAGE_PERMANENT_CHANGE - || change == PACKAGE_TEMPORARY_CHANGE) { - setCurRecognizer(findAvailRecognizer(null, userHandle), userHandle); + // There is no interactor, so just deal with a simple recognizer. + int change = isPackageDisappearing(curRecognizer.getPackageName()); + if (change == PACKAGE_PERMANENT_CHANGE + || change == PACKAGE_TEMPORARY_CHANGE) { + setCurRecognizer(findAvailRecognizer(null, userHandle), userHandle); - } else if (isPackageModified(curRecognizer.getPackageName())) { - setCurRecognizer(findAvailRecognizer(curRecognizer.getPackageName(), - userHandle), userHandle); + } else if (isPackageModified(curRecognizer.getPackageName())) { + setCurRecognizer(findAvailRecognizer(curRecognizer.getPackageName(), + userHandle), userHandle); + } } } }; diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 7303298..bcfee30 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -84,7 +84,7 @@ public class CarrierConfigManager { * from config.xml under apps/Contacts. */ public static final String - KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "key_enable_dialer_vibration_bool"; + KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_vibration_bool"; /** Flag indicating if dtmf tone type is enabled */ public static final String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool"; @@ -185,6 +185,13 @@ public class CarrierConfigManager { */ public static final String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool"; + /** + * Flag specifying whether WFC over IMS should be available for carrier: independent of + * carrier provisioning. If false: hard disabled. If true: then depends on carrier + * provisioning, availability etc. + */ + public static final String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool"; + /** Flag specifying whether VoLTE availability is based on provisioning. */ public static final String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool"; @@ -200,6 +207,13 @@ public class CarrierConfigManager { */ public static final String KEY_VOLTE_REPLACEMENT_RAT_INT = "volte_replacement_rat_int"; + /** + * The default sim call manager to use when the default dialer doesn't implement one. A sim call + * manager can control and route outgoing and incoming phone calls, even if they're placed + * using another connection service (PSTN, for example). + */ + public static final String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string"; + /* The following 3 fields are related to carrier visual voicemail. */ /** @@ -306,6 +320,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_AUTO_RETRY_ENABLED_BOOL, false); sDefaults.putBoolean(KEY_CARRIER_SETTINGS_ENABLE_BOOL, false); sDefaults.putBoolean(KEY_CARRIER_VOLTE_AVAILABLE_BOOL, false); + sDefaults.putBoolean(KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL, false); sDefaults.putBoolean(KEY_CARRIER_VOLTE_PROVISIONED_BOOL, false); sDefaults.putBoolean(KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL, true); sDefaults.putBoolean(KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL, false); @@ -328,6 +343,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_VOICE_PRIVACY_DISABLE_UI_BOOL, false); sDefaults.putBoolean(KEY_WORLD_PHONE_BOOL, false); sDefaults.putInt(KEY_VOLTE_REPLACEMENT_RAT_INT, 0); + sDefaults.putString(KEY_DEFAULT_SIM_CALL_MANAGER_STRING, ""); sDefaults.putString(KEY_VVM_DESTINATION_NUMBER_STRING, ""); sDefaults.putInt(KEY_VVM_PORT_NUMBER_INT, 0); sDefaults.putString(KEY_VVM_TYPE_STRING, ""); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 1cc275d..8291a30 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -667,7 +667,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getDeviceSvnUsingSubId(subId[0]); + return info.getDeviceSvnUsingSubId(subId[0], mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -744,7 +744,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getImeiForSubscriber(subId[0]); + return info.getImeiForSubscriber(subId[0], mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -773,7 +773,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - String nai = info.getNaiForSubscriber(subId[0]); + String nai = info.getNaiForSubscriber(subId[0], mContext.getOpPackageName()); if (Log.isLoggable(TAG, Log.VERBOSE)) { Rlog.v(TAG, "Nai = " + nai); } @@ -1856,7 +1856,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getIccSerialNumberForSubscriber(subId); + return info.getIccSerialNumberForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1938,7 +1938,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getSubscriberIdForSubscriber(subId); + return info.getSubscriberIdForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1959,7 +1959,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getGroupIdLevel1(); + return info.getGroupIdLevel1(mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1983,7 +1983,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getGroupIdLevel1ForSubscriber(subId); + return info.getGroupIdLevel1ForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2029,7 +2029,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getLine1NumberForSubscriber(subId); + return info.getLine1NumberForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2122,7 +2122,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getLine1AlphaTagForSubscriber(subId); + return info.getLine1AlphaTagForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2178,7 +2178,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getMsisdnForSubscriber(subId); + return info.getMsisdnForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2211,7 +2211,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getVoiceMailNumberForSubscriber(subId); + return info.getVoiceMailNumberForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2350,7 +2350,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getVoiceMailAlphaTagForSubscriber(subId); + return info.getVoiceMailAlphaTagForSubscriber(subId, mContext.getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index c91a59c..ed85392 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -25,12 +25,12 @@ interface IPhoneSubInfo { /** * Retrieves the unique device ID, e.g., IMEI for GSM phones. */ - String getDeviceId(); + String getDeviceId(String callingPackage); /** * Retrieves the unique Network Access ID */ - String getNaiForSubscriber(int subId); + String getNaiForSubscriber(int subId, String callingPackage); /** * Retrieves the unique device ID of a phone for the device, e.g., IMEI @@ -41,91 +41,91 @@ interface IPhoneSubInfo { /** * Retrieves the IMEI. */ - String getImeiForSubscriber(int subId); + String getImeiForSubscriber(int subId, String callingPackage); /** * Retrieves the software version number for the device, e.g., IMEI/SV * for GSM phones. */ - String getDeviceSvn(); + String getDeviceSvn(String callingPackage); /** * Retrieves the software version number of a subId for the device, e.g., IMEI/SV * for GSM phones. */ - String getDeviceSvnUsingSubId(int subId); + String getDeviceSvnUsingSubId(int subId, String callingPackage); /** * Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones. */ - String getSubscriberId(); + String getSubscriberId(String callingPackage); /** * Retrieves the unique subscriber ID of a given subId, e.g., IMSI for GSM phones. */ - String getSubscriberIdForSubscriber(int subId); + String getSubscriberIdForSubscriber(int subId, String callingPackage); /** * Retrieves the Group Identifier Level1 for GSM phones. */ - String getGroupIdLevel1(); + String getGroupIdLevel1(String callingPackage); /** * Retrieves the Group Identifier Level1 for GSM phones of a subId. */ - String getGroupIdLevel1ForSubscriber(int subId); + String getGroupIdLevel1ForSubscriber(int subId, String callingPackage); /** * Retrieves the serial number of the ICC, if applicable. */ - String getIccSerialNumber(); + String getIccSerialNumber(String callingPackage); /** * Retrieves the serial number of a given subId. */ - String getIccSerialNumberForSubscriber(int subId); + String getIccSerialNumberForSubscriber(int subId, String callingPackage); /** * Retrieves the phone number string for line 1. */ - String getLine1Number(); + String getLine1Number(String callingPackage); /** * Retrieves the phone number string for line 1 of a subcription. */ - String getLine1NumberForSubscriber(int subId); + String getLine1NumberForSubscriber(int subId, String callingPackage); /** * Retrieves the alpha identifier for line 1. */ - String getLine1AlphaTag(); + String getLine1AlphaTag(String callingPackage); /** * Retrieves the alpha identifier for line 1 of a subId. */ - String getLine1AlphaTagForSubscriber(int subId); + String getLine1AlphaTagForSubscriber(int subId, String callingPackage); /** * Retrieves MSISDN Number. */ - String getMsisdn(); + String getMsisdn(String callingPackage); /** * Retrieves the Msisdn of a subId. */ - String getMsisdnForSubscriber(int subId); + String getMsisdnForSubscriber(int subId, String callingPackage); /** * Retrieves the voice mail number. */ - String getVoiceMailNumber(); + String getVoiceMailNumber(String callingPackage); /** * Retrieves the voice mail number of a given subId. */ - String getVoiceMailNumberForSubscriber(int subId); + String getVoiceMailNumberForSubscriber(int subId, String callingPackage); /** * Retrieves the complete voice mail number. @@ -140,13 +140,13 @@ interface IPhoneSubInfo { /** * Retrieves the alpha identifier associated with the voice mail number. */ - String getVoiceMailAlphaTag(); + String getVoiceMailAlphaTag(String callingPackage); /** * Retrieves the alpha identifier associated with the voice mail number * of a subId. */ - String getVoiceMailAlphaTagForSubscriber(int subId); + String getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage); /** * Returns the IMS private user identity (IMPI) that was loaded from the ISIM. diff --git a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java index 0f73342..035317e 100644 --- a/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java +++ b/wifi/java/android/net/wifi/WifiActivityEnergyInfo.java @@ -39,22 +39,22 @@ public final class WifiActivityEnergyInfo implements Parcelable { /** * @hide */ - public int mControllerTxTimeMs; + public long mControllerTxTimeMs; /** * @hide */ - public int mControllerRxTimeMs; + public long mControllerRxTimeMs; /** * @hide */ - public int mControllerIdleTimeMs; + public long mControllerIdleTimeMs; /** * @hide */ - public int mControllerEnergyUsed; + public long mControllerEnergyUsed; public static final int STACK_STATE_INVALID = 0; public static final int STACK_STATE_STATE_ACTIVE = 1; @@ -62,7 +62,7 @@ public final class WifiActivityEnergyInfo implements Parcelable { public static final int STACK_STATE_STATE_IDLE = 3; public WifiActivityEnergyInfo(long timestamp, int stackState, - int txTime, int rxTime, int idleTime, int energyUsed) { + long txTime, long rxTime, long idleTime, long energyUsed) { mTimestamp = timestamp; mStackState = stackState; mControllerTxTimeMs = txTime; @@ -88,10 +88,10 @@ public final class WifiActivityEnergyInfo implements Parcelable { public WifiActivityEnergyInfo createFromParcel(Parcel in) { long timestamp = in.readLong(); int stackState = in.readInt(); - int txTime = in.readInt(); - int rxTime = in.readInt(); - int idleTime = in.readInt(); - int energyUsed = in.readInt(); + long txTime = in.readLong(); + long rxTime = in.readLong(); + long idleTime = in.readLong(); + long energyUsed = in.readLong(); return new WifiActivityEnergyInfo(timestamp, stackState, txTime, rxTime, idleTime, energyUsed); } @@ -103,10 +103,10 @@ public final class WifiActivityEnergyInfo implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeLong(mTimestamp); out.writeInt(mStackState); - out.writeInt(mControllerTxTimeMs); - out.writeInt(mControllerRxTimeMs); - out.writeInt(mControllerIdleTimeMs); - out.writeInt(mControllerEnergyUsed); + out.writeLong(mControllerTxTimeMs); + out.writeLong(mControllerRxTimeMs); + out.writeLong(mControllerIdleTimeMs); + out.writeLong(mControllerEnergyUsed); } public int describeContents() { @@ -123,30 +123,29 @@ public final class WifiActivityEnergyInfo implements Parcelable { /** * @return tx time in ms */ - public int getControllerTxTimeMillis() { - return (int)mControllerTxTimeMs; + public long getControllerTxTimeMillis() { + return mControllerTxTimeMs; } /** * @return rx time in ms */ - public int getControllerRxTimeMillis() { - return (int)mControllerRxTimeMs; + public long getControllerRxTimeMillis() { + return mControllerRxTimeMs; } /** * @return idle time in ms */ - public int getControllerIdleTimeMillis() { - return (int)mControllerIdleTimeMs; + public long getControllerIdleTimeMillis() { + return mControllerIdleTimeMs; } - /** * product of current(mA), voltage(V) and time(ms) * @return energy used */ - public int getControllerEnergyUsed() { + public long getControllerEnergyUsed() { return mControllerEnergyUsed; } /** @@ -160,8 +159,8 @@ public final class WifiActivityEnergyInfo implements Parcelable { * @return if the record is valid */ public boolean isValid() { - return ((getControllerTxTimeMillis() !=0) || - (getControllerRxTimeMillis() !=0) || - (getControllerIdleTimeMillis() !=0)); + return ((mControllerTxTimeMs !=0) || + (mControllerRxTimeMs !=0) || + (mControllerIdleTimeMs !=0)); } } |