diff options
Diffstat (limited to 'core/java')
20 files changed, 362 insertions, 1476 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 8f2f9ca..e02410a 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -747,6 +747,7 @@ public class Activity extends ContextThemeWrapper int mResultCode = RESULT_CANCELED; Intent mResultData = null; private TranslucentConversionListener mTranslucentCallback; + private boolean mChangeCanvasToTranslucent; private boolean mTitleReady = false; @@ -4903,7 +4904,9 @@ public class Activity extends ContextThemeWrapper public void convertFromTranslucent() { try { mTranslucentCallback = null; - ActivityManagerNative.getDefault().convertFromTranslucent(mToken); + if (ActivityManagerNative.getDefault().convertFromTranslucent(mToken)) { + WindowManagerGlobal.getInstance().changeCanvasOpacity(mToken, true); + } } catch (RemoteException e) { // pass } @@ -4931,7 +4934,8 @@ public class Activity extends ContextThemeWrapper public void convertToTranslucent(TranslucentConversionListener callback) { try { mTranslucentCallback = callback; - ActivityManagerNative.getDefault().convertToTranslucent(mToken); + mChangeCanvasToTranslucent = + ActivityManagerNative.getDefault().convertToTranslucent(mToken); } catch (RemoteException e) { // pass } @@ -4943,6 +4947,9 @@ public class Activity extends ContextThemeWrapper mTranslucentCallback.onTranslucentConversionComplete(drawComplete); mTranslucentCallback = null; } + if (mChangeCanvasToTranslucent) { + WindowManagerGlobal.getInstance().changeCanvasOpacity(mToken, false); + } } /** diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 6a29552..6d72114 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -1502,16 +1502,18 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case CONVERT_FROM_TRANSLUCENT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); - convertFromTranslucent(token); + boolean converted = convertFromTranslucent(token); reply.writeNoException(); + reply.writeInt(converted ? 1 : 0); return true; } case CONVERT_TO_TRANSLUCENT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); - convertToTranslucent(token); + boolean converted = convertToTranslucent(token); reply.writeNoException(); + reply.writeInt(converted ? 1 : 0); return true; } @@ -3876,7 +3878,7 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } - public void convertFromTranslucent(IBinder token) + public boolean convertFromTranslucent(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -3884,11 +3886,13 @@ class ActivityManagerProxy implements IActivityManager data.writeStrongBinder(token); mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0); reply.readException(); + boolean res = reply.readInt() != 0; data.recycle(); reply.recycle(); + return res; } - public void convertToTranslucent(IBinder token) + public boolean convertToTranslucent(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -3896,8 +3900,10 @@ class ActivityManagerProxy implements IActivityManager data.writeStrongBinder(token); mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0); reply.readException(); + boolean res = reply.readInt() != 0; data.recycle(); reply.recycle(); + return res; } public void setImmersive(IBinder token, boolean immersive) diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 6d1b6fc..af9a245 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -301,8 +301,8 @@ public interface IActivityManager extends IInterface { public void finishHeavyWeightApp() throws RemoteException; - public void convertFromTranslucent(IBinder token) throws RemoteException; - public void convertToTranslucent(IBinder token) throws RemoteException; + public boolean convertFromTranslucent(IBinder token) throws RemoteException; + public boolean convertToTranslucent(IBinder token) throws RemoteException; public void notifyActivityDrawn(IBinder token) throws RemoteException; public void setImmersive(IBinder token, boolean immersive) throws RemoteException; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index be831d7..e0b1c00 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -32,10 +32,17 @@ import android.os.ServiceManager; import android.os.UserHandle; import android.util.Log; +import com.android.org.conscrypt.TrustedCertificateStore; + +import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Proxy; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; import java.util.List; +import java.util.Set; /** * Public interface for managing policies enforced on a device. Most clients @@ -1328,6 +1335,70 @@ public class DevicePolicyManager { } /** + * Installs the given certificate as a User CA. + * + * @return false if the certBuffer cannot be parsed or installation is + * interrupted, otherwise true + * @hide + */ + public boolean installCaCert(byte[] certBuffer) { + if (mService != null) { + try { + return mService.installCaCert(certBuffer); + } catch (RemoteException e) { + Log.w(TAG, "Failed talking with device policy service", e); + } + } + return false; + } + + /** + * Uninstalls the given certificate from the list of User CAs, if present. + * + * @hide + */ + public void uninstallCaCert(byte[] certBuffer) { + if (mService != null) { + try { + mService.uninstallCaCert(certBuffer); + } catch (RemoteException e) { + Log.w(TAG, "Failed talking with device policy service", e); + } + } + } + + /** + * Returns whether there are any user-installed CA certificates. + * + * @hide + */ + public boolean hasAnyCaCertsInstalled() { + TrustedCertificateStore certStore = new TrustedCertificateStore(); + Set<String> aliases = certStore.userAliases(); + return aliases != null && !aliases.isEmpty(); + } + + /** + * Returns whether this certificate has been installed as a User CA. + * + * @hide + */ + public boolean hasCaCertInstalled(byte[] certBuffer) { + TrustedCertificateStore certStore = new TrustedCertificateStore(); + String alias; + byte[] pemCert; + try { + CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); + X509Certificate cert = (X509Certificate) certFactory.generateCertificate( + new ByteArrayInputStream(certBuffer)); + return certStore.getCertificateAlias(cert) != null; + } catch (CertificateException ce) { + Log.w(TAG, "Could not parse certificate", ce); + } + return false; + } + + /** * Called by an application that is administering the device to disable all cameras * on the device. After setting this, no applications will be able to access any cameras * on the device. diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index 9659a91..172c47c 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -102,4 +102,7 @@ interface IDevicePolicyManager { boolean isDeviceOwner(String packageName); String getDeviceOwner(); String getDeviceOwnerName(); + + boolean installCaCert(in byte[] certBuffer); + void uninstallCaCert(in byte[] certBuffer); } diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java index 19b6057..848d7bc 100644 --- a/core/java/android/hardware/camera2/CameraDevice.java +++ b/core/java/android/hardware/camera2/CameraDevice.java @@ -102,7 +102,7 @@ public interface CameraDevice extends AutoCloseable { * Get the static properties for this camera. These are identical to the * properties returned by {@link CameraManager#getCameraProperties}. * - * @return the static properties of the camera. + * @return the static properties of the camera * * @throws CameraAccessException if the camera device is no longer connected * @@ -185,7 +185,7 @@ public interface CameraDevice extends AutoCloseable { * <p>Using larger resolution outputs, or more outputs, can result in slower * output rate from the device.</p> * - * @param outputs the new set of Surfaces that should be made available as + * @param outputs The new set of Surfaces that should be made available as * targets for captured image data. * * @throws IllegalArgumentException if the set of output Surfaces do not @@ -205,7 +205,7 @@ public interface CameraDevice extends AutoCloseable { * * @param templateType An enumeration selecting the use case for this * request; one of the CameraDevice.TEMPLATE_ values. - * @return a filled-in CaptureRequest, except for output streams. + * @return a filled-in CaptureRequest, except for output streams * * @throws IllegalArgumentException if the templateType is not in the list * of supported templates. @@ -238,8 +238,8 @@ public interface CameraDevice extends AutoCloseable { * {@link #setRepeatingBurst}, and will be processed as soon as the current * repeat/repeatBurst processing completes.</p> * - * @param request the settings for this capture. - * @param listener the callback object to notify once this request has been + * @param request the settings for this capture + * @param listener The callback object to notify once this request has been * processed. If null, no metadata will be produced for this capture, * although image data will still be produced. * @@ -268,8 +268,8 @@ public interface CameraDevice extends AutoCloseable { * {@link #capture} repeatedly is that this method guarantees that no * other requests will be interspersed with the burst.</p> * - * @param requests the list of settings for this burst capture. - * @param listener the callback object to notify each time one of the + * @param requests the list of settings for this burst capture + * @param listener The callback object to notify each time one of the * requests in the burst has been processed. If null, no metadata will be * produced for any requests in this burst, although image data will still * be produced. @@ -310,7 +310,7 @@ public interface CameraDevice extends AutoCloseable { * completed before the new repeat request will be used.</p> * * @param request the request to repeat indefinitely - * @param listener the callback object to notify every time the + * @param listener The callback object to notify every time the * request finishes processing. If null, no metadata will be * produced for this stream of requests, although image data will * still be produced. @@ -354,8 +354,8 @@ public interface CameraDevice extends AutoCloseable { * {@link #setRepeatingRequest}, although any in-progress capture will be completed * before the new repeat burst will be used.</p> * - * @param requests the list of requests to cycle through indefinitely. - * @param listener the callback object to notify each time one of the + * @param requests the list of requests to cycle through indefinitely + * @param listener The callback object to notify each time one of the * requests in the repeating bursts has finished processing. If null, no * metadata will be produced for this stream of requests, although image * data will still be produced. diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java index b8ec4da..8903b4a 100644 --- a/core/java/android/hardware/camera2/CameraManager.java +++ b/core/java/android/hardware/camera2/CameraManager.java @@ -55,7 +55,7 @@ public final class CameraManager { private final ICameraService mCameraService; private ArrayList<String> mDeviceIdList; - private HashSet<CameraListener> mListenerSet; + private HashSet<CameraListener> mListenerSet = new HashSet<CameraListener>(); private final Context mContext; private final Object mLock = new Object(); @@ -109,7 +109,7 @@ public final class CameraManager { * * Registering a listener more than once has no effect. * - * @param listener the new listener to send camera availability notices to. + * @param listener The new listener to send camera availability notices to */ public void registerCameraListener(CameraListener listener) { synchronized (mLock) { @@ -123,7 +123,7 @@ public final class CameraManager { * * Removing a listener that isn't registered has no effect. * - * @param listener the listener to remove from the notification list + * @param listener The listener to remove from the notification list */ public void unregisterCameraListener(CameraListener listener) { synchronized (mLock) { diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index 3fda3b7..10ca9be 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -77,8 +77,8 @@ public class CameraMetadata implements Parcelable, AutoCloseable { * found in {@link CameraProperties}, {@link CaptureResult}, and * {@link CaptureRequest}. * - * @param key the metadata field to write. - * @param value the value to set the field to, which must be of a matching + * @param key The metadata field to write. + * @param value The value to set the field to, which must be of a matching * type to the key. */ public <T> void set(Key<T> key, T value) { @@ -109,8 +109,8 @@ public class CameraMetadata implements Parcelable, AutoCloseable { * * @throws IllegalArgumentException if the key was not valid * - * @param key the metadata field to read. - * @return the value of that key, or {@code null} if the field is not set. + * @param key The metadata field to read. + * @return The value of that key, or {@code null} if the field is not set. */ @SuppressWarnings("unchecked") public <T> T get(Key<T> key) { @@ -495,7 +495,7 @@ public class CameraMetadata implements Parcelable, AutoCloseable { * * <p>This value is looked up the first time, and cached subsequently.</p> * - * @return the tag numeric value corresponding to the string + * @return The tag numeric value corresponding to the string * * @hide */ @@ -534,7 +534,7 @@ public class CameraMetadata implements Parcelable, AutoCloseable { * * <p>Useful to convert a CameraMetadata into e.g. a CaptureRequest.</p> * - * @param other metadata to swap with + * @param other Metadata to swap with * @throws NullPointerException if other was null * @hide */ @@ -596,8 +596,8 @@ public class CameraMetadata implements Parcelable, AutoCloseable { /** * Get the underlying native type for a tag. * - * @param tag an integer tag, see e.g. {@link #getTag} - * @return an int enum for the metadata type, see e.g. {@link #TYPE_BYTE} + * @param tag An integer tag, see e.g. {@link #getTag} + * @return An int enum for the metadata type, see e.g. {@link #TYPE_BYTE} * * @hide */ @@ -611,8 +611,8 @@ public class CameraMetadata implements Parcelable, AutoCloseable { * * <p>An empty array can be passed in to update the entry to 0 elements.</p> * - * @param tag an integer tag, see e.g. {@link #getTag} - * @param src an array of bytes, or null to erase the entry + * @param tag An integer tag, see e.g. {@link #getTag} + * @param src An array of bytes, or null to erase the entry * * @hide */ @@ -626,9 +626,9 @@ public class CameraMetadata implements Parcelable, AutoCloseable { * * <p>An empty array can be returned to denote an existing entry with 0 elements.</p> * - * @param tag an integer tag, see e.g. {@link #getTag} + * @param tag An integer tag, see e.g. {@link #getTag} * - * @return null if there were 0 entries for this tag, a byte[] otherwise. + * @return {@code null} if there were 0 entries for this tag, a byte[] otherwise. * @hide */ public byte[] readValues(int tag) { @@ -651,8 +651,8 @@ public class CameraMetadata implements Parcelable, AutoCloseable { * Register a non-sequential set of values to be used with the pack/unpack functions. * This enables get/set to correctly marshal the enum into a value that is C-compatible. * - * @param enumType the class for an enum - * @param values a list of values mapping to the ordinals of the enum + * @param enumType The class for an enum + * @param values A list of values mapping to the ordinals of the enum * * @hide */ @@ -673,8 +673,8 @@ public class CameraMetadata implements Parcelable, AutoCloseable { * enums that have fully sequential values, although for C-style enums the range of values * may not map 1:1. * - * @param enumValue enum instance - * @return int guaranteed to be ABI-compatible with the C enum equivalent + * @param enumValue Enum instance + * @return Int guaranteed to be ABI-compatible with the C enum equivalent */ private static <T extends Enum<T>> int getEnumValue(T enumValue) { int[] values; @@ -691,9 +691,9 @@ public class CameraMetadata implements Parcelable, AutoCloseable { /** * Finds the enum corresponding to it's numeric value. Opposite of {@link #getEnumValue} method. * - * @param enumType class of the enum we want to find - * @param value the numeric value of the enum - * @return an instance of the enum + * @param enumType Class of the enum we want to find + * @param value The numeric value of the enum + * @return An instance of the enum */ private static <T extends Enum<T>> T getEnumFromValue(Class<T> enumType, int value) { int ordinal; diff --git a/core/java/android/hardware/camera2/CameraPropertiesKeys.java b/core/java/android/hardware/camera2/CameraPropertiesKeys.java deleted file mode 100644 index 41b31ff..0000000 --- a/core/java/android/hardware/camera2/CameraPropertiesKeys.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.hardware.camera2; - -import static android.hardware.camera2.CameraMetadata.Key; - -/** - * ! Do not edit this file directly ! - * - * Generated automatically from CameraPropertiesKeys.mako - * - * TODO: Include a hash of the input files here that the build can check. - */ - -/** - * The base class for camera controls and information. - * - * This class defines the basic key/value map used for querying for camera - * characteristics or capture results, and for setting camera request - * parameters. - * - * @see CameraProperties - * @see CameraMetadata - * @hide - **/ -public final class CameraPropertiesKeys { - public static final class Control { - public static final Key<byte[]> AE_AVAILABLE_ANTIBANDING_MODES = - new Key<byte[]>("android.control.aeAvailableAntibandingModes", byte[].class); - public static final Key<int[]> AE_AVAILABLE_TARGET_FPS_RANGES = - new Key<int[]>("android.control.aeAvailableTargetFpsRanges", int[].class); - public static final Key<int[]> AE_COMPENSATION_RANGE = - new Key<int[]>("android.control.aeCompensationRange", int[].class); - public static final Key<Rational> AE_COMPENSATION_STEP = - new Key<Rational>("android.control.aeCompensationStep", Rational.class); - public static final Key<byte[]> AF_AVAILABLE_MODES = - new Key<byte[]>("android.control.afAvailableModes", byte[].class); - public static final Key<byte[]> AVAILABLE_EFFECTS = - new Key<byte[]>("android.control.availableEffects", byte[].class); - public static final Key<byte[]> AVAILABLE_SCENE_MODES = - new Key<byte[]>("android.control.availableSceneModes", byte[].class); - public static final Key<byte[]> AVAILABLE_VIDEO_STABILIZATION_MODES = - new Key<byte[]>("android.control.availableVideoStabilizationModes", byte[].class); - public static final Key<byte[]> AWB_AVAILABLE_MODES = - new Key<byte[]>("android.control.awbAvailableModes", byte[].class); - public static final Key<Integer> MAX_REGIONS = - new Key<Integer>("android.control.maxRegions", int.class); - - } - - public static final class Flash { - public static final class Info { - public static final Key<Byte> AVAILABLE = - new Key<Byte>("android.flash.info.available", byte.class); - } - - } - - public static final class Jpeg { - public static final Key<android.hardware.camera2.Size[]> AVAILABLE_THUMBNAIL_SIZES = - new Key<android.hardware.camera2.Size[]>("android.jpeg.availableThumbnailSizes", android.hardware.camera2.Size[].class); - - } - - public static final class Lens { - public static final class Info { - public static final Key<float[]> AVAILABLE_APERTURES = - new Key<float[]>("android.lens.info.availableApertures", float[].class); - public static final Key<float[]> AVAILABLE_FILTER_DENSITIES = - new Key<float[]>("android.lens.info.availableFilterDensities", float[].class); - public static final Key<float[]> AVAILABLE_FOCAL_LENGTHS = - new Key<float[]>("android.lens.info.availableFocalLengths", float[].class); - public static final Key<byte[]> AVAILABLE_OPTICAL_STABILIZATION = - new Key<byte[]>("android.lens.info.availableOpticalStabilization", byte[].class); - public static final Key<Float> HYPERFOCAL_DISTANCE = - new Key<Float>("android.lens.info.hyperfocalDistance", float.class); - public static final Key<Float> MINIMUM_FOCUS_DISTANCE = - new Key<Float>("android.lens.info.minimumFocusDistance", float.class); - public static final Key<android.hardware.camera2.Size> SHADING_MAP_SIZE = - new Key<android.hardware.camera2.Size>("android.lens.info.shadingMapSize", android.hardware.camera2.Size.class); - } - - public static final class FacingKey extends Key<Lens.FacingKey.Enum> { - public enum Enum { - FRONT, - BACK; - } - - public static final Enum FRONT = Enum.FRONT; - public static final Enum BACK = Enum.BACK; - - // TODO: remove requirement for constructor by making Key an interface - private FacingKey(String name) { - super(name, Lens.FacingKey.Enum.class); - } - - } - - public static final Key<Lens.FacingKey.Enum> FACING = - new FacingKey("android.lens.facing"); - - } - - public static final class Request { - public static final Key<int[]> MAX_NUM_OUTPUT_STREAMS = - new Key<int[]>("android.request.maxNumOutputStreams", int[].class); - - } - - public static final class Scaler { - - public static final class AvailableFormatsKey extends Key<Scaler.AvailableFormatsKey.Enum[]> { - public enum Enum { - RAW_SENSOR, - YV12, - YCrCb_420_SP, - IMPLEMENTATION_DEFINED, - YCbCr_420_888, - BLOB; - } - - public static final Enum RAW_SENSOR = Enum.RAW_SENSOR; - public static final Enum YV12 = Enum.YV12; - public static final Enum YCrCb_420_SP = Enum.YCrCb_420_SP; - public static final Enum IMPLEMENTATION_DEFINED = Enum.IMPLEMENTATION_DEFINED; - public static final Enum YCbCr_420_888 = Enum.YCbCr_420_888; - public static final Enum BLOB = Enum.BLOB; - - // TODO: remove requirement for constructor by making Key an interface - private AvailableFormatsKey(String name) { - super(name, Scaler.AvailableFormatsKey.Enum[].class); - } - - static { - CameraMetadata.registerEnumValues(Scaler.AvailableFormatsKey.Enum.class, new int[] { - 0x20, // RAW_SENSOR - 0x32315659, // YV12 - 0x11, // YCrCb_420_SP - 0x22, // IMPLEMENTATION_DEFINED - 0x23, // YCbCr_420_888 - 0x21 // BLOB - }); - } - } - - public static final Key<Scaler.AvailableFormatsKey.Enum[]> AVAILABLE_FORMATS = - new AvailableFormatsKey("android.scaler.availableFormats"); - public static final Key<long[]> AVAILABLE_JPEG_MIN_DURATIONS = - new Key<long[]>("android.scaler.availableJpegMinDurations", long[].class); - public static final Key<android.hardware.camera2.Size[]> AVAILABLE_JPEG_SIZES = - new Key<android.hardware.camera2.Size[]>("android.scaler.availableJpegSizes", android.hardware.camera2.Size[].class); - public static final Key<Float> AVAILABLE_MAX_DIGITAL_ZOOM = - new Key<Float>("android.scaler.availableMaxDigitalZoom", float.class); - public static final Key<long[]> AVAILABLE_PROCESSED_MIN_DURATIONS = - new Key<long[]>("android.scaler.availableProcessedMinDurations", long[].class); - public static final Key<android.hardware.camera2.Size[]> AVAILABLE_PROCESSED_SIZES = - new Key<android.hardware.camera2.Size[]>("android.scaler.availableProcessedSizes", android.hardware.camera2.Size[].class); - - } - - public static final class Sensor { - public static final class Info { - public static final Key<android.graphics.Rect> ACTIVE_ARRAY_SIZE = - new Key<android.graphics.Rect>("android.sensor.info.activeArraySize", android.graphics.Rect.class); - public static final Key<int[]> SENSITIVITY_RANGE = - new Key<int[]>("android.sensor.info.sensitivityRange", int[].class); - public static final Key<long[]> EXPOSURE_TIME_RANGE = - new Key<long[]>("android.sensor.info.exposureTimeRange", long[].class); - public static final Key<Long> MAX_FRAME_DURATION = - new Key<Long>("android.sensor.info.maxFrameDuration", long.class); - public static final Key<android.hardware.camera2.Size> PHYSICAL_SIZE = - new Key<android.hardware.camera2.Size>("android.sensor.info.physicalSize", android.hardware.camera2.Size.class); - } - public static final Key<Rational> BASE_GAIN_FACTOR = - new Key<Rational>("android.sensor.baseGainFactor", Rational.class); - public static final Key<Integer> MAX_ANALOG_SENSITIVITY = - new Key<Integer>("android.sensor.maxAnalogSensitivity", int.class); - public static final Key<Integer> ORIENTATION = - new Key<Integer>("android.sensor.orientation", int.class); - - } - - public static final class Statistics { - public static final class Info { - public static final Key<byte[]> AVAILABLE_FACE_DETECT_MODES = - new Key<byte[]>("android.statistics.info.availableFaceDetectModes", byte[].class); - public static final Key<Integer> MAX_FACE_COUNT = - new Key<Integer>("android.statistics.info.maxFaceCount", int.class); - } - - } - - public static final class Tonemap { - public static final Key<Integer> MAX_CURVE_POINTS = - new Key<Integer>("android.tonemap.maxCurvePoints", int.class); - - } - - /** - * @hide - */ - public static final class Led { - - /** - * @hide - */ - public static final class AvailableLedsKey extends Key<Led.AvailableLedsKey.Enum[]> { - public enum Enum { - TRANSMIT; - } - - public static final Enum TRANSMIT = Enum.TRANSMIT; - - // TODO: remove requirement for constructor by making Key an interface - private AvailableLedsKey(String name) { - super(name, Led.AvailableLedsKey.Enum[].class); - } - - } - - /** - * @hide - */ - public static final Key<Led.AvailableLedsKey.Enum[]> AVAILABLE_LEDS = - new AvailableLedsKey("android.led.availableLeds"); - - } - - public static final class Info { - - public static final class SupportedHardwareLevelKey extends Key<Info.SupportedHardwareLevelKey.Enum> { - public enum Enum { - LIMITED, - FULL; - } - - public static final Enum LIMITED = Enum.LIMITED; - public static final Enum FULL = Enum.FULL; - - // TODO: remove requirement for constructor by making Key an interface - private SupportedHardwareLevelKey(String name) { - super(name, Info.SupportedHardwareLevelKey.Enum.class); - } - - } - - public static final Key<Info.SupportedHardwareLevelKey.Enum> SUPPORTED_HARDWARE_LEVEL = - new SupportedHardwareLevelKey("android.info.supportedHardwareLevel"); - - } - -} - - diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 63d6134..28225e6 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -69,7 +69,7 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { * * <p>Adding a target more than once has no effect.</p> * - * @param outputTarget surface to use as an output target for this request + * @param outputTarget Surface to use as an output target for this request */ public void addTarget(Surface outputTarget) { synchronized (mLock) { @@ -82,7 +82,7 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { * * <p>Removing a target that is not currently added has no effect.</p> * - * @param outputTarget surface to use as an output target for this request + * @param outputTarget Surface to use as an output target for this request */ public void removeTarget(Surface outputTarget) { synchronized (mLock) { diff --git a/core/java/android/hardware/camera2/CaptureRequestKeys.java b/core/java/android/hardware/camera2/CaptureRequestKeys.java deleted file mode 100644 index 17de8f0..0000000 --- a/core/java/android/hardware/camera2/CaptureRequestKeys.java +++ /dev/null @@ -1,617 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.hardware.camera2; - -import static android.hardware.camera2.CameraMetadata.Key; - -/** - * ! Do not edit this file directly ! - * - * Generated automatically from CaptureRequestKeys.mako - * - * TODO: Include a hash of the input files here that the build can check. - */ - -/** - * The base class for camera controls and information. - * - * This class defines the basic key/value map used for querying for camera - * characteristics or capture results, and for setting camera request - * parameters. - * - * @see CaptureRequest - * @see CameraMetadata - * @hide - **/ -public final class CaptureRequestKeys { - public static final class ColorCorrection { - - public static final class ModeKey extends Key<ColorCorrection.ModeKey.Enum> { - public enum Enum { - TRANSFORM_MATRIX, - FAST, - HIGH_QUALITY; - } - - public static final Enum TRANSFORM_MATRIX = Enum.TRANSFORM_MATRIX; - public static final Enum FAST = Enum.FAST; - public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, ColorCorrection.ModeKey.Enum.class); - } - - } - - public static final Key<ColorCorrection.ModeKey.Enum> MODE = - new ModeKey("android.colorCorrection.mode"); - public static final Key<Rational[]> TRANSFORM = - new Key<Rational[]>("android.colorCorrection.transform", Rational[].class); - public static final Key<float[]> GAINS = - new Key<float[]>("android.colorCorrection.gains", float[].class); - - } - - public static final class Control { - - public static final class AeAntibandingModeKey extends Key<Control.AeAntibandingModeKey.Enum> { - public enum Enum { - OFF, - _50HZ, - _60HZ, - AUTO; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum _50HZ = Enum._50HZ; - public static final Enum _60HZ = Enum._60HZ; - public static final Enum AUTO = Enum.AUTO; - - // TODO: remove requirement for constructor by making Key an interface - private AeAntibandingModeKey(String name) { - super(name, Control.AeAntibandingModeKey.Enum.class); - } - - } - - public static final Key<Control.AeAntibandingModeKey.Enum> AE_ANTIBANDING_MODE = - new AeAntibandingModeKey("android.control.aeAntibandingMode"); - public static final Key<Integer> AE_EXPOSURE_COMPENSATION = - new Key<Integer>("android.control.aeExposureCompensation", int.class); - public static final Key<Boolean> AE_LOCK = - new Key<Boolean>("android.control.aeLock", boolean.class); - - public static final class AeModeKey extends Key<Control.AeModeKey.Enum> { - public enum Enum { - OFF, - ON, - ON_AUTO_FLASH, - ON_ALWAYS_FLASH, - ON_AUTO_FLASH_REDEYE; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum ON = Enum.ON; - public static final Enum ON_AUTO_FLASH = Enum.ON_AUTO_FLASH; - public static final Enum ON_ALWAYS_FLASH = Enum.ON_ALWAYS_FLASH; - public static final Enum ON_AUTO_FLASH_REDEYE = Enum.ON_AUTO_FLASH_REDEYE; - - // TODO: remove requirement for constructor by making Key an interface - private AeModeKey(String name) { - super(name, Control.AeModeKey.Enum.class); - } - - } - - public static final Key<Control.AeModeKey.Enum> AE_MODE = - new AeModeKey("android.control.aeMode"); - public static final Key<int[]> AE_REGIONS = - new Key<int[]>("android.control.aeRegions", int[].class); - public static final Key<int[]> AE_TARGET_FPS_RANGE = - new Key<int[]>("android.control.aeTargetFpsRange", int[].class); - - public static final class AePrecaptureTriggerKey extends Key<Control.AePrecaptureTriggerKey.Enum> { - public enum Enum { - IDLE, - START; - } - - public static final Enum IDLE = Enum.IDLE; - public static final Enum START = Enum.START; - - // TODO: remove requirement for constructor by making Key an interface - private AePrecaptureTriggerKey(String name) { - super(name, Control.AePrecaptureTriggerKey.Enum.class); - } - - } - - public static final Key<Control.AePrecaptureTriggerKey.Enum> AE_PRECAPTURE_TRIGGER = - new AePrecaptureTriggerKey("android.control.aePrecaptureTrigger"); - - public static final class AfModeKey extends Key<Control.AfModeKey.Enum> { - public enum Enum { - OFF, - AUTO, - MACRO, - CONTINUOUS_VIDEO, - CONTINUOUS_PICTURE, - EDOF; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum AUTO = Enum.AUTO; - public static final Enum MACRO = Enum.MACRO; - public static final Enum CONTINUOUS_VIDEO = Enum.CONTINUOUS_VIDEO; - public static final Enum CONTINUOUS_PICTURE = Enum.CONTINUOUS_PICTURE; - public static final Enum EDOF = Enum.EDOF; - - // TODO: remove requirement for constructor by making Key an interface - private AfModeKey(String name) { - super(name, Control.AfModeKey.Enum.class); - } - - } - - public static final Key<Control.AfModeKey.Enum> AF_MODE = - new AfModeKey("android.control.afMode"); - public static final Key<int[]> AF_REGIONS = - new Key<int[]>("android.control.afRegions", int[].class); - - public static final class AfTriggerKey extends Key<Control.AfTriggerKey.Enum> { - public enum Enum { - IDLE, - START, - CANCEL; - } - - public static final Enum IDLE = Enum.IDLE; - public static final Enum START = Enum.START; - public static final Enum CANCEL = Enum.CANCEL; - - // TODO: remove requirement for constructor by making Key an interface - private AfTriggerKey(String name) { - super(name, Control.AfTriggerKey.Enum.class); - } - - } - - public static final Key<Control.AfTriggerKey.Enum> AF_TRIGGER = - new AfTriggerKey("android.control.afTrigger"); - public static final Key<Boolean> AWB_LOCK = - new Key<Boolean>("android.control.awbLock", boolean.class); - - public static final class AwbModeKey extends Key<Control.AwbModeKey.Enum> { - public enum Enum { - OFF, - AUTO, - INCANDESCENT, - FLUORESCENT, - WARM_FLUORESCENT, - DAYLIGHT, - CLOUDY_DAYLIGHT, - TWILIGHT, - SHADE; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum AUTO = Enum.AUTO; - public static final Enum INCANDESCENT = Enum.INCANDESCENT; - public static final Enum FLUORESCENT = Enum.FLUORESCENT; - public static final Enum WARM_FLUORESCENT = Enum.WARM_FLUORESCENT; - public static final Enum DAYLIGHT = Enum.DAYLIGHT; - public static final Enum CLOUDY_DAYLIGHT = Enum.CLOUDY_DAYLIGHT; - public static final Enum TWILIGHT = Enum.TWILIGHT; - public static final Enum SHADE = Enum.SHADE; - - // TODO: remove requirement for constructor by making Key an interface - private AwbModeKey(String name) { - super(name, Control.AwbModeKey.Enum.class); - } - - } - - public static final Key<Control.AwbModeKey.Enum> AWB_MODE = - new AwbModeKey("android.control.awbMode"); - public static final Key<int[]> AWB_REGIONS = - new Key<int[]>("android.control.awbRegions", int[].class); - - public static final class CaptureIntentKey extends Key<Control.CaptureIntentKey.Enum> { - public enum Enum { - CUSTOM, - PREVIEW, - STILL_CAPTURE, - VIDEO_RECORD, - VIDEO_SNAPSHOT, - ZERO_SHUTTER_LAG; - } - - public static final Enum CUSTOM = Enum.CUSTOM; - public static final Enum PREVIEW = Enum.PREVIEW; - public static final Enum STILL_CAPTURE = Enum.STILL_CAPTURE; - public static final Enum VIDEO_RECORD = Enum.VIDEO_RECORD; - public static final Enum VIDEO_SNAPSHOT = Enum.VIDEO_SNAPSHOT; - public static final Enum ZERO_SHUTTER_LAG = Enum.ZERO_SHUTTER_LAG; - - // TODO: remove requirement for constructor by making Key an interface - private CaptureIntentKey(String name) { - super(name, Control.CaptureIntentKey.Enum.class); - } - - } - - public static final Key<Control.CaptureIntentKey.Enum> CAPTURE_INTENT = - new CaptureIntentKey("android.control.captureIntent"); - - public static final class EffectModeKey extends Key<Control.EffectModeKey.Enum> { - public enum Enum { - OFF, - MONO, - NEGATIVE, - SOLARIZE, - SEPIA, - POSTERIZE, - WHITEBOARD, - BLACKBOARD, - AQUA; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum MONO = Enum.MONO; - public static final Enum NEGATIVE = Enum.NEGATIVE; - public static final Enum SOLARIZE = Enum.SOLARIZE; - public static final Enum SEPIA = Enum.SEPIA; - public static final Enum POSTERIZE = Enum.POSTERIZE; - public static final Enum WHITEBOARD = Enum.WHITEBOARD; - public static final Enum BLACKBOARD = Enum.BLACKBOARD; - public static final Enum AQUA = Enum.AQUA; - - // TODO: remove requirement for constructor by making Key an interface - private EffectModeKey(String name) { - super(name, Control.EffectModeKey.Enum.class); - } - - } - - public static final Key<Control.EffectModeKey.Enum> EFFECT_MODE = - new EffectModeKey("android.control.effectMode"); - - public static final class ModeKey extends Key<Control.ModeKey.Enum> { - public enum Enum { - OFF, - AUTO, - USE_SCENE_MODE; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum AUTO = Enum.AUTO; - public static final Enum USE_SCENE_MODE = Enum.USE_SCENE_MODE; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, Control.ModeKey.Enum.class); - } - - } - - public static final Key<Control.ModeKey.Enum> MODE = - new ModeKey("android.control.mode"); - - public static final class SceneModeKey extends Key<Control.SceneModeKey.Enum> { - public enum Enum { - UNSUPPORTED, - FACE_PRIORITY, - ACTION, - PORTRAIT, - LANDSCAPE, - NIGHT, - NIGHT_PORTRAIT, - THEATRE, - BEACH, - SNOW, - SUNSET, - STEADYPHOTO, - FIREWORKS, - SPORTS, - PARTY, - CANDLELIGHT, - BARCODE; - } - - public static final Enum UNSUPPORTED = Enum.UNSUPPORTED; - public static final Enum FACE_PRIORITY = Enum.FACE_PRIORITY; - public static final Enum ACTION = Enum.ACTION; - public static final Enum PORTRAIT = Enum.PORTRAIT; - public static final Enum LANDSCAPE = Enum.LANDSCAPE; - public static final Enum NIGHT = Enum.NIGHT; - public static final Enum NIGHT_PORTRAIT = Enum.NIGHT_PORTRAIT; - public static final Enum THEATRE = Enum.THEATRE; - public static final Enum BEACH = Enum.BEACH; - public static final Enum SNOW = Enum.SNOW; - public static final Enum SUNSET = Enum.SUNSET; - public static final Enum STEADYPHOTO = Enum.STEADYPHOTO; - public static final Enum FIREWORKS = Enum.FIREWORKS; - public static final Enum SPORTS = Enum.SPORTS; - public static final Enum PARTY = Enum.PARTY; - public static final Enum CANDLELIGHT = Enum.CANDLELIGHT; - public static final Enum BARCODE = Enum.BARCODE; - - // TODO: remove requirement for constructor by making Key an interface - private SceneModeKey(String name) { - super(name, Control.SceneModeKey.Enum.class); - } - - static { - CameraMetadata.registerEnumValues(Control.SceneModeKey.Enum.class, new int[] { - 0, // UNSUPPORTED - 1, // FACE_PRIORITY - 2, // ACTION - 3, // PORTRAIT - 4, // LANDSCAPE - 5, // NIGHT - 6, // NIGHT_PORTRAIT - 7, // THEATRE - 8, // BEACH - 9, // SNOW - 10, // SUNSET - 11, // STEADYPHOTO - 12, // FIREWORKS - 13, // SPORTS - 14, // PARTY - 15, // CANDLELIGHT - 16 // BARCODE - }); - } - } - - public static final Key<Control.SceneModeKey.Enum> SCENE_MODE = - new SceneModeKey("android.control.sceneMode"); - public static final Key<Boolean> VIDEO_STABILIZATION_MODE = - new Key<Boolean>("android.control.videoStabilizationMode", boolean.class); - - } - - public static final class Edge { - - public static final class ModeKey extends Key<Edge.ModeKey.Enum> { - public enum Enum { - OFF, - FAST, - HIGH_QUALITY; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum FAST = Enum.FAST; - public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, Edge.ModeKey.Enum.class); - } - - } - - public static final Key<Edge.ModeKey.Enum> MODE = - new ModeKey("android.edge.mode"); - - } - - public static final class Flash { - - public static final class ModeKey extends Key<Flash.ModeKey.Enum> { - public enum Enum { - OFF, - SINGLE, - TORCH; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum SINGLE = Enum.SINGLE; - public static final Enum TORCH = Enum.TORCH; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, Flash.ModeKey.Enum.class); - } - - } - - public static final Key<Flash.ModeKey.Enum> MODE = - new ModeKey("android.flash.mode"); - - } - - public static final class Jpeg { - public static final Key<double[]> GPS_COORDINATES = - new Key<double[]>("android.jpeg.gpsCoordinates", double[].class); - public static final Key<String> GPS_PROCESSING_METHOD = - new Key<String>("android.jpeg.gpsProcessingMethod", String.class); - public static final Key<Long> GPS_TIMESTAMP = - new Key<Long>("android.jpeg.gpsTimestamp", long.class); - public static final Key<Integer> ORIENTATION = - new Key<Integer>("android.jpeg.orientation", int.class); - public static final Key<Byte> QUALITY = - new Key<Byte>("android.jpeg.quality", byte.class); - public static final Key<Byte> THUMBNAIL_QUALITY = - new Key<Byte>("android.jpeg.thumbnailQuality", byte.class); - public static final Key<android.hardware.camera2.Size> THUMBNAIL_SIZE = - new Key<android.hardware.camera2.Size>("android.jpeg.thumbnailSize", android.hardware.camera2.Size.class); - - } - - public static final class Lens { - public static final Key<Float> APERTURE = - new Key<Float>("android.lens.aperture", float.class); - public static final Key<Float> FILTER_DENSITY = - new Key<Float>("android.lens.filterDensity", float.class); - public static final Key<Float> FOCAL_LENGTH = - new Key<Float>("android.lens.focalLength", float.class); - public static final Key<Float> FOCUS_DISTANCE = - new Key<Float>("android.lens.focusDistance", float.class); - - public static final class OpticalStabilizationModeKey extends Key<Lens.OpticalStabilizationModeKey.Enum> { - public enum Enum { - OFF, - ON; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum ON = Enum.ON; - - // TODO: remove requirement for constructor by making Key an interface - private OpticalStabilizationModeKey(String name) { - super(name, Lens.OpticalStabilizationModeKey.Enum.class); - } - - } - - public static final Key<Lens.OpticalStabilizationModeKey.Enum> OPTICAL_STABILIZATION_MODE = - new OpticalStabilizationModeKey("android.lens.opticalStabilizationMode"); - - } - - public static final class NoiseReduction { - - public static final class ModeKey extends Key<NoiseReduction.ModeKey.Enum> { - public enum Enum { - OFF, - FAST, - HIGH_QUALITY; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum FAST = Enum.FAST; - public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, NoiseReduction.ModeKey.Enum.class); - } - - } - - public static final Key<NoiseReduction.ModeKey.Enum> MODE = - new ModeKey("android.noiseReduction.mode"); - - } - - /** - * @hide - */ - public static final class Request { - /** - * @hide - */ - public static final Key<Integer> ID = - new Key<Integer>("android.request.id", int.class); - - } - - public static final class Scaler { - public static final Key<android.graphics.Rect> CROP_REGION = - new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class); - - } - - public static final class Sensor { - public static final Key<Long> EXPOSURE_TIME = - new Key<Long>("android.sensor.exposureTime", long.class); - public static final Key<Long> FRAME_DURATION = - new Key<Long>("android.sensor.frameDuration", long.class); - public static final Key<Integer> SENSITIVITY = - new Key<Integer>("android.sensor.sensitivity", int.class); - - } - - public static final class Statistics { - - public static final class FaceDetectModeKey extends Key<Statistics.FaceDetectModeKey.Enum> { - public enum Enum { - OFF, - SIMPLE, - FULL; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum SIMPLE = Enum.SIMPLE; - public static final Enum FULL = Enum.FULL; - - // TODO: remove requirement for constructor by making Key an interface - private FaceDetectModeKey(String name) { - super(name, Statistics.FaceDetectModeKey.Enum.class); - } - - } - - public static final Key<Statistics.FaceDetectModeKey.Enum> FACE_DETECT_MODE = - new FaceDetectModeKey("android.statistics.faceDetectMode"); - - } - - public static final class Tonemap { - public static final Key<Float> CURVE_BLUE = - new Key<Float>("android.tonemap.curveBlue", float.class); - public static final Key<Float> CURVE_GREEN = - new Key<Float>("android.tonemap.curveGreen", float.class); - public static final Key<float[]> CURVE_RED = - new Key<float[]>("android.tonemap.curveRed", float[].class); - - public static final class ModeKey extends Key<Tonemap.ModeKey.Enum> { - public enum Enum { - CONTRAST_CURVE, - FAST, - HIGH_QUALITY; - } - - public static final Enum CONTRAST_CURVE = Enum.CONTRAST_CURVE; - public static final Enum FAST = Enum.FAST; - public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, Tonemap.ModeKey.Enum.class); - } - - } - - public static final Key<Tonemap.ModeKey.Enum> MODE = - new ModeKey("android.tonemap.mode"); - - } - - /** - * @hide - */ - public static final class Led { - /** - * @hide - */ - public static final Key<Boolean> TRANSMIT = - new Key<Boolean>("android.led.transmit", boolean.class); - - } - - public static final class BlackLevel { - public static final Key<Boolean> LOCK = - new Key<Boolean>("android.blackLevel.lock", boolean.class); - - } - -} - - diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index d5bb8b3..31377be 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -54,7 +54,7 @@ public final class CaptureResult extends CameraMetadata { return mBounds; } - /* <p>The confidence level for the detection of the face. The range is 1 to + /** <p>The confidence level for the detection of the face. The range is 1 to * 100. 100 is the highest confidence.</p> * * <p>Depending on the device, even very low-confidence faces may be diff --git a/core/java/android/hardware/camera2/CaptureResultKeys.java b/core/java/android/hardware/camera2/CaptureResultKeys.java deleted file mode 100644 index dd3ed83..0000000 --- a/core/java/android/hardware/camera2/CaptureResultKeys.java +++ /dev/null @@ -1,533 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.hardware.camera2; - -import static android.hardware.camera2.CameraMetadata.Key; - -/** - * ! Do not edit this file directly ! - * - * Generated automatically from CaptureResultKeys.mako - * - * TODO: Include a hash of the input files here that the build can check. - */ - -/** - * The base class for camera controls and information. - * - * This class defines the basic key/value map used for querying for camera - * characteristics or capture results, and for setting camera request - * parameters. - * - * @see CaptureResult - * @see CameraMetadata - * @hide - **/ -public final class CaptureResultKeys { - public static final class ColorCorrection { - public static final Key<Rational[]> TRANSFORM = - new Key<Rational[]>("android.colorCorrection.transform", Rational[].class); - public static final Key<float[]> GAINS = - new Key<float[]>("android.colorCorrection.gains", float[].class); - - } - - public static final class Control { - /** - * @hide - */ - public static final Key<Integer> AE_PRECAPTURE_ID = - new Key<Integer>("android.control.aePrecaptureId", int.class); - public static final Key<int[]> AE_REGIONS = - new Key<int[]>("android.control.aeRegions", int[].class); - - public static final class AeStateKey extends Key<Control.AeStateKey.Enum> { - public enum Enum { - INACTIVE, - SEARCHING, - CONVERGED, - LOCKED, - FLASH_REQUIRED, - PRECAPTURE; - } - - public static final Enum INACTIVE = Enum.INACTIVE; - public static final Enum SEARCHING = Enum.SEARCHING; - public static final Enum CONVERGED = Enum.CONVERGED; - public static final Enum LOCKED = Enum.LOCKED; - public static final Enum FLASH_REQUIRED = Enum.FLASH_REQUIRED; - public static final Enum PRECAPTURE = Enum.PRECAPTURE; - - // TODO: remove requirement for constructor by making Key an interface - private AeStateKey(String name) { - super(name, Control.AeStateKey.Enum.class); - } - - } - - public static final Key<Control.AeStateKey.Enum> AE_STATE = - new AeStateKey("android.control.aeState"); - - public static final class AfModeKey extends Key<Control.AfModeKey.Enum> { - public enum Enum { - OFF, - AUTO, - MACRO, - CONTINUOUS_VIDEO, - CONTINUOUS_PICTURE, - EDOF; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum AUTO = Enum.AUTO; - public static final Enum MACRO = Enum.MACRO; - public static final Enum CONTINUOUS_VIDEO = Enum.CONTINUOUS_VIDEO; - public static final Enum CONTINUOUS_PICTURE = Enum.CONTINUOUS_PICTURE; - public static final Enum EDOF = Enum.EDOF; - - // TODO: remove requirement for constructor by making Key an interface - private AfModeKey(String name) { - super(name, Control.AfModeKey.Enum.class); - } - - } - - public static final Key<Control.AfModeKey.Enum> AF_MODE = - new AfModeKey("android.control.afMode"); - public static final Key<int[]> AF_REGIONS = - new Key<int[]>("android.control.afRegions", int[].class); - - public static final class AfStateKey extends Key<Control.AfStateKey.Enum> { - public enum Enum { - INACTIVE, - PASSIVE_SCAN, - PASSIVE_FOCUSED, - ACTIVE_SCAN, - FOCUSED_LOCKED, - NOT_FOCUSED_LOCKED; - } - - public static final Enum INACTIVE = Enum.INACTIVE; - public static final Enum PASSIVE_SCAN = Enum.PASSIVE_SCAN; - public static final Enum PASSIVE_FOCUSED = Enum.PASSIVE_FOCUSED; - public static final Enum ACTIVE_SCAN = Enum.ACTIVE_SCAN; - public static final Enum FOCUSED_LOCKED = Enum.FOCUSED_LOCKED; - public static final Enum NOT_FOCUSED_LOCKED = Enum.NOT_FOCUSED_LOCKED; - - // TODO: remove requirement for constructor by making Key an interface - private AfStateKey(String name) { - super(name, Control.AfStateKey.Enum.class); - } - - } - - public static final Key<Control.AfStateKey.Enum> AF_STATE = - new AfStateKey("android.control.afState"); - /** - * @hide - */ - public static final Key<Integer> AF_TRIGGER_ID = - new Key<Integer>("android.control.afTriggerId", int.class); - - public static final class AwbModeKey extends Key<Control.AwbModeKey.Enum> { - public enum Enum { - OFF, - AUTO, - INCANDESCENT, - FLUORESCENT, - WARM_FLUORESCENT, - DAYLIGHT, - CLOUDY_DAYLIGHT, - TWILIGHT, - SHADE; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum AUTO = Enum.AUTO; - public static final Enum INCANDESCENT = Enum.INCANDESCENT; - public static final Enum FLUORESCENT = Enum.FLUORESCENT; - public static final Enum WARM_FLUORESCENT = Enum.WARM_FLUORESCENT; - public static final Enum DAYLIGHT = Enum.DAYLIGHT; - public static final Enum CLOUDY_DAYLIGHT = Enum.CLOUDY_DAYLIGHT; - public static final Enum TWILIGHT = Enum.TWILIGHT; - public static final Enum SHADE = Enum.SHADE; - - // TODO: remove requirement for constructor by making Key an interface - private AwbModeKey(String name) { - super(name, Control.AwbModeKey.Enum.class); - } - - } - - public static final Key<Control.AwbModeKey.Enum> AWB_MODE = - new AwbModeKey("android.control.awbMode"); - public static final Key<int[]> AWB_REGIONS = - new Key<int[]>("android.control.awbRegions", int[].class); - - public static final class AwbStateKey extends Key<Control.AwbStateKey.Enum> { - public enum Enum { - INACTIVE, - SEARCHING, - CONVERGED, - LOCKED; - } - - public static final Enum INACTIVE = Enum.INACTIVE; - public static final Enum SEARCHING = Enum.SEARCHING; - public static final Enum CONVERGED = Enum.CONVERGED; - public static final Enum LOCKED = Enum.LOCKED; - - // TODO: remove requirement for constructor by making Key an interface - private AwbStateKey(String name) { - super(name, Control.AwbStateKey.Enum.class); - } - - } - - public static final Key<Control.AwbStateKey.Enum> AWB_STATE = - new AwbStateKey("android.control.awbState"); - - public static final class ModeKey extends Key<Control.ModeKey.Enum> { - public enum Enum { - OFF, - AUTO, - USE_SCENE_MODE; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum AUTO = Enum.AUTO; - public static final Enum USE_SCENE_MODE = Enum.USE_SCENE_MODE; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, Control.ModeKey.Enum.class); - } - - } - - public static final Key<Control.ModeKey.Enum> MODE = - new ModeKey("android.control.mode"); - - } - - public static final class Edge { - - public static final class ModeKey extends Key<Edge.ModeKey.Enum> { - public enum Enum { - OFF, - FAST, - HIGH_QUALITY; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum FAST = Enum.FAST; - public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, Edge.ModeKey.Enum.class); - } - - } - - public static final Key<Edge.ModeKey.Enum> MODE = - new ModeKey("android.edge.mode"); - - } - - public static final class Flash { - - public static final class ModeKey extends Key<Flash.ModeKey.Enum> { - public enum Enum { - OFF, - SINGLE, - TORCH; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum SINGLE = Enum.SINGLE; - public static final Enum TORCH = Enum.TORCH; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, Flash.ModeKey.Enum.class); - } - - } - - public static final Key<Flash.ModeKey.Enum> MODE = - new ModeKey("android.flash.mode"); - - public static final class StateKey extends Key<Flash.StateKey.Enum> { - public enum Enum { - UNAVAILABLE, - CHARGING, - READY, - FIRED; - } - - public static final Enum UNAVAILABLE = Enum.UNAVAILABLE; - public static final Enum CHARGING = Enum.CHARGING; - public static final Enum READY = Enum.READY; - public static final Enum FIRED = Enum.FIRED; - - // TODO: remove requirement for constructor by making Key an interface - private StateKey(String name) { - super(name, Flash.StateKey.Enum.class); - } - - } - - public static final Key<Flash.StateKey.Enum> STATE = - new StateKey("android.flash.state"); - - } - - public static final class Jpeg { - public static final Key<double[]> GPS_COORDINATES = - new Key<double[]>("android.jpeg.gpsCoordinates", double[].class); - public static final Key<String> GPS_PROCESSING_METHOD = - new Key<String>("android.jpeg.gpsProcessingMethod", String.class); - public static final Key<Long> GPS_TIMESTAMP = - new Key<Long>("android.jpeg.gpsTimestamp", long.class); - public static final Key<Integer> ORIENTATION = - new Key<Integer>("android.jpeg.orientation", int.class); - public static final Key<Byte> QUALITY = - new Key<Byte>("android.jpeg.quality", byte.class); - public static final Key<Byte> THUMBNAIL_QUALITY = - new Key<Byte>("android.jpeg.thumbnailQuality", byte.class); - public static final Key<android.hardware.camera2.Size> THUMBNAIL_SIZE = - new Key<android.hardware.camera2.Size>("android.jpeg.thumbnailSize", android.hardware.camera2.Size.class); - - } - - public static final class Lens { - public static final Key<Float> APERTURE = - new Key<Float>("android.lens.aperture", float.class); - public static final Key<Float> FILTER_DENSITY = - new Key<Float>("android.lens.filterDensity", float.class); - public static final Key<Float> FOCAL_LENGTH = - new Key<Float>("android.lens.focalLength", float.class); - public static final Key<Float> FOCUS_DISTANCE = - new Key<Float>("android.lens.focusDistance", float.class); - public static final Key<Float> FOCUS_RANGE = - new Key<Float>("android.lens.focusRange", float.class); - - public static final class OpticalStabilizationModeKey extends Key<Lens.OpticalStabilizationModeKey.Enum> { - public enum Enum { - OFF, - ON; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum ON = Enum.ON; - - // TODO: remove requirement for constructor by making Key an interface - private OpticalStabilizationModeKey(String name) { - super(name, Lens.OpticalStabilizationModeKey.Enum.class); - } - - } - - public static final Key<Lens.OpticalStabilizationModeKey.Enum> OPTICAL_STABILIZATION_MODE = - new OpticalStabilizationModeKey("android.lens.opticalStabilizationMode"); - - public static final class StateKey extends Key<Lens.StateKey.Enum> { - public enum Enum { - STATIONARY; - } - - public static final Enum STATIONARY = Enum.STATIONARY; - - // TODO: remove requirement for constructor by making Key an interface - private StateKey(String name) { - super(name, Lens.StateKey.Enum.class); - } - - } - - public static final Key<Lens.StateKey.Enum> STATE = - new StateKey("android.lens.state"); - - } - - public static final class NoiseReduction { - - public static final class ModeKey extends Key<NoiseReduction.ModeKey.Enum> { - public enum Enum { - OFF, - FAST, - HIGH_QUALITY; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum FAST = Enum.FAST; - public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, NoiseReduction.ModeKey.Enum.class); - } - - } - - public static final Key<NoiseReduction.ModeKey.Enum> MODE = - new ModeKey("android.noiseReduction.mode"); - - } - - public static final class Request { - public static final Key<Integer> FRAME_COUNT = - new Key<Integer>("android.request.frameCount", int.class); - /** - * @hide - */ - public static final Key<Integer> ID = - new Key<Integer>("android.request.id", int.class); - - } - - public static final class Scaler { - public static final Key<android.graphics.Rect> CROP_REGION = - new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class); - - } - - public static final class Sensor { - public static final Key<Long> EXPOSURE_TIME = - new Key<Long>("android.sensor.exposureTime", long.class); - public static final Key<Long> FRAME_DURATION = - new Key<Long>("android.sensor.frameDuration", long.class); - public static final Key<Integer> SENSITIVITY = - new Key<Integer>("android.sensor.sensitivity", int.class); - public static final Key<Long> TIMESTAMP = - new Key<Long>("android.sensor.timestamp", long.class); - - } - - public static final class Statistics { - - public static final class FaceDetectModeKey extends Key<Statistics.FaceDetectModeKey.Enum> { - public enum Enum { - OFF, - SIMPLE, - FULL; - } - - public static final Enum OFF = Enum.OFF; - public static final Enum SIMPLE = Enum.SIMPLE; - public static final Enum FULL = Enum.FULL; - - // TODO: remove requirement for constructor by making Key an interface - private FaceDetectModeKey(String name) { - super(name, Statistics.FaceDetectModeKey.Enum.class); - } - - } - - public static final Key<Statistics.FaceDetectModeKey.Enum> FACE_DETECT_MODE = - new FaceDetectModeKey("android.statistics.faceDetectMode"); - public static final Key<int[]> FACE_IDS = - new Key<int[]>("android.statistics.faceIds", int[].class); - public static final Key<int[]> FACE_LANDMARKS = - new Key<int[]>("android.statistics.faceLandmarks", int[].class); - public static final Key<android.graphics.Rect[]> FACE_RECTANGLES = - new Key<android.graphics.Rect[]>("android.statistics.faceRectangles", android.graphics.Rect[].class); - public static final Key<byte[]> FACE_SCORES = - new Key<byte[]>("android.statistics.faceScores", byte[].class); - public static final Key<float[]> LENS_SHADING_MAP = - new Key<float[]>("android.statistics.lensShadingMap", float[].class); - public static final Key<float[]> PREDICTED_COLOR_GAINS = - new Key<float[]>("android.statistics.predictedColorGains", float[].class); - public static final Key<Rational[]> PREDICTED_COLOR_TRANSFORM = - new Key<Rational[]>("android.statistics.predictedColorTransform", Rational[].class); - - public static final class SceneFlickerKey extends Key<Statistics.SceneFlickerKey.Enum> { - public enum Enum { - NONE, - _50HZ, - _60HZ; - } - - public static final Enum NONE = Enum.NONE; - public static final Enum _50HZ = Enum._50HZ; - public static final Enum _60HZ = Enum._60HZ; - - // TODO: remove requirement for constructor by making Key an interface - private SceneFlickerKey(String name) { - super(name, Statistics.SceneFlickerKey.Enum.class); - } - - } - - public static final Key<Statistics.SceneFlickerKey.Enum> SCENE_FLICKER = - new SceneFlickerKey("android.statistics.sceneFlicker"); - - } - - public static final class Tonemap { - public static final Key<Float> CURVE_BLUE = - new Key<Float>("android.tonemap.curveBlue", float.class); - public static final Key<Float> CURVE_GREEN = - new Key<Float>("android.tonemap.curveGreen", float.class); - public static final Key<float[]> CURVE_RED = - new Key<float[]>("android.tonemap.curveRed", float[].class); - - public static final class ModeKey extends Key<Tonemap.ModeKey.Enum> { - public enum Enum { - CONTRAST_CURVE, - FAST, - HIGH_QUALITY; - } - - public static final Enum CONTRAST_CURVE = Enum.CONTRAST_CURVE; - public static final Enum FAST = Enum.FAST; - public static final Enum HIGH_QUALITY = Enum.HIGH_QUALITY; - - // TODO: remove requirement for constructor by making Key an interface - private ModeKey(String name) { - super(name, Tonemap.ModeKey.Enum.class); - } - - } - - public static final Key<Tonemap.ModeKey.Enum> MODE = - new ModeKey("android.tonemap.mode"); - - } - - /** - * @hide - */ - public static final class Led { - /** - * @hide - */ - public static final Key<Boolean> TRANSMIT = - new Key<Boolean>("android.led.transmit", boolean.class); - - } - - public static final class BlackLevel { - public static final Key<Boolean> LOCK = - new Key<Boolean>("android.blackLevel.lock", boolean.class); - - } - -} - - diff --git a/core/java/android/hardware/camera2/Rational.java b/core/java/android/hardware/camera2/Rational.java index 7ccc555..0260e02 100644 --- a/core/java/android/hardware/camera2/Rational.java +++ b/core/java/android/hardware/camera2/Rational.java @@ -85,7 +85,7 @@ public final class Rational { * * @param obj a reference to another object * - * @return boolean that determines whether or not the two Rational objects are equal. + * @return A boolean that determines whether or not the two Rational objects are equal. */ @Override public boolean equals(Object obj) { @@ -135,7 +135,7 @@ public final class Rational { /** * Calculates the greatest common divisor using Euclid's algorithm. * - * @return int value representing the gcd. Always positive. + * @return An int value representing the gcd. Always positive. * @hide */ public int gcd() { diff --git a/core/java/android/nfc/cardemulation/HostApduService.java b/core/java/android/nfc/cardemulation/HostApduService.java index 6d091c1..cdc4adb 100644 --- a/core/java/android/nfc/cardemulation/HostApduService.java +++ b/core/java/android/nfc/cardemulation/HostApduService.java @@ -4,11 +4,13 @@ import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.app.Service; import android.content.Intent; +import android.os.Binder; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; +import android.os.Parcel; import android.os.RemoteException; import android.util.Log; @@ -98,6 +100,12 @@ public abstract class HostApduService extends Service { public static final int MSG_DEACTIVATED = 2; /** + * + * @hide + */ + public static final int MSG_UNHANDLED = 3; + + /** * @hide */ public static final String KEY_DATA = "data"; @@ -105,6 +113,8 @@ public abstract class HostApduService extends Service { /** * Messenger interface to NfcService for sending responses. * Only accessed on main thread by the message handler. + * + * @hide */ Messenger mNfcService = null; @@ -133,6 +143,7 @@ public abstract class HostApduService extends Service { Bundle responseBundle = new Bundle(); responseBundle.putByteArray(KEY_DATA, responseApdu); responseMsg.setData(responseBundle); + responseMsg.replyTo = mMessenger; try { mNfcService.send(responseMsg); } catch (RemoteException e) { @@ -150,6 +161,7 @@ public abstract class HostApduService extends Service { return; } try { + msg.replyTo = mMessenger; mNfcService.send(msg); } catch (RemoteException e) { Log.e(TAG, "RemoteException calling into NfcService."); @@ -160,6 +172,18 @@ public abstract class HostApduService extends Service { mNfcService = null; onDeactivated(msg.arg1); break; + case MSG_UNHANDLED: + if (mNfcService == null) { + Log.e(TAG, "notifyUnhandled not sent; service was deactivated."); + return; + } + try { + msg.replyTo = mMessenger; + mNfcService.send(msg); + } catch (RemoteException e) { + Log.e(TAG, "RemoteException calling into NfcService."); + } + break; default: super.handleMessage(msg); } @@ -190,6 +214,64 @@ public abstract class HostApduService extends Service { } /** + * Calling this method allows the service to tell the OS + * that it won't be able to complete this transaction - + * for example, because it requires data connectivity + * that is not present at that moment. + * + * The OS may use this indication to give the user a list + * of alternative applications that can handle the last + * AID that was selected. If the user would select an + * application from the list, that action by itself + * will not cause the default to be changed; the selected + * application will be invoked for the next tap only. + * + * If there are no other applications that can handle + * this transaction, the OS will show an error dialog + * indicating your service could not complete the + * transaction. + * + * <p>Note: this method may be called anywhere between + * the first {@link #processCommandApdu(byte[], int)} + * call and a {@link #onDeactivated(int)} call. + */ + public final void notifyUnhandled() { + Message unhandledMsg = Message.obtain(null, MSG_UNHANDLED); + try { + mMessenger.send(unhandledMsg); + } catch (RemoteException e) { + Log.e("TAG", "Local messenger has died."); + } + } + + + /** + * <p>This method will be called when a command APDU has been received + * from a remote device. A response APDU can be provided directly + * by returning a byte-array in this method. Note that in general + * response APDUs must be sent as quickly as possible, given the fact + * that the user is likely holding his device over an NFC reader + * when this method is called. + * + * <p class="note">If there are multiple services that have registered for the same + * AIDs in their meta-data entry, you will only get called if the user has + * explicitly selected your service, either as a default or just for the next tap. + * + * <p class="note">This method is running on the main thread of your application. + * If you cannot return a response APDU immediately, return null + * and use the {@link #sendResponseApdu(byte[])} method later. + * + * @param commandApdu The APDU that received from the remote device + * @param extras A bundle containing extra data. May be null. + * @return a byte-array containing the response APDU, or null if no + * response APDU can be sent at this point. + */ + public byte[] processCommandApdu(byte[] commandApdu, Bundle extras) { + // TODO make this abstract + return processCommandApdu(commandApdu, 0); + } + + /** * <p>This method will be called when a command APDU has been received * from a remote device. A response APDU can be provided directly * by returning a byte-array in this method. Note that in general @@ -205,6 +287,7 @@ public abstract class HostApduService extends Service { * If you cannot return a response APDU immediately, return null * and use the {@link #sendResponseApdu(byte[])} method later. * + * @deprecated use {@link #processCommandApdu(byte[], Bundle)} * @param commandApdu * @param flags * @return a byte-array containing the response APDU, or null if no diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java index 91d349a..da7647a 100644 --- a/core/java/android/provider/DocumentsContract.java +++ b/core/java/android/provider/DocumentsContract.java @@ -38,7 +38,6 @@ import libcore.io.IoUtils; import java.io.FileDescriptor; import java.io.IOException; -import java.io.InputStream; import java.util.List; /** diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 585115a..fad6c73 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3269,6 +3269,23 @@ public final class Settings { public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; /** + * Location access disabled + */ + public static final int LOCATION_MODE_OFF = 0; + /** + * Network Location Provider disabled, but GPS and other sensors enabled. + */ + public static final int LOCATION_MODE_SENSORS_ONLY = 1; + /** + * Reduced power usage, such as limiting the number of GPS updates per hour. + */ + public static final int LOCATION_MODE_BATTERY_SAVING = 2; + /** + * Best-effort location computation allowed. + */ + public static final int LOCATION_MODE_HIGH_ACCURACY = 3; + + /** * A flag containing settings used for biometric weak * @hide */ @@ -4319,23 +4336,27 @@ public final class Settings { * @param cr the content resolver to use * @param provider the location provider to query * @return true if the provider is enabled + * @deprecated use {@link #getLocationMode(ContentResolver)} */ + @Deprecated public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId()); } /** * Helper method for determining if the location master switch is enabled. + * + * TODO: worth retaining this method? + * * @param cr the content resolver to use * @return true if the master switch is enabled + * @deprecated use {@link #getLocationMode(ContentResolver)} != {@link #LOCATION_MODE_OFF} * @hide */ + @Deprecated public static final boolean isLocationMasterSwitchEnabled(ContentResolver cr) { - int uid = UserHandle.myUserId(); - synchronized (mLocationSettingsLock) { - return isLocationProviderEnabledForUser(cr, LocationManager.NETWORK_PROVIDER, uid) - || isLocationProviderEnabledForUser(cr, LocationManager.GPS_PROVIDER, uid); - } + int mode = getLocationMode(cr); + return mode != LOCATION_MODE_OFF; } /** @@ -4344,8 +4365,10 @@ public final class Settings { * @param provider the location provider to query * @param userId the userId to query * @return true if the provider is enabled + * @deprecated use {@link #getLocationModeForUser(ContentResolver, int)} * @hide */ + @Deprecated public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) { String allowedProviders = Settings.Secure.getStringForUser(cr, LOCATION_PROVIDERS_ALLOWED, userId); @@ -4357,7 +4380,9 @@ public final class Settings { * @param cr the content resolver to use * @param provider the location provider to enable or disable * @param enabled true if the provider should be enabled + * @deprecated use {@link #setLocationMode(ContentResolver, int)} */ + @Deprecated public static final void setLocationProviderEnabled(ContentResolver cr, String provider, boolean enabled) { setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId()); @@ -4368,8 +4393,11 @@ public final class Settings { * * @param cr the content resolver to use * @param enabled true if master switch should be enabled + * @deprecated use {@link #setLocationMode(ContentResolver, int)} with + * {@link #LOCATION_MODE_HIGH_ACCURACY} * @hide */ + @Deprecated public static final void setLocationMasterSwitchEnabled(ContentResolver cr, boolean enabled) { int uid = UserHandle.myUserId(); @@ -4386,8 +4414,10 @@ public final class Settings { * @param provider the location provider to enable or disable * @param enabled true if the provider should be enabled * @param userId the userId for which to enable/disable providers + * @deprecated use {@link #setLocationModeForUser(ContentResolver, int, int)} * @hide */ + @Deprecated public static final void setLocationProviderEnabledForUser(ContentResolver cr, String provider, boolean enabled, int userId) { synchronized (mLocationSettingsLock) { @@ -4403,6 +4433,97 @@ public final class Settings { userId); } } + + /** + * Thread-safe method for setting the location mode to one of + * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, + * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. + * + * @param cr the content resolver to use + * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} + * @param userId the userId for which to change mode + * + * @throws IllegalArgumentException if mode is not one of the supported values + */ + public static final void setLocationModeForUser(ContentResolver cr, int mode, int userId) { + synchronized (mLocationSettingsLock) { + boolean gps = false; + boolean network = false; + switch (mode) { + case LOCATION_MODE_OFF: + break; + case LOCATION_MODE_SENSORS_ONLY: + gps = true; + break; + case LOCATION_MODE_BATTERY_SAVING: + network = true; + break; + case LOCATION_MODE_HIGH_ACCURACY: + gps = true; + network = true; + break; + default: + throw new IllegalArgumentException("Invalid location mode: " + mode); + } + Settings.Secure.setLocationProviderEnabledForUser( + cr, LocationManager.GPS_PROVIDER, gps, userId); + Settings.Secure.setLocationProviderEnabledForUser( + cr, LocationManager.NETWORK_PROVIDER, network, userId); + } + } + + /** + * Thread-safe method for setting the location mode to one of + * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, + * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. + * + * @param cr the content resolver to use + * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} + * + * @throws IllegalArgumentException if mode is not one of the supported values + */ + public static final void setLocationMode(ContentResolver cr, int mode) { + setLocationModeForUser(cr, mode, UserHandle.myUserId()); + } + + /** + * Thread-safe method for reading the location mode, returns one of + * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, + * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. + * + * @param cr the content resolver to use + * @param userId the userId for which to read the mode + * @return the location mode + */ + public static final int getLocationModeForUser(ContentResolver cr, int userId) { + synchronized (mLocationSettingsLock) { + boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser( + cr, LocationManager.GPS_PROVIDER, userId); + boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser( + cr, LocationManager.NETWORK_PROVIDER, userId); + if (gpsEnabled && networkEnabled) { + return LOCATION_MODE_HIGH_ACCURACY; + } else if (gpsEnabled) { + return LOCATION_MODE_SENSORS_ONLY; + } else if (networkEnabled) { + return LOCATION_MODE_BATTERY_SAVING; + } else { + return LOCATION_MODE_OFF; + } + } + } + + /** + * Thread-safe method for reading the location mode, returns one of + * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, + * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. + * + * @param cr the content resolver to use + * @return the location mode + */ + public static final int getLocationMode(ContentResolver cr) { + return getLocationModeForUser(cr, UserHandle.myUserId()); + } } /** diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index f711e7a..354e815 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -5960,6 +5960,11 @@ public final class ViewRootImpl implements ViewParent, // Do nothing. } + void changeCanvasOpacity(boolean opaque) { + // TODO(romainguy): recreate Canvas (software or hardware) to reflect the opacity change. + Log.d(TAG, "changeCanvasOpacity: opaque=" + opaque); + } + class TakenSurfaceHolder extends BaseSurfaceHolder { @Override public boolean onAllowLockCanvas() { diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java index 3dd96f5..96c0ed2 100644 --- a/core/java/android/view/WindowManagerGlobal.java +++ b/core/java/android/view/WindowManagerGlobal.java @@ -494,6 +494,21 @@ public final class WindowManagerGlobal { } } } + + /** @hide */ + public void changeCanvasOpacity(IBinder token, boolean opaque) { + if (token == null) { + return; + } + synchronized (mLock) { + for (int i = mParams.size() - 1; i >= 0; --i) { + if (mParams.get(i).token == token) { + mRoots.get(i).changeCanvasOpacity(opaque); + return; + } + } + } + } } final class WindowLeaked extends AndroidRuntimeException { diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java index e924e8b..6d54094 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java +++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java @@ -1341,7 +1341,6 @@ public class AccessibilityNodeInfo implements Parcelable { * @throws IllegalStateException If called from an AccessibilityService. */ public void setScrollable(boolean scrollable) { - enforceNotSealed(); setBooleanProperty(BOOLEAN_PROPERTY_SCROLLABLE, scrollable); } @@ -1495,7 +1494,6 @@ public class AccessibilityNodeInfo implements Parcelable { * @param liveRegion If the node is a live region. */ public void setLiveRegion(boolean liveRegion) { - enforceNotSealed(); setBooleanProperty(BOOLEAN_PROPERTY_LIVE_REGION, liveRegion); } @@ -1519,7 +1517,6 @@ public class AccessibilityNodeInfo implements Parcelable { * @param multiLine True if the node is multi line. */ public void setMultiLine(boolean multiLine) { - enforceNotSealed(); setBooleanProperty(BOOLEAN_PROPERTY_MULTI_LINE, multiLine); } @@ -1543,7 +1540,6 @@ public class AccessibilityNodeInfo implements Parcelable { * @param opensPopup If the the node opens a popup. */ public void setOpensPopup(boolean opensPopup) { - enforceNotSealed(); setBooleanProperty(BOOLEAN_PROPERTY_OPENS_POPUP, opensPopup); } @@ -1567,7 +1563,6 @@ public class AccessibilityNodeInfo implements Parcelable { * @param expandable If the node can be expanded. */ public void setExpandable(boolean expandable) { - enforceNotSealed(); setBooleanProperty(BOOLEAN_PROPERTY_EXPANDABLE, expandable); } @@ -1591,7 +1586,6 @@ public class AccessibilityNodeInfo implements Parcelable { * @param expanded If the node is expanded. */ public void setExpanded(boolean expanded) { - enforceNotSealed(); setBooleanProperty(BOOLEAN_PROPERTY_EXPANDED, expanded); } @@ -1615,7 +1609,6 @@ public class AccessibilityNodeInfo implements Parcelable { * @param dismissable If the node can be dismissed. */ public void setDismissable(boolean dismissable) { - enforceNotSealed(); setBooleanProperty(BOOLEAN_PROPERTY_DISMISSABLE, dismissable); } @@ -1929,6 +1922,7 @@ public class AccessibilityNodeInfo implements Parcelable { * @throws IllegalStateException If called from an AccessibilityService. */ public void setInputType(int inputType) { + enforceNotSealed(); mInputType = inputType; } |
