summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk11
-rw-r--r--api/current.txt163
-rw-r--r--api/system-current.txt163
-rw-r--r--cmds/wm/src/com/android/commands/wm/Wm.java46
-rw-r--r--core/java/android/app/ActivityManager.java23
-rw-r--r--core/java/android/app/SystemServiceRegistry.java8
-rw-r--r--core/java/android/app/trust/ITrustListener.aidl2
-rw-r--r--core/java/android/app/trust/TrustManager.java22
-rw-r--r--core/java/android/content/Context.java13
-rw-r--r--core/java/android/content/pm/ActivityInfo.java7
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java4
-rw-r--r--core/java/android/content/pm/PackageParser.java5
-rw-r--r--core/java/android/nfc/IAppCallback.aidl4
-rw-r--r--core/java/android/nfc/NfcActivityManager.java15
-rw-r--r--core/java/android/nfc/NfcEvent.java9
-rw-r--r--core/java/android/os/BatteryStats.java200
-rw-r--r--core/java/android/provider/Settings.java7
-rw-r--r--core/java/android/security/NetworkSecurityPolicy.java6
-rw-r--r--core/java/android/security/keymaster/KeymasterArgument.java1
-rw-r--r--core/java/android/security/keymaster/KeymasterArguments.java28
-rw-r--r--core/java/android/security/keymaster/KeymasterDefs.java4
-rw-r--r--core/java/android/security/keymaster/KeymasterLongArgument.java1
-rw-r--r--core/java/android/service/carrier/CarrierConfigService.java104
-rw-r--r--core/java/android/service/carrier/CarrierIdentifier.aidl19
-rw-r--r--core/java/android/service/carrier/CarrierIdentifier.java117
-rw-r--r--core/java/android/service/carrier/ICarrierConfigService.aidl32
-rw-r--r--core/java/android/service/gatekeeper/IGateKeeperService.aidl18
-rw-r--r--core/java/android/service/trust/ITrustAgentServiceCallback.aidl2
-rw-r--r--core/java/android/service/trust/TrustAgentService.java62
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java23
-rw-r--r--core/java/android/text/TextDirectionHeuristics.java120
-rw-r--r--core/java/android/text/method/BaseKeyListener.java2
-rw-r--r--core/java/android/view/Display.java9
-rw-r--r--core/java/android/view/DisplayInfo.java3
-rw-r--r--core/java/android/view/IWindowManager.aidl1
-rw-r--r--core/java/android/view/View.java8
-rw-r--r--core/java/android/view/ViewGroup.java188
-rw-r--r--core/java/android/widget/AbsSeekBar.java37
-rw-r--r--core/java/android/widget/FastScroller.java9
-rw-r--r--core/java/android/widget/GridView.java3
-rw-r--r--core/java/android/widget/LinearLayout.java7
-rw-r--r--core/java/android/widget/ListView.java14
-rw-r--r--core/java/android/widget/ProgressBar.java22
-rw-r--r--core/java/android/widget/ScrollView.java8
-rw-r--r--core/java/android/widget/Spinner.java4
-rw-r--r--core/java/android/widget/TabWidget.java5
-rw-r--r--core/java/android/widget/TableLayout.java6
-rw-r--r--core/java/android/widget/TableRow.java6
-rw-r--r--core/java/com/android/internal/app/IBatteryStats.aidl3
-rw-r--r--core/java/com/android/internal/os/BatteryStatsHelper.java17
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java271
-rw-r--r--core/java/com/android/internal/os/WifiPowerCalculator.java2
-rw-r--r--core/java/com/android/internal/os/WifiPowerEstimator.java2
-rw-r--r--core/java/com/android/internal/widget/ActionBarContextView.java3
-rw-r--r--core/java/com/android/internal/widget/FloatingToolbar.java3
-rw-r--r--core/java/com/android/internal/widget/SlidingTab.java16
-rw-r--r--core/jni/android_media_AudioTrack.cpp9
-rw-r--r--core/res/AndroidManifest.xml28
-rw-r--r--core/res/res/drawable/btn_colored_material.xml35
-rw-r--r--core/res/res/values/attrs_manifest.xml11
-rw-r--r--core/res/res/values/public.xml3
-rw-r--r--core/res/res/values/strings.xml102
-rw-r--r--core/res/res/values/styles_material.xml7
-rw-r--r--docs/html/guide/topics/manifest/application-element.jd27
-rw-r--r--keystore/java/android/security/AndroidKeyStore.java6
-rw-r--r--keystore/java/android/security/GateKeeper.java30
-rw-r--r--keystore/java/android/security/KeyStoreKeyGeneratorSpi.java6
-rw-r--r--keystore/java/android/security/KeyStoreKeyProperties.java12
-rw-r--r--libs/hwui/OpenGLRenderer.cpp3
-rw-r--r--media/java/android/media/AudioTrack.java35
-rw-r--r--media/java/android/media/MediaSync.java26
-rw-r--r--packages/DocumentsUI/res/layout/dialog_create_dir.xml3
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java26
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java9
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java4
-rw-r--r--packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java5
-rw-r--r--packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java5
-rw-r--r--rs/java/android/renderscript/ScriptIntrinsicBLAS.java2
-rw-r--r--services/core/java/com/android/server/LockSettingsService.java4
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java21
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java21
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java2
-rw-r--r--services/core/java/com/android/server/am/BatteryStatsService.java91
-rw-r--r--services/core/java/com/android/server/display/DisplayDevice.java4
-rw-r--r--services/core/java/com/android/server/display/DisplayDeviceInfo.java63
-rw-r--r--services/core/java/com/android/server/display/DisplayManagerService.java27
-rw-r--r--services/core/java/com/android/server/display/LogicalDisplay.java5
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java6
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiControlService.java6
-rw-r--r--services/core/java/com/android/server/hdmi/HotplugDetectionAction.java11
-rw-r--r--services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java23
-rw-r--r--services/core/java/com/android/server/job/controllers/AppIdleController.java11
-rw-r--r--services/core/java/com/android/server/location/GpsLocationProvider.java160
-rw-r--r--services/core/java/com/android/server/trust/TrustAgentWrapper.java20
-rw-r--r--services/core/java/com/android/server/trust/TrustArchive.java43
-rw-r--r--services/core/java/com/android/server/trust/TrustManagerService.java16
-rw-r--r--services/core/java/com/android/server/wm/AppWindowToken.java2
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java4
-rw-r--r--services/core/java/com/android/server/wm/Task.java4
-rw-r--r--services/core/java/com/android/server/wm/TaskStack.java13
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java69
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java9
-rw-r--r--telecomm/java/android/telecom/Call.java110
-rw-r--r--telecomm/java/android/telecom/Connection.java78
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java12
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapter.java22
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapterServant.java11
-rw-r--r--telecomm/java/android/telecom/InCallService.java29
-rw-r--r--telecomm/java/android/telecom/ParcelableCall.java18
-rw-r--r--telecomm/java/android/telecom/ParcelableConnection.java14
-rw-r--r--telecomm/java/android/telecom/Phone.java16
-rw-r--r--telecomm/java/android/telecom/RemoteConnection.java30
-rw-r--r--telecomm/java/android/telecom/RemoteConnectionService.java7
-rw-r--r--telecomm/java/android/telecom/VideoCallImpl.java22
-rw-r--r--telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl2
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java219
-rw-r--r--telephony/java/com/android/ims/internal/IImsCallSession.aidl7
-rw-r--r--telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl31
-rw-r--r--tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java4
120 files changed, 2470 insertions, 1093 deletions
diff --git a/Android.mk b/Android.mk
index 122347536058..bd8b16a8ea1f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -209,6 +209,7 @@ LOCAL_SRC_FILES += \
core/java/android/os/IUserManager.aidl \
core/java/android/os/IVibratorService.aidl \
core/java/android/security/IKeystoreService.aidl \
+ core/java/android/service/carrier/ICarrierConfigService.aidl \
core/java/android/service/carrier/ICarrierMessagingCallback.aidl \
core/java/android/service/carrier/ICarrierMessagingService.aidl \
core/java/android/service/gatekeeper/IGateKeeperService.aidl \
@@ -390,15 +391,16 @@ LOCAL_SRC_FILES += \
telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl \
telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl \
telephony/java/com/android/ims/ImsConfigListener.aidl \
+ telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl \
+ telephony/java/com/android/internal/telephony/IMms.aidl \
+ telephony/java/com/android/internal/telephony/IOnSubscriptionsChangedListener.aidl \
telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \
telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \
+ telephony/java/com/android/internal/telephony/ISms.aidl \
+ telephony/java/com/android/internal/telephony/ISub.aidl \
telephony/java/com/android/internal/telephony/ITelephony.aidl \
telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \
- telephony/java/com/android/internal/telephony/IOnSubscriptionsChangedListener.aidl \
- telephony/java/com/android/internal/telephony/ISms.aidl \
telephony/java/com/android/internal/telephony/IWapPushManager.aidl \
- telephony/java/com/android/internal/telephony/ISub.aidl \
- telephony/java/com/android/internal/telephony/IMms.aidl \
wifi/java/android/net/wifi/IWifiManager.aidl \
wifi/java/android/net/wifi/passpoint/IWifiPasspointManager.aidl \
wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \
@@ -549,6 +551,7 @@ aidl_files := \
frameworks/base/core/java/android/view/textservice/SpellCheckerInfo.aidl \
frameworks/base/core/java/android/view/textservice/SentenceSuggestionsInfo.aidl \
frameworks/base/core/java/android/view/textservice/SuggestionsInfo.aidl \
+ frameworks/base/core/java/android/service/carrier/CarrierIdentifier.aidl \
frameworks/base/core/java/android/service/carrier/MessagePdu.aidl \
frameworks/base/core/java/android/service/notification/StatusBarNotification.aidl \
frameworks/base/core/java/android/service/chooser/ChooserTarget.aidl \
diff --git a/api/current.txt b/api/current.txt
index 3947aae383b9..4375e6f4ff0e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -20,6 +20,7 @@ package android {
field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS";
field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE";
field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET";
+ field public static final java.lang.String BIND_CARRIER_CONFIG_SERVICE = "android.permission.BIND_CARRIER_CONFIG_SERVICE";
field public static final java.lang.String BIND_CARRIER_MESSAGING_SERVICE = "android.permission.BIND_CARRIER_MESSAGING_SERVICE";
field public static final java.lang.String BIND_CHOOSER_TARGET_SERVICE = "android.permission.BIND_CHOOSER_TARGET_SERVICE";
field public static final java.lang.String BIND_DEVICE_ADMIN = "android.permission.BIND_DEVICE_ADMIN";
@@ -1098,7 +1099,8 @@ package android {
field public static final int showAsAction = 16843481; // 0x10102d9
field public static final int showDefault = 16843258; // 0x10101fa
field public static final int showDividers = 16843561; // 0x1010329
- field public static final int showOnLockScreen = 16843721; // 0x10103c9
+ field public static final int showForAllUsers = 16844018; // 0x10104f2
+ field public static final deprecated int showOnLockScreen = 16843721; // 0x10103c9
field public static final int showSilent = 16843259; // 0x10101fb
field public static final int showText = 16843949; // 0x10104ad
field public static final deprecated int showWeekNumber = 16843582; // 0x101033e
@@ -1978,6 +1980,7 @@ package android {
field public static final int TextAppearance_Material_Widget_ActionMode_Title = 16974355; // 0x1030213
field public static final int TextAppearance_Material_Widget_ActionMode_Title_Inverse = 16974356; // 0x1030214
field public static final int TextAppearance_Material_Widget_Button = 16974357; // 0x1030215
+ field public static final int TextAppearance_Material_Widget_Button_Inverse = 16974565; // 0x10302e5
field public static final int TextAppearance_Material_Widget_DropDownHint = 16974358; // 0x1030216
field public static final int TextAppearance_Material_Widget_DropDownItem = 16974359; // 0x1030217
field public static final int TextAppearance_Material_Widget_EditText = 16974360; // 0x1030218
@@ -3633,12 +3636,15 @@ package android.app {
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.app.ActivityManager.RecentTaskInfo> CREATOR;
field public int affiliatedTaskId;
+ field public android.content.ComponentName baseActivity;
field public android.content.Intent baseIntent;
field public java.lang.CharSequence description;
field public int id;
+ field public int numActivities;
field public android.content.ComponentName origActivity;
field public int persistentId;
field public android.app.ActivityManager.TaskDescription taskDescription;
+ field public android.content.ComponentName topActivity;
}
public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable {
@@ -7740,6 +7746,7 @@ package android.content {
field public static final java.lang.String BLUETOOTH_SERVICE = "bluetooth";
field public static final java.lang.String CAMERA_SERVICE = "camera";
field public static final java.lang.String CAPTIONING_SERVICE = "captioning";
+ field public static final java.lang.String CARRIER_CONFIG_SERVICE = "carrier_config";
field public static final java.lang.String CLIPBOARD_SERVICE = "clipboard";
field public static final java.lang.String CONNECTIVITY_SERVICE = "connectivity";
field public static final java.lang.String CONSUMER_IR_SERVICE = "consumer_ir";
@@ -14965,6 +14972,7 @@ package android.media {
method public int getPlaybackHeadPosition();
method public int getPlaybackRate();
method public int getPositionNotificationPeriod();
+ method public android.media.AudioDeviceInfo getPreferredOutputDevice();
method public int getSampleRate();
method public int getState();
method public int getStreamType();
@@ -14981,6 +14989,7 @@ package android.media {
method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener, android.os.Handler);
method public int setPlaybackRate(int);
method public int setPositionNotificationPeriod(int);
+ method public boolean setPreferredOutputDevice(android.media.AudioDeviceInfo);
method protected deprecated void setState(int);
method public deprecated int setStereoVolume(float, float);
method public int setVolume(float);
@@ -16292,7 +16301,7 @@ package android.media {
public final class MediaSync {
ctor public MediaSync();
- method public void configureAudioTrack(android.media.AudioTrack, int);
+ method public void configureAudioTrack(android.media.AudioTrack);
method public void configureSurface(android.view.Surface);
method public final android.view.Surface createInputSurface();
method public boolean getTimestamp(android.media.MediaTimestamp);
@@ -19678,6 +19687,7 @@ package android.nfc {
public final class NfcEvent {
field public final android.nfc.NfcAdapter nfcAdapter;
+ field public final byte peerLlcpVersion;
}
public final class NfcManager {
@@ -28000,6 +28010,62 @@ package android.renderscript {
method public void setLUT(android.renderscript.Allocation);
}
+ public final class ScriptIntrinsicBLAS extends android.renderscript.ScriptIntrinsic {
+ method public void BNNM(android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation, int, int);
+ method public void CGEMM(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+ method public void CHEMM(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void CHER2K(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void CHERK(int, int, float, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void CSYMM(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+ method public void CSYR2K(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+ method public void CSYRK(int, int, float, float, android.renderscript.Allocation, float, float, android.renderscript.Allocation);
+ method public void CTRMM(int, int, int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void CTRSM(int, int, int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void DGEMM(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void DSYMM(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void DSYR2K(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void DSYRK(int, int, double, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void DTRMM(int, int, int, int, double, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void DTRSM(int, int, int, int, double, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void SGEMM(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void SSYMM(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void SSYR2K(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void SSYRK(int, int, float, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void STRMM(int, int, int, int, float, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void STRSM(int, int, int, int, float, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void ZGEMM(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+ method public void ZHEMM(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void ZHER2K(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void ZHERK(int, int, double, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void ZSYMM(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+ method public void ZSYR2K(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+ method public void ZSYRK(int, int, double, double, android.renderscript.Allocation, double, double, android.renderscript.Allocation);
+ method public void ZTRMM(int, int, int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void ZTRSM(int, int, int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public static android.renderscript.ScriptIntrinsicBLAS create(android.renderscript.RenderScript);
+ field public static final int CONJ_TRANSPOSE = 113; // 0x71
+ field public static final int LEFT = 141; // 0x8d
+ field public static final int LOWER = 122; // 0x7a
+ field public static final int NON_UNIT = 131; // 0x83
+ field public static final int NO_TRANSPOSE = 111; // 0x6f
+ field public static final int RIGHT = 142; // 0x8e
+ field public static final int TRANSPOSE = 112; // 0x70
+ field public static final int UNIT = 132; // 0x84
+ field public static final int UPPER = 121; // 0x79
+ }
+
+ public static abstract class ScriptIntrinsicBLAS.Diag implements java.lang.annotation.Annotation {
+ }
+
+ public static abstract class ScriptIntrinsicBLAS.Side implements java.lang.annotation.Annotation {
+ }
+
+ public static abstract class ScriptIntrinsicBLAS.Transpose implements java.lang.annotation.Annotation {
+ }
+
+ public static abstract class ScriptIntrinsicBLAS.Uplo implements java.lang.annotation.Annotation {
+ }
+
public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic {
method public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element);
method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation);
@@ -28410,6 +28476,7 @@ package android.security {
public static abstract class KeyStoreKeyProperties.Origin {
field public static final int GENERATED = 1; // 0x1
field public static final int IMPORTED = 2; // 0x2
+ field public static final int UNKNOWN = 4; // 0x4
}
public static abstract class KeyStoreKeyProperties.OriginEnum implements java.lang.annotation.Annotation {
@@ -28508,6 +28575,26 @@ package android.security {
package android.service.carrier {
+ public abstract class CarrierConfigService extends android.app.Service {
+ ctor public CarrierConfigService();
+ method public final android.os.IBinder onBind(android.content.Intent);
+ method public abstract android.os.Bundle onLoadConfig(android.service.carrier.CarrierIdentifier);
+ field public static final java.lang.String SERVICE_INTERFACE = "android.service.carrier.CarrierConfigService";
+ }
+
+ public class CarrierIdentifier implements android.os.Parcelable {
+ ctor public CarrierIdentifier(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String);
+ method public int describeContents();
+ method public java.lang.String getGid1();
+ method public java.lang.String getGid2();
+ method public java.lang.String getImsi();
+ method public java.lang.String getMcc();
+ method public java.lang.String getMnc();
+ method public java.lang.String getSpn();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<android.service.carrier.CarrierIdentifier> CREATOR;
+ }
+
public abstract class CarrierMessagingService extends android.app.Service {
ctor public CarrierMessagingService();
method public android.os.IBinder onBind(android.content.Intent);
@@ -29881,7 +29968,6 @@ package android.telecom {
}
public final class Call {
- method public void addListener(android.telecom.Call.Listener);
method public void answer(int);
method public void conference(android.telecom.Call);
method public void disconnect();
@@ -29898,12 +29984,13 @@ package android.telecom {
method public void phoneAccountSelected(android.telecom.PhoneAccountHandle, boolean);
method public void playDtmfTone(char);
method public void postDialContinue(boolean);
+ method public void registerCallback(android.telecom.Call.Callback);
method public void reject(boolean, java.lang.String);
- method public void removeListener(android.telecom.Call.Listener);
method public void splitFromConference();
method public void stopDtmfTone();
method public void swapConference();
method public void unhold();
+ method public void unregisterCallback(android.telecom.Call.Callback);
field public static final java.lang.String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_CONNECTING = 9; // 0x9
@@ -29916,6 +30003,19 @@ package android.telecom {
field public static final int STATE_RINGING = 2; // 0x2
}
+ public static abstract class Call.Callback {
+ ctor public Call.Callback();
+ method public void onCallDestroyed(android.telecom.Call);
+ method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
+ method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+ method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+ method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
+ method public void onParentChanged(android.telecom.Call, android.telecom.Call);
+ method public void onPostDialWait(android.telecom.Call, java.lang.String);
+ method public void onStateChanged(android.telecom.Call, int);
+ method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
+ }
+
public static class Call.Details {
method public static boolean can(int, int);
method public boolean can(int);
@@ -29954,19 +30054,6 @@ package android.telecom {
field public static final int CAPABILITY_WIFI = 65536; // 0x10000
}
- public static abstract class Call.Listener {
- ctor public Call.Listener();
- method public void onCallDestroyed(android.telecom.Call);
- method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
- method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
- method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
- method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
- method public void onParentChanged(android.telecom.Call, android.telecom.Call);
- method public void onPostDialWait(android.telecom.Call, java.lang.String);
- method public void onStateChanged(android.telecom.Call, int);
- method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
- }
-
public class CallProperties {
ctor public CallProperties();
field public static final int CONFERENCE = 1; // 0x1
@@ -30215,6 +30302,7 @@ package android.telecom {
public static abstract class InCallService.VideoCall {
ctor public InCallService.VideoCall();
+ method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback);
method public abstract void requestCallDataUsage();
method public abstract void requestCameraCapabilities();
method public abstract void sendSessionModifyRequest(android.telecom.VideoProfile);
@@ -30224,12 +30312,11 @@ package android.telecom {
method public abstract void setDisplaySurface(android.view.Surface);
method public abstract void setPauseImage(java.lang.String);
method public abstract void setPreviewSurface(android.view.Surface);
- method public abstract void setVideoCallListener(android.telecom.InCallService.VideoCall.Listener);
method public abstract void setZoom(float);
}
- public static abstract class InCallService.VideoCall.Listener {
- ctor public InCallService.VideoCall.Listener();
+ public static abstract class InCallService.VideoCall.Callback {
+ ctor public InCallService.VideoCall.Callback();
method public abstract void onCallDataUsageChanged(long);
method public abstract void onCallSessionEvent(int);
method public abstract void onCameraCapabilitiesChanged(android.telecom.CameraCapabilities);
@@ -30239,25 +30326,6 @@ package android.telecom {
method public abstract void onVideoQualityChanged(int);
}
- public final class Phone {
- method public final void addListener(android.telecom.Phone.Listener);
- method public final boolean canAddCall();
- method public final android.telecom.AudioState getAudioState();
- method public final java.util.List<android.telecom.Call> getCalls();
- method public final void removeListener(android.telecom.Phone.Listener);
- method public final void setAudioRoute(int);
- method public final void setMuted(boolean);
- }
-
- public static abstract class Phone.Listener {
- ctor public Phone.Listener();
- method public void onAudioStateChanged(android.telecom.Phone, android.telecom.AudioState);
- method public void onBringToForeground(android.telecom.Phone, boolean);
- method public void onCallAdded(android.telecom.Phone, android.telecom.Call);
- method public void onCallRemoved(android.telecom.Phone, android.telecom.Call);
- method public void onCanAddCallChanged(android.telecom.Phone, boolean);
- }
-
public class PhoneAccount implements android.os.Parcelable {
method public static android.telecom.PhoneAccount.Builder builder(android.telecom.PhoneAccountHandle, java.lang.CharSequence);
method public android.graphics.drawable.Drawable createIconDrawable(android.content.Context);
@@ -30480,6 +30548,18 @@ package android.telecom {
package android.telephony {
+ public class CarrierConfigManager {
+ method public android.os.Bundle getConfig();
+ method public android.os.Bundle getConfigForSubId(int);
+ method public void reloadCarrierConfigForSubId(int);
+ field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
+ field public static final java.lang.String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available";
+ field public static final java.lang.String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned";
+ field public static final java.lang.String BOOL_CARRIER_VOLTE_TTY_SUPPORTED = "bool_carrier_volte_tty_supported";
+ field public static final java.lang.String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
+ field public static final java.lang.String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat";
+ }
+
public final class CellIdentityCdma implements android.os.Parcelable {
method public int describeContents();
method public int getBasestationId();
@@ -36480,6 +36560,7 @@ package android.view {
ctor public ViewGroup(android.content.Context, android.util.AttributeSet, int);
ctor public ViewGroup(android.content.Context, android.util.AttributeSet, int, int);
method public boolean addStatesFromChildren();
+ method public void addTransientView(android.view.View, int);
method public void addView(android.view.View);
method public void addView(android.view.View, int);
method public void addView(android.view.View, int, int);
@@ -36531,6 +36612,9 @@ package android.view {
method public int getNestedScrollAxes();
method public int getPersistentDrawingCache();
method public boolean getTouchscreenBlocksFocus();
+ method public android.view.View getTransientView(int);
+ method public int getTransientViewCount();
+ method public int getTransientViewIndex(int);
method public int indexOfChild(android.view.View);
method public final void invalidateChild(android.view.View, android.graphics.Rect);
method public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
@@ -36564,6 +36648,7 @@ package android.view {
method public void removeAllViews();
method public void removeAllViewsInLayout();
method protected void removeDetachedView(android.view.View, boolean);
+ method public void removeTransientView(android.view.View);
method public void removeView(android.view.View);
method public void removeViewAt(int);
method public void removeViewInLayout(android.view.View);
diff --git a/api/system-current.txt b/api/system-current.txt
index 57a7503c20dd..363967373791 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -28,6 +28,7 @@ package android {
field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS";
field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE";
field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET";
+ field public static final java.lang.String BIND_CARRIER_CONFIG_SERVICE = "android.permission.BIND_CARRIER_CONFIG_SERVICE";
field public static final java.lang.String BIND_CARRIER_MESSAGING_SERVICE = "android.permission.BIND_CARRIER_MESSAGING_SERVICE";
field public static final java.lang.String BIND_CHOOSER_TARGET_SERVICE = "android.permission.BIND_CHOOSER_TARGET_SERVICE";
field public static final java.lang.String BIND_CONDITION_PROVIDER_SERVICE = "android.permission.BIND_CONDITION_PROVIDER_SERVICE";
@@ -1175,7 +1176,8 @@ package android {
field public static final int showAsAction = 16843481; // 0x10102d9
field public static final int showDefault = 16843258; // 0x10101fa
field public static final int showDividers = 16843561; // 0x1010329
- field public static final int showOnLockScreen = 16843721; // 0x10103c9
+ field public static final int showForAllUsers = 16844018; // 0x10104f2
+ field public static final deprecated int showOnLockScreen = 16843721; // 0x10103c9
field public static final int showSilent = 16843259; // 0x10101fb
field public static final int showText = 16843949; // 0x10104ad
field public static final deprecated int showWeekNumber = 16843582; // 0x101033e
@@ -2057,6 +2059,7 @@ package android {
field public static final int TextAppearance_Material_Widget_ActionMode_Title = 16974355; // 0x1030213
field public static final int TextAppearance_Material_Widget_ActionMode_Title_Inverse = 16974356; // 0x1030214
field public static final int TextAppearance_Material_Widget_Button = 16974357; // 0x1030215
+ field public static final int TextAppearance_Material_Widget_Button_Inverse = 16974565; // 0x10302e5
field public static final int TextAppearance_Material_Widget_DropDownHint = 16974358; // 0x1030216
field public static final int TextAppearance_Material_Widget_DropDownItem = 16974359; // 0x1030217
field public static final int TextAppearance_Material_Widget_EditText = 16974360; // 0x1030218
@@ -3722,12 +3725,15 @@ package android.app {
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.app.ActivityManager.RecentTaskInfo> CREATOR;
field public int affiliatedTaskId;
+ field public android.content.ComponentName baseActivity;
field public android.content.Intent baseIntent;
field public java.lang.CharSequence description;
field public int id;
+ field public int numActivities;
field public android.content.ComponentName origActivity;
field public int persistentId;
field public android.app.ActivityManager.TaskDescription taskDescription;
+ field public android.content.ComponentName topActivity;
}
public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable {
@@ -7956,6 +7962,7 @@ package android.content {
field public static final java.lang.String BLUETOOTH_SERVICE = "bluetooth";
field public static final java.lang.String CAMERA_SERVICE = "camera";
field public static final java.lang.String CAPTIONING_SERVICE = "captioning";
+ field public static final java.lang.String CARRIER_CONFIG_SERVICE = "carrier_config";
field public static final java.lang.String CLIPBOARD_SERVICE = "clipboard";
field public static final java.lang.String CONNECTIVITY_SERVICE = "connectivity";
field public static final java.lang.String CONSUMER_IR_SERVICE = "consumer_ir";
@@ -16177,6 +16184,7 @@ package android.media {
method public int getPlaybackHeadPosition();
method public int getPlaybackRate();
method public int getPositionNotificationPeriod();
+ method public android.media.AudioDeviceInfo getPreferredOutputDevice();
method public int getSampleRate();
method public int getState();
method public int getStreamType();
@@ -16193,6 +16201,7 @@ package android.media {
method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener, android.os.Handler);
method public int setPlaybackRate(int);
method public int setPositionNotificationPeriod(int);
+ method public boolean setPreferredOutputDevice(android.media.AudioDeviceInfo);
method protected deprecated void setState(int);
method public deprecated int setStereoVolume(float, float);
method public int setVolume(float);
@@ -17507,7 +17516,7 @@ package android.media {
public final class MediaSync {
ctor public MediaSync();
- method public void configureAudioTrack(android.media.AudioTrack, int);
+ method public void configureAudioTrack(android.media.AudioTrack);
method public void configureSurface(android.view.Surface);
method public final android.view.Surface createInputSurface();
method public boolean getTimestamp(android.media.MediaTimestamp);
@@ -21566,6 +21575,7 @@ package android.nfc {
public final class NfcEvent {
field public final android.nfc.NfcAdapter nfcAdapter;
+ field public final byte peerLlcpVersion;
}
public final class NfcManager {
@@ -30003,6 +30013,62 @@ package android.renderscript {
method public void setLUT(android.renderscript.Allocation);
}
+ public final class ScriptIntrinsicBLAS extends android.renderscript.ScriptIntrinsic {
+ method public void BNNM(android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation, int, int);
+ method public void CGEMM(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+ method public void CHEMM(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void CHER2K(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void CHERK(int, int, float, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void CSYMM(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+ method public void CSYR2K(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+ method public void CSYRK(int, int, float, float, android.renderscript.Allocation, float, float, android.renderscript.Allocation);
+ method public void CTRMM(int, int, int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void CTRSM(int, int, int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void DGEMM(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void DSYMM(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void DSYR2K(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void DSYRK(int, int, double, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void DTRMM(int, int, int, int, double, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void DTRSM(int, int, int, int, double, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void SGEMM(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void SSYMM(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void SSYR2K(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void SSYRK(int, int, float, android.renderscript.Allocation, float, android.renderscript.Allocation);
+ method public void STRMM(int, int, int, int, float, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void STRSM(int, int, int, int, float, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void ZGEMM(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+ method public void ZHEMM(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void ZHER2K(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void ZHERK(int, int, double, android.renderscript.Allocation, double, android.renderscript.Allocation);
+ method public void ZSYMM(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+ method public void ZSYR2K(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+ method public void ZSYRK(int, int, double, double, android.renderscript.Allocation, double, double, android.renderscript.Allocation);
+ method public void ZTRMM(int, int, int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public void ZTRSM(int, int, int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation);
+ method public static android.renderscript.ScriptIntrinsicBLAS create(android.renderscript.RenderScript);
+ field public static final int CONJ_TRANSPOSE = 113; // 0x71
+ field public static final int LEFT = 141; // 0x8d
+ field public static final int LOWER = 122; // 0x7a
+ field public static final int NON_UNIT = 131; // 0x83
+ field public static final int NO_TRANSPOSE = 111; // 0x6f
+ field public static final int RIGHT = 142; // 0x8e
+ field public static final int TRANSPOSE = 112; // 0x70
+ field public static final int UNIT = 132; // 0x84
+ field public static final int UPPER = 121; // 0x79
+ }
+
+ public static abstract class ScriptIntrinsicBLAS.Diag implements java.lang.annotation.Annotation {
+ }
+
+ public static abstract class ScriptIntrinsicBLAS.Side implements java.lang.annotation.Annotation {
+ }
+
+ public static abstract class ScriptIntrinsicBLAS.Transpose implements java.lang.annotation.Annotation {
+ }
+
+ public static abstract class ScriptIntrinsicBLAS.Uplo implements java.lang.annotation.Annotation {
+ }
+
public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic {
method public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element);
method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation);
@@ -30413,6 +30479,7 @@ package android.security {
public static abstract class KeyStoreKeyProperties.Origin {
field public static final int GENERATED = 1; // 0x1
field public static final int IMPORTED = 2; // 0x2
+ field public static final int UNKNOWN = 4; // 0x4
}
public static abstract class KeyStoreKeyProperties.OriginEnum implements java.lang.annotation.Annotation {
@@ -30511,6 +30578,26 @@ package android.security {
package android.service.carrier {
+ public abstract class CarrierConfigService extends android.app.Service {
+ ctor public CarrierConfigService();
+ method public final android.os.IBinder onBind(android.content.Intent);
+ method public abstract android.os.Bundle onLoadConfig(android.service.carrier.CarrierIdentifier);
+ field public static final java.lang.String SERVICE_INTERFACE = "android.service.carrier.CarrierConfigService";
+ }
+
+ public class CarrierIdentifier implements android.os.Parcelable {
+ ctor public CarrierIdentifier(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String);
+ method public int describeContents();
+ method public java.lang.String getGid1();
+ method public java.lang.String getGid2();
+ method public java.lang.String getImsi();
+ method public java.lang.String getMcc();
+ method public java.lang.String getMnc();
+ method public java.lang.String getSpn();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<android.service.carrier.CarrierIdentifier> CREATOR;
+ }
+
public abstract class CarrierMessagingService extends android.app.Service {
ctor public CarrierMessagingService();
method public android.os.IBinder onBind(android.content.Intent);
@@ -30856,7 +30943,8 @@ package android.service.trust {
public class TrustAgentService extends android.app.Service {
ctor public TrustAgentService();
- method public final void grantTrust(java.lang.CharSequence, long, boolean);
+ method public final deprecated void grantTrust(java.lang.CharSequence, long, boolean);
+ method public final void grantTrust(java.lang.CharSequence, long, int);
method public final android.os.IBinder onBind(android.content.Intent);
method public boolean onConfigure(java.util.List<android.os.PersistableBundle>);
method public void onDeviceLocked();
@@ -30865,6 +30953,8 @@ package android.service.trust {
method public void onUnlockAttempt(boolean);
method public final void revokeTrust();
method public final void setManagingTrust(boolean);
+ field public static final int FLAG_GRANT_TRUST_DISMISS_KEYGUARD = 2; // 0x2
+ field public static final int FLAG_GRANT_TRUST_INITIATED_BY_USER = 1; // 0x1
field public static final java.lang.String SERVICE_INTERFACE = "android.service.trust.TrustAgentService";
field public static final java.lang.String TRUST_AGENT_META_DATA = "android.service.trust.trustagent";
}
@@ -31981,7 +32071,7 @@ package android.telecom {
}
public final class Call {
- method public void addListener(android.telecom.Call.Listener);
+ method public deprecated void addListener(android.telecom.Call.Listener);
method public void answer(int);
method public void conference(android.telecom.Call);
method public void disconnect();
@@ -31998,12 +32088,14 @@ package android.telecom {
method public void phoneAccountSelected(android.telecom.PhoneAccountHandle, boolean);
method public void playDtmfTone(char);
method public void postDialContinue(boolean);
+ method public void registerCallback(android.telecom.Call.Callback);
method public void reject(boolean, java.lang.String);
- method public void removeListener(android.telecom.Call.Listener);
+ method public deprecated void removeListener(android.telecom.Call.Listener);
method public void splitFromConference();
method public void stopDtmfTone();
method public void swapConference();
method public void unhold();
+ method public void unregisterCallback(android.telecom.Call.Callback);
field public static final java.lang.String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_CONNECTING = 9; // 0x9
@@ -32016,6 +32108,19 @@ package android.telecom {
field public static final int STATE_RINGING = 2; // 0x2
}
+ public static abstract class Call.Callback {
+ ctor public Call.Callback();
+ method public void onCallDestroyed(android.telecom.Call);
+ method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
+ method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+ method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+ method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
+ method public void onParentChanged(android.telecom.Call, android.telecom.Call);
+ method public void onPostDialWait(android.telecom.Call, java.lang.String);
+ method public void onStateChanged(android.telecom.Call, int);
+ method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
+ }
+
public static class Call.Details {
method public static boolean can(int, int);
method public boolean can(int);
@@ -32054,17 +32159,8 @@ package android.telecom {
field public static final int CAPABILITY_WIFI = 65536; // 0x10000
}
- public static abstract class Call.Listener {
+ public static abstract deprecated class Call.Listener extends android.telecom.Call.Callback {
ctor public Call.Listener();
- method public void onCallDestroyed(android.telecom.Call);
- method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
- method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
- method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
- method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
- method public void onParentChanged(android.telecom.Call, android.telecom.Call);
- method public void onPostDialWait(android.telecom.Call, java.lang.String);
- method public void onStateChanged(android.telecom.Call, int);
- method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
}
public class CallProperties {
@@ -32302,15 +32398,15 @@ package android.telecom {
method public final boolean canAddCall();
method public final android.telecom.AudioState getAudioState();
method public final java.util.List<android.telecom.Call> getCalls();
- method public final android.telecom.Phone getPhone();
+ method public deprecated android.telecom.Phone getPhone();
method public void onAudioStateChanged(android.telecom.AudioState);
method public android.os.IBinder onBind(android.content.Intent);
method public void onBringToForeground(boolean);
method public void onCallAdded(android.telecom.Call);
method public void onCallRemoved(android.telecom.Call);
method public void onCanAddCallChanged(boolean);
- method public void onPhoneCreated(android.telecom.Phone);
- method public void onPhoneDestroyed(android.telecom.Phone);
+ method public deprecated void onPhoneCreated(android.telecom.Phone);
+ method public deprecated void onPhoneDestroyed(android.telecom.Phone);
method public final void setAudioRoute(int);
method public final void setMuted(boolean);
field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.InCallService";
@@ -32318,6 +32414,7 @@ package android.telecom {
public static abstract class InCallService.VideoCall {
ctor public InCallService.VideoCall();
+ method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback);
method public abstract void requestCallDataUsage();
method public abstract void requestCameraCapabilities();
method public abstract void sendSessionModifyRequest(android.telecom.VideoProfile);
@@ -32327,12 +32424,11 @@ package android.telecom {
method public abstract void setDisplaySurface(android.view.Surface);
method public abstract void setPauseImage(java.lang.String);
method public abstract void setPreviewSurface(android.view.Surface);
- method public abstract void setVideoCallListener(android.telecom.InCallService.VideoCall.Listener);
method public abstract void setZoom(float);
}
- public static abstract class InCallService.VideoCall.Listener {
- ctor public InCallService.VideoCall.Listener();
+ public static abstract class InCallService.VideoCall.Callback {
+ ctor public InCallService.VideoCall.Callback();
method public abstract void onCallDataUsageChanged(long);
method public abstract void onCallSessionEvent(int);
method public abstract void onCameraCapabilitiesChanged(android.telecom.CameraCapabilities);
@@ -32342,7 +32438,7 @@ package android.telecom {
method public abstract void onVideoQualityChanged(int);
}
- public final class Phone {
+ public final deprecated class Phone {
method public final void addListener(android.telecom.Phone.Listener);
method public final boolean canAddCall();
method public final android.telecom.AudioState getAudioState();
@@ -32603,6 +32699,24 @@ package android.telecom {
package android.telephony {
+ public class CarrierConfigManager {
+ method public android.os.Bundle getConfig();
+ method public android.os.Bundle getConfigForSubId(int);
+ method public static android.os.Bundle getDefaultConfig();
+ method public void reloadCarrierConfigForSubId(int);
+ method public void updateConfigForPhoneId(int, java.lang.String);
+ field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
+ field public static final java.lang.String BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available";
+ field public static final java.lang.String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned";
+ field public static final java.lang.String BOOL_CARRIER_VOLTE_TTY_SUPPORTED = "bool_carrier_volte_tty_supported";
+ field public static final java.lang.String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
+ field public static final java.lang.String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat";
+ field public static final java.lang.String SHORT_VVM_PORT_NUMBER = "string_vvm_port_number";
+ field public static final java.lang.String STRING_VVM_DESTINATION_NUMBER = "string_vvm_destination_number";
+ field public static final java.lang.String STRING_VVM_TYPE = "string_vvm_type";
+ field public static final java.lang.String VVM_TYPE_OMTP = "vvm_type_omtp";
+ }
+
public final class CellIdentityCdma implements android.os.Parcelable {
method public int describeContents();
method public int getBasestationId();
@@ -38648,6 +38762,7 @@ package android.view {
ctor public ViewGroup(android.content.Context, android.util.AttributeSet, int);
ctor public ViewGroup(android.content.Context, android.util.AttributeSet, int, int);
method public boolean addStatesFromChildren();
+ method public void addTransientView(android.view.View, int);
method public void addView(android.view.View);
method public void addView(android.view.View, int);
method public void addView(android.view.View, int, int);
@@ -38699,6 +38814,9 @@ package android.view {
method public int getNestedScrollAxes();
method public int getPersistentDrawingCache();
method public boolean getTouchscreenBlocksFocus();
+ method public android.view.View getTransientView(int);
+ method public int getTransientViewCount();
+ method public int getTransientViewIndex(int);
method public int indexOfChild(android.view.View);
method public final void invalidateChild(android.view.View, android.graphics.Rect);
method public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
@@ -38732,6 +38850,7 @@ package android.view {
method public void removeAllViews();
method public void removeAllViewsInLayout();
method protected void removeDetachedView(android.view.View, boolean);
+ method public void removeTransientView(android.view.View);
method public void removeView(android.view.View);
method public void removeViewAt(int);
method public void removeViewInLayout(android.view.View);
diff --git a/cmds/wm/src/com/android/commands/wm/Wm.java b/cmds/wm/src/com/android/commands/wm/Wm.java
index 815a0ac999eb..64f023f16abf 100644
--- a/cmds/wm/src/com/android/commands/wm/Wm.java
+++ b/cmds/wm/src/com/android/commands/wm/Wm.java
@@ -24,6 +24,7 @@ import android.graphics.Rect;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.AndroidException;
+import android.util.DisplayMetrics;
import android.view.Display;
import android.view.IWindowManager;
import com.android.internal.os.BaseCommand;
@@ -45,21 +46,27 @@ public class Wm extends BaseCommand {
(new Wm()).run(args);
}
+ @Override
public void onShowUsage(PrintStream out) {
out.println(
"usage: wm [subcommand] [options]\n" +
- " wm size [reset|WxH]\n" +
+ " wm size [reset|WxH|WdpxHdp]\n" +
" wm density [reset|DENSITY]\n" +
" wm overscan [reset|LEFT,TOP,RIGHT,BOTTOM]\n" +
+ " wm scaling [off|auto]\n" +
"\n" +
"wm size: return or override display size.\n" +
+ " width and height in pixels unless suffixed with 'dp'.\n" +
"\n" +
"wm density: override display density.\n" +
"\n" +
- "wm overscan: set overscan area for display.\n"
+ "wm overscan: set overscan area for display.\n" +
+ "\n" +
+ "wm scaling: set display scaling mode.\n"
);
}
+ @Override
public void onRun() throws Exception {
mWm = IWindowManager.Stub.asInterface(ServiceManager.checkService(
Context.WINDOW_SERVICE));
@@ -76,6 +83,8 @@ public class Wm extends BaseCommand {
runDisplayDensity();
} else if (op.equals("overscan")) {
runDisplayOverscan();
+ } else if (op.equals("scaling")) {
+ runDisplayScaling();
} else {
showError("Error: unknown command '" + op + "'");
return;
@@ -85,6 +94,7 @@ public class Wm extends BaseCommand {
private void runDisplaySize() throws Exception {
String size = nextArg();
int w, h;
+ boolean scale = true;
if (size == null) {
Point initialSize = new Point();
Point baseSize = new Point();
@@ -109,8 +119,8 @@ public class Wm extends BaseCommand {
String wstr = size.substring(0, div);
String hstr = size.substring(div+1);
try {
- w = Integer.parseInt(wstr);
- h = Integer.parseInt(hstr);
+ w = parseDimension(wstr);
+ h = parseDimension(hstr);
} catch (NumberFormatException e) {
System.err.println("Error: bad number " + e);
return;
@@ -193,4 +203,32 @@ public class Wm extends BaseCommand {
} catch (RemoteException e) {
}
}
+
+ private void runDisplayScaling() throws Exception {
+ String scalingStr = nextArgRequired();
+ if ("auto".equals(scalingStr)) {
+ mWm.setForcedDisplayScalingMode(Display.DEFAULT_DISPLAY, 0);
+ } else if ("off".equals(scalingStr)) {
+ mWm.setForcedDisplayScalingMode(Display.DEFAULT_DISPLAY, 1);
+ } else {
+ System.err.println("Error: scaling must be 'auto' or 'off'");
+ }
+ }
+
+ private int parseDimension(String s) throws NumberFormatException {
+ if (s.endsWith("px")) {
+ return Integer.parseInt(s.substring(0, s.length() - 2));
+ }
+ if (s.endsWith("dp")) {
+ int density;
+ try {
+ density = mWm.getBaseDisplayDensity(Display.DEFAULT_DISPLAY);
+ } catch (RemoteException e) {
+ density = DisplayMetrics.DENSITY_DEFAULT;
+ }
+ return Integer.parseInt(s.substring(0, s.length() - 2)) * density /
+ DisplayMetrics.DENSITY_DEFAULT;
+ }
+ return Integer.parseInt(s);
+ }
}
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 51ececcba7e9..134ecddb3b31 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -862,6 +862,23 @@ public class ActivityManager {
*/
public int affiliatedTaskColor;
+ /**
+ * The component launched as the first activity in the task.
+ * This can be considered the "application" of this task.
+ */
+ public ComponentName baseActivity;
+
+ /**
+ * The activity component at the top of the history stack of the task.
+ * This is what the user is currently doing.
+ */
+ public ComponentName topActivity;
+
+ /**
+ * Number of activities in this task.
+ */
+ public int numActivities;
+
public RecentTaskInfo() {
}
@@ -895,6 +912,9 @@ public class ActivityManager {
dest.writeLong(lastActiveTime);
dest.writeInt(affiliatedTaskId);
dest.writeInt(affiliatedTaskColor);
+ ComponentName.writeToParcel(baseActivity, dest);
+ ComponentName.writeToParcel(topActivity, dest);
+ dest.writeInt(numActivities);
}
public void readFromParcel(Parcel source) {
@@ -911,6 +931,9 @@ public class ActivityManager {
lastActiveTime = source.readLong();
affiliatedTaskId = source.readInt();
affiliatedTaskColor = source.readInt();
+ baseActivity = ComponentName.readFromParcel(source);
+ topActivity = ComponentName.readFromParcel(source);
+ numActivities = source.readInt();
}
public static final Creator<RecentTaskInfo> CREATOR
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 4ede5b1c49e7..e446700317ab 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -105,6 +105,7 @@ import android.hardware.fingerprint.IFingerprintService;
import android.service.persistentdata.IPersistentDataBlockService;
import android.service.persistentdata.PersistentDataBlockManager;
import android.telecom.TelecomManager;
+import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -420,6 +421,13 @@ final class SystemServiceRegistry {
return new SubscriptionManager(ctx.getOuterContext());
}});
+ registerService(Context.CARRIER_CONFIG_SERVICE, CarrierConfigManager.class,
+ new CachedServiceFetcher<CarrierConfigManager>() {
+ @Override
+ public CarrierConfigManager createService(ContextImpl ctx) {
+ return new CarrierConfigManager();
+ }});
+
registerService(Context.TELECOM_SERVICE, TelecomManager.class,
new CachedServiceFetcher<TelecomManager>() {
@Override
diff --git a/core/java/android/app/trust/ITrustListener.aidl b/core/java/android/app/trust/ITrustListener.aidl
index d80f58cd1072..506dd12a36a0 100644
--- a/core/java/android/app/trust/ITrustListener.aidl
+++ b/core/java/android/app/trust/ITrustListener.aidl
@@ -22,6 +22,6 @@ package android.app.trust;
* {@hide}
*/
oneway interface ITrustListener {
- void onTrustChanged(boolean enabled, int userId, boolean initiatedByUser);
+ void onTrustChanged(boolean enabled, int userId, int flags);
void onTrustManagedChanged(boolean managed, int userId);
} \ No newline at end of file
diff --git a/core/java/android/app/trust/TrustManager.java b/core/java/android/app/trust/TrustManager.java
index 705a144d8c03..b5c5317aeb06 100644
--- a/core/java/android/app/trust/TrustManager.java
+++ b/core/java/android/app/trust/TrustManager.java
@@ -34,7 +34,7 @@ public class TrustManager {
private static final int MSG_TRUST_MANAGED_CHANGED = 2;
private static final String TAG = "TrustManager";
- private static final String DATA_INITIATED_BY_USER = "initiatedByUser";
+ private static final String DATA_FLAGS = "initiatedByUser";
private final ITrustManager mService;
private final ArrayMap<TrustListener, ITrustListener> mTrustListeners;
@@ -109,11 +109,11 @@ public class TrustManager {
try {
ITrustListener.Stub iTrustListener = new ITrustListener.Stub() {
@Override
- public void onTrustChanged(boolean enabled, int userId, boolean initiatedByUser) {
+ public void onTrustChanged(boolean enabled, int userId, int flags) {
Message m = mHandler.obtainMessage(MSG_TRUST_CHANGED, (enabled ? 1 : 0), userId,
trustListener);
- if (initiatedByUser) {
- m.getData().putBoolean(DATA_INITIATED_BY_USER, initiatedByUser);
+ if (flags != 0) {
+ m.getData().putInt(DATA_FLAGS, flags);
}
m.sendToTarget();
}
@@ -156,11 +156,8 @@ public class TrustManager {
public void handleMessage(Message msg) {
switch(msg.what) {
case MSG_TRUST_CHANGED:
- boolean initiatedByUser = msg.peekData() != null &&
- msg.peekData().getBoolean(DATA_INITIATED_BY_USER);
- ((TrustListener)msg.obj).onTrustChanged(
- msg.arg1 != 0, msg.arg2, initiatedByUser);
-
+ int flags = msg.peekData() != null ? msg.peekData().getInt(DATA_FLAGS) : 0;
+ ((TrustListener)msg.obj).onTrustChanged(msg.arg1 != 0, msg.arg2, flags);
break;
case MSG_TRUST_MANAGED_CHANGED:
((TrustListener)msg.obj).onTrustManagedChanged(msg.arg1 != 0, msg.arg2);
@@ -174,10 +171,11 @@ public class TrustManager {
* Reports that the trust state has changed.
* @param enabled if true, the system believes the environment to be trusted.
* @param userId the user, for which the trust changed.
- * @param initiatedByUser indicates that the user has explicitly initiated an action that
- * proves the user is about to use the device.
+ * @param flags flags specified by the trust agent when granting trust. See
+ * {@link android.service.trust.TrustAgentService#grantTrust(CharSequence, long, int)
+ * TrustAgentService.grantTrust(CharSequence, long, int)}.
*/
- void onTrustChanged(boolean enabled, int userId, boolean initiatedByUser);
+ void onTrustChanged(boolean enabled, int userId, int flags);
/**
* Reports that whether trust is managed has changed
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 0cbf960d2bf0..370f61cd7b30 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2193,6 +2193,7 @@ public abstract class Context {
MEDIA_ROUTER_SERVICE,
TELEPHONY_SERVICE,
TELEPHONY_SUBSCRIPTION_SERVICE,
+ CARRIER_CONFIG_SERVICE,
TELECOM_SERVICE,
CLIPBOARD_SERVICE,
INPUT_METHOD_SERVICE,
@@ -2338,6 +2339,8 @@ public abstract class Context {
* @see android.telephony.TelephonyManager
* @see #TELEPHONY_SUBSCRIPTION_SERVICE
* @see android.telephony.SubscriptionManager
+ * @see #CARRIER_CONFIG_SERVICE
+ * @see android.telephony.CarrierConfigManager
* @see #INPUT_METHOD_SERVICE
* @see android.view.inputmethod.InputMethodManager
* @see #UI_MODE_SERVICE
@@ -2755,6 +2758,16 @@ public abstract class Context {
/**
* Use with {@link #getSystemService} to retrieve a
+ * {@link android.telephony.CarrierConfigManager} for reading carrier configuration values.
+ *
+ * @see #getSystemService
+ * @see android.telephony.CarrierConfigManager
+ */
+ public static final String CARRIER_CONFIG_SERVICE = "carrier_config";
+
+ /**
+ * Use with {@link #getSystemService} to retrieve a
+ * {@link android.text.ClipboardManager} for accessing and modifying
* {@link android.content.ClipboardManager} for accessing and modifying
* the contents of the global clipboard.
*
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 8d82aa268020..16f6b1e63329 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -223,11 +223,12 @@ public class ActivityInfo extends ComponentInfo
*/
public static final int FLAG_HARDWARE_ACCELERATED = 0x0200;
/**
- * Value for {@link #flags}: true when the application can be displayed over the lockscreen
- * and consequently over all users' windows.
+ * Value for {@link #flags}: true when the application can be displayed for all users
+ * regardless of if the user of the application is the current user. Set from the
+ * {@link android.R.attr#showForAllUsers} attribute.
* @hide
*/
- public static final int FLAG_SHOW_ON_LOCK_SCREEN = 0x0400;
+ public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400;
/**
* Bit in {@link #flags} corresponding to an immersive activity
* that wishes not to be interrupted by notifications.
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index caf069f6fb56..e2701ee8fc12 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -339,8 +339,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
* (e.g., HTTP rather than HTTPS; WebSockets rather than WebSockets Secure; XMPP, IMAP, STMP
* without STARTTLS or TLS). If {@code false}, the app declares that it does not intend to use
* cleartext network traffic, in which case platform components (e.g., HTTP stacks,
- * {@code WebView}, {@code MediaPlayer}) will refuse app's requests to use cleartext traffic.
- * Third-party libraries are encouraged to honor this flag as well.
+ * {@code WebView}, {@code DownloadManager}, {@code MediaPlayer}) will refuse app's requests to
+ * use cleartext traffic. Third-party libraries are encouraged to honor this flag as well.
*/
public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27;
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 40f4e8f90b96..fed9261c659d 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -3099,8 +3099,9 @@ public class PackageParser {
a.info.flags |= ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS;
}
- if (sa.getBoolean(R.styleable.AndroidManifestActivity_showOnLockScreen, false)) {
- a.info.flags |= ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN;
+ if (sa.getBoolean(R.styleable.AndroidManifestActivity_showOnLockScreen, false)
+ || sa.getBoolean(R.styleable.AndroidManifestActivity_showForAllUsers, false)) {
+ a.info.flags |= ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
}
if (sa.getBoolean(R.styleable.AndroidManifestActivity_immersive, false)) {
diff --git a/core/java/android/nfc/IAppCallback.aidl b/core/java/android/nfc/IAppCallback.aidl
index 95993088bb49..c027d54647bd 100644
--- a/core/java/android/nfc/IAppCallback.aidl
+++ b/core/java/android/nfc/IAppCallback.aidl
@@ -24,7 +24,7 @@ import android.nfc.Tag;
*/
interface IAppCallback
{
- BeamShareData createBeamShareData();
- void onNdefPushComplete();
+ BeamShareData createBeamShareData(byte peerLlcpVersion);
+ void onNdefPushComplete(byte peerLlcpVersion);
void onTagDiscovered(in Tag tag);
}
diff --git a/core/java/android/nfc/NfcActivityManager.java b/core/java/android/nfc/NfcActivityManager.java
index d00929505d43..76bd0ece384a 100644
--- a/core/java/android/nfc/NfcActivityManager.java
+++ b/core/java/android/nfc/NfcActivityManager.java
@@ -46,7 +46,6 @@ public final class NfcActivityManager extends IAppCallback.Stub
static final Boolean DBG = false;
final NfcAdapter mAdapter;
- final NfcEvent mDefaultEvent; // cached NfcEvent (its currently always the same)
// All objects in the lists are protected by this
final List<NfcApplicationState> mApps; // Application(s) that have NFC state. Usually one
@@ -200,7 +199,6 @@ public final class NfcActivityManager extends IAppCallback.Stub
mAdapter = adapter;
mActivities = new LinkedList<NfcActivityState>();
mApps = new ArrayList<NfcApplicationState>(1); // Android VM usually has 1 app
- mDefaultEvent = new NfcEvent(mAdapter);
}
public void enableReaderMode(Activity activity, ReaderCallback callback, int flags,
@@ -354,13 +352,14 @@ public final class NfcActivityManager extends IAppCallback.Stub
/** Callback from NFC service, usually on binder thread */
@Override
- public BeamShareData createBeamShareData() {
+ public BeamShareData createBeamShareData(byte peerLlcpVersion) {
NfcAdapter.CreateNdefMessageCallback ndefCallback;
NfcAdapter.CreateBeamUrisCallback urisCallback;
NdefMessage message;
Activity activity;
Uri[] uris;
int flags;
+ NfcEvent event = new NfcEvent(mAdapter, peerLlcpVersion);
synchronized (NfcActivityManager.this) {
NfcActivityState state = findResumedActivityState();
if (state == null) return null;
@@ -375,10 +374,10 @@ public final class NfcActivityManager extends IAppCallback.Stub
// Make callbacks without lock
if (ndefCallback != null) {
- message = ndefCallback.createNdefMessage(mDefaultEvent);
+ message = ndefCallback.createNdefMessage(event);
}
if (urisCallback != null) {
- uris = urisCallback.createBeamUris(mDefaultEvent);
+ uris = urisCallback.createBeamUris(event);
if (uris != null) {
ArrayList<Uri> validUris = new ArrayList<Uri>();
for (Uri uri : uris) {
@@ -412,7 +411,7 @@ public final class NfcActivityManager extends IAppCallback.Stub
/** Callback from NFC service, usually on binder thread */
@Override
- public void onNdefPushComplete() {
+ public void onNdefPushComplete(byte peerLlcpVersion) {
NfcAdapter.OnNdefPushCompleteCallback callback;
synchronized (NfcActivityManager.this) {
NfcActivityState state = findResumedActivityState();
@@ -420,10 +419,10 @@ public final class NfcActivityManager extends IAppCallback.Stub
callback = state.onNdefPushCompleteCallback;
}
-
+ NfcEvent event = new NfcEvent(mAdapter, peerLlcpVersion);
// Make callback without lock
if (callback != null) {
- callback.onNdefPushComplete(mDefaultEvent);
+ callback.onNdefPushComplete(event);
}
}
diff --git a/core/java/android/nfc/NfcEvent.java b/core/java/android/nfc/NfcEvent.java
index 860700a80f02..cf1d71a8b5e8 100644
--- a/core/java/android/nfc/NfcEvent.java
+++ b/core/java/android/nfc/NfcEvent.java
@@ -38,7 +38,14 @@ public final class NfcEvent {
*/
public final NfcAdapter nfcAdapter;
- NfcEvent(NfcAdapter nfcAdapter) {
+ /**
+ * The LLCP version of the peer associated with the NFC event.
+ * The major version is in the top nibble, the minor version is in the bottom nibble.
+ */
+ public final byte peerLlcpVersion;
+
+ NfcEvent(NfcAdapter nfcAdapter, byte peerLlcpVersion) {
this.nfcAdapter = nfcAdapter;
+ this.peerLlcpVersion = peerLlcpVersion;
}
}
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 7c5ddeefa467..4dfe0de831e2 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -152,10 +152,15 @@ public abstract class BatteryStats implements Parcelable {
private static final String[] STAT_NAMES = { "l", "c", "u" };
/**
- * Bump the version on this if the checkin format changes.
+ * Current version of checkin data format.
+ */
+ static final String CHECKIN_VERSION = "14";
+
+ /**
+ * Old version, we hit 9 and ran out of room, need to remove.
*/
private static final int BATTERY_STATS_CHECKIN_VERSION = 9;
-
+
private static final long BYTES_PER_KB = 1024;
private static final long BYTES_PER_MB = 1048576; // 1024^2
private static final long BYTES_PER_GB = 1073741824; //1024^3
@@ -178,7 +183,9 @@ public abstract class BatteryStats implements Parcelable {
private static final String BATTERY_DATA = "bt";
private static final String BATTERY_DISCHARGE_DATA = "dc";
private static final String BATTERY_LEVEL_DATA = "lv";
+ private static final String GLOBAL_WIFI_DATA = "gwfl";
private static final String WIFI_DATA = "wfl";
+ private static final String GLOBAL_BLUETOOTH_DATA = "gble";
private static final String MISC_DATA = "m";
private static final String GLOBAL_NETWORK_DATA = "gn";
private static final String HISTORY_STRING_POOL = "hsp";
@@ -195,8 +202,6 @@ public abstract class BatteryStats implements Parcelable {
private static final String WIFI_SUPPL_STATE_COUNT_DATA = "wssc";
private static final String WIFI_SIGNAL_STRENGTH_TIME_DATA = "wsgt";
private static final String WIFI_SIGNAL_STRENGTH_COUNT_DATA = "wsgc";
- private static final String BLUETOOTH_STATE_TIME_DATA = "bst";
- private static final String BLUETOOTH_STATE_COUNT_DATA = "bsc";
private static final String POWER_USE_SUMMARY_DATA = "pws";
private static final String POWER_USE_ITEM_DATA = "pwi";
private static final String DISCHARGE_STEP_DATA = "dsd";
@@ -1055,22 +1060,23 @@ public abstract class BatteryStats implements Parcelable {
public static final int STATE_GPS_ON_FLAG = 1<<29;
public static final int STATE_WIFI_FULL_LOCK_FLAG = 1<<28;
public static final int STATE_WIFI_SCAN_FLAG = 1<<27;
- public static final int STATE_WIFI_MULTICAST_ON_FLAG = 1<<26;
+ public static final int STATE_WIFI_RADIO_ACTIVE_FLAG = 1<<26;
public static final int STATE_MOBILE_RADIO_ACTIVE_FLAG = 1<<25;
// These are on the lower bits used for the command; if they change
// we need to write another int of data.
public static final int STATE_SENSOR_ON_FLAG = 1<<23;
public static final int STATE_AUDIO_ON_FLAG = 1<<22;
public static final int STATE_PHONE_SCANNING_FLAG = 1<<21;
- public static final int STATE_SCREEN_ON_FLAG = 1<<20;
- public static final int STATE_BATTERY_PLUGGED_FLAG = 1<<19;
- public static final int STATE_PHONE_IN_CALL_FLAG = 1<<18;
- public static final int STATE_CHARGING_FLAG = 1<<17;
- public static final int STATE_BLUETOOTH_ON_FLAG = 1<<16;
+ public static final int STATE_SCREEN_ON_FLAG = 1<<20; // consider moving to states2
+ public static final int STATE_BATTERY_PLUGGED_FLAG = 1<<19; // consider moving to states2
+ // empty slot
+ // empty slot
+ public static final int STATE_WIFI_MULTICAST_ON_FLAG = 1<<16;
public static final int MOST_INTERESTING_STATES =
- STATE_BATTERY_PLUGGED_FLAG | STATE_SCREEN_ON_FLAG
- | STATE_PHONE_IN_CALL_FLAG | STATE_BLUETOOTH_ON_FLAG;
+ STATE_BATTERY_PLUGGED_FLAG | STATE_SCREEN_ON_FLAG;
+
+ public static final int SETTLE_TO_ZERO_STATES = 0xffff0000 & ~MOST_INTERESTING_STATES;
public int states;
@@ -1088,9 +1094,15 @@ public abstract class BatteryStats implements Parcelable {
public static final int STATE2_WIFI_ON_FLAG = 1<<28;
public static final int STATE2_FLASHLIGHT_FLAG = 1<<27;
public static final int STATE2_DEVICE_IDLE_FLAG = 1<<26;
+ public static final int STATE2_CHARGING_FLAG = 1<<25;
+ public static final int STATE2_PHONE_IN_CALL_FLAG = 1<<24;
+ public static final int STATE2_BLUETOOTH_ON_FLAG = 1<<23;
public static final int MOST_INTERESTING_STATES2 =
- STATE2_POWER_SAVE_FLAG | STATE2_WIFI_ON_FLAG | STATE2_DEVICE_IDLE_FLAG;
+ STATE2_POWER_SAVE_FLAG | STATE2_WIFI_ON_FLAG | STATE2_DEVICE_IDLE_FLAG
+ | STATE2_CHARGING_FLAG | STATE2_PHONE_IN_CALL_FLAG | STATE2_BLUETOOTH_ON_FLAG;
+
+ public static final int SETTLE_TO_ZERO_STATES2 = 0xffff0000 & ~MOST_INTERESTING_STATES2;
public int states2;
@@ -1137,8 +1149,10 @@ public abstract class BatteryStats implements Parcelable {
public static final int EVENT_PACKAGE_UNINSTALLED = 0x000d;
// Event for a package being uninstalled.
public static final int EVENT_ALARM = 0x000e;
+ // Record that we have decided we need to collect new stats data.
+ public static final int EVENT_COLLECT_EXTERNAL_STATS = 0x000f;
// Number of event types.
- public static final int EVENT_COUNT = 0x000f;
+ public static final int EVENT_COUNT = 0x0010;
// Mask to extract out only the type part of the event.
public static final int EVENT_TYPE_MASK = ~(EVENT_FLAG_START|EVENT_FLAG_FINISH);
@@ -1750,14 +1764,12 @@ public abstract class BatteryStats implements Parcelable {
new BitDescription(HistoryItem.STATE_WIFI_FULL_LOCK_FLAG, "wifi_full_lock", "Wl"),
new BitDescription(HistoryItem.STATE_WIFI_SCAN_FLAG, "wifi_scan", "Ws"),
new BitDescription(HistoryItem.STATE_WIFI_MULTICAST_ON_FLAG, "wifi_multicast", "Wm"),
+ new BitDescription(HistoryItem.STATE_WIFI_RADIO_ACTIVE_FLAG, "wifi_radio", "Wr"),
new BitDescription(HistoryItem.STATE_MOBILE_RADIO_ACTIVE_FLAG, "mobile_radio", "Pr"),
new BitDescription(HistoryItem.STATE_PHONE_SCANNING_FLAG, "phone_scanning", "Psc"),
new BitDescription(HistoryItem.STATE_AUDIO_ON_FLAG, "audio", "a"),
new BitDescription(HistoryItem.STATE_SCREEN_ON_FLAG, "screen", "S"),
new BitDescription(HistoryItem.STATE_BATTERY_PLUGGED_FLAG, "plugged", "BP"),
- new BitDescription(HistoryItem.STATE_PHONE_IN_CALL_FLAG, "phone_in_call", "Pcl"),
- new BitDescription(HistoryItem.STATE_CHARGING_FLAG, "charging", "ch"),
- new BitDescription(HistoryItem.STATE_BLUETOOTH_ON_FLAG, "bluetooth", "b"),
new BitDescription(HistoryItem.STATE_DATA_CONNECTION_MASK,
HistoryItem.STATE_DATA_CONNECTION_SHIFT, "data_conn", "Pcn",
DATA_CONNECTION_NAMES, DATA_CONNECTION_NAMES),
@@ -1778,10 +1790,13 @@ public abstract class BatteryStats implements Parcelable {
= new BitDescription[] {
new BitDescription(HistoryItem.STATE2_POWER_SAVE_FLAG, "power_save", "ps"),
new BitDescription(HistoryItem.STATE2_VIDEO_ON_FLAG, "video", "v"),
- new BitDescription(HistoryItem.STATE2_WIFI_RUNNING_FLAG, "wifi_running", "Wr"),
+ new BitDescription(HistoryItem.STATE2_WIFI_RUNNING_FLAG, "wifi_running", "Ww"),
new BitDescription(HistoryItem.STATE2_WIFI_ON_FLAG, "wifi", "W"),
new BitDescription(HistoryItem.STATE2_FLASHLIGHT_FLAG, "flashlight", "fl"),
new BitDescription(HistoryItem.STATE2_DEVICE_IDLE_FLAG, "device_idle", "di"),
+ new BitDescription(HistoryItem.STATE2_CHARGING_FLAG, "charging", "ch"),
+ new BitDescription(HistoryItem.STATE2_PHONE_IN_CALL_FLAG, "phone_in_call", "Pcl"),
+ new BitDescription(HistoryItem.STATE2_BLUETOOTH_ON_FLAG, "bluetooth", "b"),
new BitDescription(HistoryItem.STATE2_WIFI_SIGNAL_STRENGTH_MASK,
HistoryItem.STATE2_WIFI_SIGNAL_STRENGTH_SHIFT, "wifi_signal_strength", "Wss",
new String[] { "0", "1", "2", "3", "4" },
@@ -1793,12 +1808,12 @@ public abstract class BatteryStats implements Parcelable {
public static final String[] HISTORY_EVENT_NAMES = new String[] {
"null", "proc", "fg", "top", "sync", "wake_lock_in", "job", "user", "userfg", "conn",
- "motion", "active", "pkginst", "pkgunin", "alarm"
+ "motion", "active", "pkginst", "pkgunin", "alarm", "stats"
};
public static final String[] HISTORY_EVENT_CHECKIN_NAMES = new String[] {
"Enl", "Epr", "Efg", "Etp", "Esy", "Ewl", "Ejb", "Eur", "Euf", "Ecn",
- "Esm", "Eac", "Epi", "Epu", "Eal"
+ "Esm", "Eac", "Epi", "Epu", "Eal", "Est"
};
/**
@@ -1883,43 +1898,6 @@ public abstract class BatteryStats implements Parcelable {
public abstract int getWifiSignalStrengthCount(int strengthBin, int which);
/**
- * Returns the time in microseconds that bluetooth has been on while the device was
- * running on battery.
- *
- * {@hide}
- */
- public abstract long getBluetoothOnTime(long elapsedRealtimeUs, int which);
-
- public abstract int getBluetoothPingCount();
-
- public static final int BLUETOOTH_STATE_INACTIVE = 0;
- public static final int BLUETOOTH_STATE_LOW = 1;
- public static final int BLUETOOTH_STATE_MEDIUM = 2;
- public static final int BLUETOOTH_STATE_HIGH = 3;
-
- static final String[] BLUETOOTH_STATE_NAMES = {
- "inactive", "low", "med", "high"
- };
-
- public static final int NUM_BLUETOOTH_STATES = BLUETOOTH_STATE_HIGH +1;
-
- /**
- * Returns the time in microseconds that Bluetooth has been running in the
- * given active state.
- *
- * {@hide}
- */
- public abstract long getBluetoothStateTime(int bluetoothState,
- long elapsedRealtimeUs, int which);
-
- /**
- * Returns the number of times that Bluetooth has entered the given active state.
- *
- * {@hide}
- */
- public abstract int getBluetoothStateCount(int bluetoothState, int which);
-
- /**
* Returns the time in microseconds that the flashlight has been on while the device was
* running on battery.
*
@@ -2431,9 +2409,6 @@ public abstract class BatteryStats implements Parcelable {
final long deviceIdlingTime = getDeviceIdlingTime(rawRealtime, which);
final int connChanges = getNumConnectivityChange(which);
final long phoneOnTime = getPhoneOnTime(rawRealtime, which);
- final long wifiOnTime = getWifiOnTime(rawRealtime, which);
- final long wifiRunningTime = getGlobalWifiRunningTime(rawRealtime, which);
- final long bluetoothOnTime = getBluetoothOnTime(rawRealtime, which);
final StringBuilder sb = new StringBuilder(128);
@@ -2475,7 +2450,8 @@ public abstract class BatteryStats implements Parcelable {
}
}
}
-
+
+ // Dump network stats
final long mobileRxTotalBytes = getNetworkActivityBytes(NETWORK_MOBILE_RX_DATA, which);
final long mobileTxTotalBytes = getNetworkActivityBytes(NETWORK_MOBILE_TX_DATA, which);
final long wifiRxTotalBytes = getNetworkActivityBytes(NETWORK_WIFI_RX_DATA, which);
@@ -2484,19 +2460,34 @@ public abstract class BatteryStats implements Parcelable {
final long mobileTxTotalPackets = getNetworkActivityPackets(NETWORK_MOBILE_TX_DATA, which);
final long wifiRxTotalPackets = getNetworkActivityPackets(NETWORK_WIFI_RX_DATA, which);
final long wifiTxTotalPackets = getNetworkActivityPackets(NETWORK_WIFI_TX_DATA, which);
-
- // Dump network stats
dumpLine(pw, 0 /* uid */, category, GLOBAL_NETWORK_DATA,
mobileRxTotalBytes, mobileTxTotalBytes, wifiRxTotalBytes, wifiTxTotalBytes,
mobileRxTotalPackets, mobileTxTotalPackets, wifiRxTotalPackets, wifiTxTotalPackets);
+ // Dump Wifi controller stats
+ final long wifiOnTime = getWifiOnTime(rawRealtime, which);
+ final long wifiRunningTime = getGlobalWifiRunningTime(rawRealtime, which);
+ final long wifiIdleTimeMs = getWifiControllerActivity(CONTROLLER_IDLE_TIME, which);
+ final long wifiRxTimeMs = getWifiControllerActivity(CONTROLLER_RX_TIME, which);
+ final long wifiTxTimeMs = getWifiControllerActivity(CONTROLLER_TX_TIME, which);
+ final long wifiPowerMaMs = getWifiControllerActivity(CONTROLLER_POWER_DRAIN, which);
+ dumpLine(pw, 0 /* uid */, category, GLOBAL_WIFI_DATA,
+ wifiOnTime / 1000, wifiRunningTime / 1000,
+ wifiIdleTimeMs, wifiRxTimeMs, wifiTxTimeMs, wifiPowerMaMs / (1000*60*60));
+
+ // Dump Bluetooth controller stats
+ final long btIdleTimeMs = getBluetoothControllerActivity(CONTROLLER_IDLE_TIME, which);
+ final long btRxTimeMs = getBluetoothControllerActivity(CONTROLLER_RX_TIME, which);
+ final long btTxTimeMs = getBluetoothControllerActivity(CONTROLLER_TX_TIME, which);
+ final long btPowerMaMs = getBluetoothControllerActivity(CONTROLLER_POWER_DRAIN, which);
+ dumpLine(pw, 0 /* uid */, category, GLOBAL_BLUETOOTH_DATA,
+ btIdleTimeMs, btRxTimeMs, btTxTimeMs, btPowerMaMs / (1000*60*60));
+
// Dump misc stats
dumpLine(pw, 0 /* uid */, category, MISC_DATA,
- screenOnTime / 1000, phoneOnTime / 1000, wifiOnTime / 1000,
- wifiRunningTime / 1000, bluetoothOnTime / 1000,
- mobileRxTotalBytes, mobileTxTotalBytes, wifiRxTotalBytes, wifiTxTotalBytes,
+ screenOnTime / 1000, phoneOnTime / 1000,
fullWakeLockTimeTotal / 1000, partialWakeLockTimeTotal / 1000,
- 0 /*legacy input event count*/, getMobileRadioActiveTime(rawRealtime, which) / 1000,
+ getMobileRadioActiveTime(rawRealtime, which) / 1000,
getMobileRadioActiveAdjustedTime(which) / 1000, interactiveTime / 1000,
powerSaveModeEnabledTime / 1000, connChanges, deviceIdleModeEnabledTime / 1000,
getDeviceIdleModeEnabledCount(which), deviceIdlingTime / 1000,
@@ -2566,17 +2557,6 @@ public abstract class BatteryStats implements Parcelable {
}
dumpLine(pw, 0 /* uid */, category, WIFI_SIGNAL_STRENGTH_COUNT_DATA, args);
- // Dump bluetooth state stats
- args = new Object[NUM_BLUETOOTH_STATES];
- for (int i=0; i<NUM_BLUETOOTH_STATES; i++) {
- args[i] = getBluetoothStateTime(i, rawRealtime, which) / 1000;
- }
- dumpLine(pw, 0 /* uid */, category, BLUETOOTH_STATE_TIME_DATA, args);
- for (int i=0; i<NUM_BLUETOOTH_STATES; i++) {
- args[i] = getBluetoothStateCount(i, which);
- }
- dumpLine(pw, 0 /* uid */, category, BLUETOOTH_STATE_COUNT_DATA, args);
-
if (which == STATS_SINCE_UNPLUGGED) {
dumpLine(pw, 0 /* uid */, category, BATTERY_LEVEL_DATA, getDischargeStartLevel(),
getDischargeCurrentLevel());
@@ -2681,6 +2661,7 @@ public abstract class BatteryStats implements Parcelable {
continue;
}
final Uid u = uidStats.valueAt(iu);
+
// Dump Network stats per uid, if any
final long mobileBytesRx = u.getNetworkActivityBytes(NETWORK_MOBILE_RX_DATA, which);
final long mobileBytesTx = u.getNetworkActivityBytes(NETWORK_MOBILE_TX_DATA, which);
@@ -2692,11 +2673,6 @@ public abstract class BatteryStats implements Parcelable {
final int mobileActiveCount = u.getMobileRadioActiveCount(which);
final long wifiPacketsRx = u.getNetworkActivityPackets(NETWORK_WIFI_RX_DATA, which);
final long wifiPacketsTx = u.getNetworkActivityPackets(NETWORK_WIFI_TX_DATA, which);
- final long fullWifiLockOnTime = u.getFullWifiLockTime(rawRealtime, which);
- final long wifiScanTime = u.getWifiScanTime(rawRealtime, which);
- final int wifiScanCount = u.getWifiScanCount(which);
- final long uidWifiRunningTime = u.getWifiRunningTime(rawRealtime, which);
-
if (mobileBytesRx > 0 || mobileBytesTx > 0 || wifiBytesRx > 0 || wifiBytesTx > 0
|| mobilePacketsRx > 0 || mobilePacketsTx > 0 || wifiPacketsRx > 0
|| wifiPacketsTx > 0 || mobileActiveTime > 0 || mobileActiveCount > 0) {
@@ -2707,10 +2683,19 @@ public abstract class BatteryStats implements Parcelable {
mobileActiveTime, mobileActiveCount);
}
+ final long fullWifiLockOnTime = u.getFullWifiLockTime(rawRealtime, which);
+ final long wifiScanTime = u.getWifiScanTime(rawRealtime, which);
+ final int wifiScanCount = u.getWifiScanCount(which);
+ final long uidWifiRunningTime = u.getWifiRunningTime(rawRealtime, which);
+ final long uidWifiIdleTimeMs = u.getWifiControllerActivity(CONTROLLER_IDLE_TIME, which);
+ final long uidWifiRxTimeMs = u.getWifiControllerActivity(CONTROLLER_RX_TIME, which);
+ final long uidWifiTxTimeMs = u.getWifiControllerActivity(CONTROLLER_TX_TIME, which);
if (fullWifiLockOnTime != 0 || wifiScanTime != 0 || wifiScanCount != 0
- || uidWifiRunningTime != 0) {
+ || uidWifiRunningTime != 0 || uidWifiIdleTimeMs != 0 || uidWifiRxTimeMs != 0
+ || uidWifiTxTimeMs != 0) {
dumpLine(pw, uid, category, WIFI_DATA,
- fullWifiLockOnTime, wifiScanTime, uidWifiRunningTime, wifiScanCount);
+ fullWifiLockOnTime, wifiScanTime, uidWifiRunningTime, wifiScanCount,
+ uidWifiIdleTimeMs, uidWifiRxTimeMs, uidWifiTxTimeMs);
}
if (u.hasUserActivity()) {
@@ -2968,7 +2953,6 @@ public abstract class BatteryStats implements Parcelable {
final long phoneOnTime = getPhoneOnTime(rawRealtime, which);
final long wifiRunningTime = getGlobalWifiRunningTime(rawRealtime, which);
final long wifiOnTime = getWifiOnTime(rawRealtime, which);
- final long bluetoothOnTime = getBluetoothOnTime(rawRealtime, which);
sb.setLength(0);
sb.append(prefix);
sb.append(" Screen on: "); formatTimeMs(sb, screenOnTime / 1000);
@@ -3317,42 +3301,11 @@ public abstract class BatteryStats implements Parcelable {
sb.setLength(0);
sb.append(prefix);
- sb.append(" WiFi Energy use: ").append(BatteryStatsHelper.makemAh(
+ sb.append(" WiFi Power drain: ").append(BatteryStatsHelper.makemAh(
getWifiControllerActivity(CONTROLLER_POWER_DRAIN, which) / (double)(1000*60*60)));
sb.append(" mAh");
pw.println(sb.toString());
- sb.setLength(0);
- sb.append(prefix);
- sb.append(" Bluetooth on: "); formatTimeMs(sb, bluetoothOnTime / 1000);
- sb.append("("); sb.append(formatRatioLocked(bluetoothOnTime, whichBatteryRealtime));
- sb.append(")");
- pw.println(sb.toString());
-
- sb.setLength(0);
- sb.append(prefix);
- sb.append(" Bluetooth states:");
- didOne = false;
- for (int i=0; i<NUM_BLUETOOTH_STATES; i++) {
- final long time = getBluetoothStateTime(i, rawRealtime, which);
- if (time == 0) {
- continue;
- }
- sb.append("\n ");
- didOne = true;
- sb.append(BLUETOOTH_STATE_NAMES[i]);
- sb.append(" ");
- formatTimeMs(sb, time/1000);
- sb.append("(");
- sb.append(formatRatioLocked(time, whichBatteryRealtime));
- sb.append(") ");
- sb.append(getPhoneDataConnectionCount(i, which));
- sb.append("x");
- }
-
- if (!didOne) sb.append(" (no activity)");
- pw.println(sb.toString());
-
final long bluetoothIdleTimeMs =
getBluetoothControllerActivity(CONTROLLER_IDLE_TIME, which);
final long bluetoothRxTimeMs = getBluetoothControllerActivity(CONTROLLER_RX_TIME, which);
@@ -3384,6 +3337,14 @@ public abstract class BatteryStats implements Parcelable {
sb.append(")");
pw.println(sb.toString());
+ sb.setLength(0);
+ sb.append(prefix);
+ sb.append(" Bluetooth Power drain: ").append(BatteryStatsHelper.makemAh(
+ getBluetoothControllerActivity(CONTROLLER_POWER_DRAIN, which) /
+ (double)(1000*60*60)));
+ sb.append(" mAh");
+ pw.println(sb.toString());
+
pw.println();
if (which == STATS_SINCE_UNPLUGGED) {
@@ -4883,7 +4844,8 @@ public abstract class BatteryStats implements Parcelable {
prepareForDumpLocked();
dumpLine(pw, 0 /* uid */, "i" /* category */, VERSION_DATA,
- "13", getParcelVersion(), getStartPlatformVersion(), getEndPlatformVersion());
+ CHECKIN_VERSION, getParcelVersion(), getStartPlatformVersion(),
+ getEndPlatformVersion());
long now = getHistoryBaseTime() + SystemClock.elapsedRealtime();
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 793971f96fc6..a622a212d44e 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6033,6 +6033,13 @@ public final class Settings {
public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
/**
+ * The saved value for WindowManagerService.setForcedDisplayScalingMode().
+ * 0 or unset if scaling is automatic, 1 if scaling is disabled.
+ * @hide
+ */
+ public static final String DISPLAY_SCALING_FORCE = "display_scaling_force";
+
+ /**
* The maximum size, in bytes, of a download that the download manager will transfer over
* a non-wifi connection.
* @hide
diff --git a/core/java/android/security/NetworkSecurityPolicy.java b/core/java/android/security/NetworkSecurityPolicy.java
index 0b3bf453fd9c..70cd388a3382 100644
--- a/core/java/android/security/NetworkSecurityPolicy.java
+++ b/core/java/android/security/NetworkSecurityPolicy.java
@@ -46,9 +46,9 @@ public class NetworkSecurityPolicy {
* without TLS or STARTTLS) is permitted for this process.
*
* <p>When cleartext network traffic is not permitted, the platform's components (e.g. HTTP and
- * FTP stacks, {@link android.webkit.WebView}, {@link android.media.MediaPlayer}) will refuse
- * this process's requests to use cleartext traffic. Third-party libraries are strongly
- * encouraged to honor this setting as well.
+ * FTP stacks, {@link android.webkit.WebView}, {@link android.app.DownloadManager},
+ * {@link android.media.MediaPlayer}) will refuse this process's requests to use cleartext
+ * traffic. Third-party libraries are strongly encouraged to honor this setting as well.
*
* <p>This flag is honored on a best effort basis because it's impossible to prevent all
* cleartext traffic from Android applications given the level of access provided to them. For
diff --git a/core/java/android/security/keymaster/KeymasterArgument.java b/core/java/android/security/keymaster/KeymasterArgument.java
index 9a1c894fd668..9adde35045cb 100644
--- a/core/java/android/security/keymaster/KeymasterArgument.java
+++ b/core/java/android/security/keymaster/KeymasterArgument.java
@@ -42,6 +42,7 @@ abstract class KeymasterArgument implements Parcelable {
case KeymasterDefs.KM_INT_REP:
return new KeymasterIntArgument(tag, in);
case KeymasterDefs.KM_LONG:
+ case KeymasterDefs.KM_LONG_REP:
return new KeymasterLongArgument(tag, in);
case KeymasterDefs.KM_DATE:
return new KeymasterDateArgument(tag, in);
diff --git a/core/java/android/security/keymaster/KeymasterArguments.java b/core/java/android/security/keymaster/KeymasterArguments.java
index 8ed288c575b7..82f65c72a6f0 100644
--- a/core/java/android/security/keymaster/KeymasterArguments.java
+++ b/core/java/android/security/keymaster/KeymasterArguments.java
@@ -63,6 +63,12 @@ public class KeymasterArguments implements Parcelable {
}
}
+ public void addLongs(int tag, long... values) {
+ for (long value : values) {
+ addLong(tag, value);
+ }
+ }
+
public void addBoolean(int tag) {
mArguments.add(new KeymasterBooleanArgument(tag));
}
@@ -111,8 +117,13 @@ public class KeymasterArguments implements Parcelable {
}
public long getLong(int tag, long defaultValue) {
- if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_LONG) {
- throw new IllegalArgumentException("Tag is not a long type: " + tag);
+ switch (KeymasterDefs.getTagType(tag)) {
+ case KeymasterDefs.KM_LONG:
+ break; // Accepted type
+ case KeymasterDefs.KM_LONG_REP:
+ throw new IllegalArgumentException("Repeatable tags must use getLongs: " + tag);
+ default:
+ throw new IllegalArgumentException("Tag is not a long type: " + tag);
}
KeymasterArgument arg = getArgumentByTag(tag);
if (arg == null) {
@@ -175,6 +186,19 @@ public class KeymasterArguments implements Parcelable {
return values;
}
+ public List<Long> getLongs(int tag) {
+ if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_LONG_REP) {
+ throw new IllegalArgumentException("Tag is not a repeating long: " + tag);
+ }
+ List<Long> values = new ArrayList<Long>();
+ for (KeymasterArgument arg : mArguments) {
+ if (arg.tag == tag) {
+ values.add(((KeymasterLongArgument) arg).value);
+ }
+ }
+ return values;
+ }
+
public int size() {
return mArguments.size();
}
diff --git a/core/java/android/security/keymaster/KeymasterDefs.java b/core/java/android/security/keymaster/KeymasterDefs.java
index ab8a8b67095c..40baf9ce1322 100644
--- a/core/java/android/security/keymaster/KeymasterDefs.java
+++ b/core/java/android/security/keymaster/KeymasterDefs.java
@@ -118,9 +118,9 @@ public final class KeymasterDefs {
public static final int KM_DIGEST_SHA_2_512 = 6;
// Key origins.
- public static final int KM_ORIGIN_HARDWARE = 0;
- public static final int KM_ORIGIN_SOFTWARE = 1;
+ public static final int KM_ORIGIN_GENERATED = 0;
public static final int KM_ORIGIN_IMPORTED = 2;
+ public static final int KM_ORIGIN_UNKNOWN = 3;
// Key usability requirements.
public static final int KM_BLOB_STANDALONE = 0;
diff --git a/core/java/android/security/keymaster/KeymasterLongArgument.java b/core/java/android/security/keymaster/KeymasterLongArgument.java
index 9d2be098cdbc..eb17b7e3461f 100644
--- a/core/java/android/security/keymaster/KeymasterLongArgument.java
+++ b/core/java/android/security/keymaster/KeymasterLongArgument.java
@@ -28,6 +28,7 @@ class KeymasterLongArgument extends KeymasterArgument {
super(tag);
switch (KeymasterDefs.getTagType(tag)) {
case KeymasterDefs.KM_LONG:
+ case KeymasterDefs.KM_LONG_REP:
break; // OK.
default:
throw new IllegalArgumentException("Bad long tag " + tag);
diff --git a/core/java/android/service/carrier/CarrierConfigService.java b/core/java/android/service/carrier/CarrierConfigService.java
new file mode 100644
index 000000000000..1880d16fb15e
--- /dev/null
+++ b/core/java/android/service/carrier/CarrierConfigService.java
@@ -0,0 +1,104 @@
+/*
+ * 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 android.service.carrier;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.IBinder;
+
+/**
+ * A service that sets carrier configuration for telephony services.
+ * <p>
+ * To extend this class, you must declare the service in your manifest file to require the
+ * {@link android.Manifest.permission#BIND_CARRIER_CONFIG_SERVICE} permission and include an intent
+ * filter with the {@link #SERVICE_INTERFACE} action. For example:
+ * </p>
+ *
+ * <pre>{@code
+ * <service android:name=".MyCarrierConfigService"
+ * android:label="@string/service_name"
+ * android:permission="android.permission.BIND_CARRIER_CONFIG_SERVICE">
+ * <intent-filter>
+ * <action android:name="android.service.carrier.CarrierConfigService" />
+ * </intent-filter>
+ * </service>
+ * }</pre>
+ */
+public abstract class CarrierConfigService extends Service {
+
+ public static final String SERVICE_INTERFACE = "android.service.carrier.CarrierConfigService";
+
+ private final ICarrierConfigService.Stub mStubWrapper;
+
+ public CarrierConfigService() {
+ mStubWrapper = new ICarrierConfigServiceWrapper();
+ }
+
+ /**
+ * Override this method to set carrier configuration.
+ * <p>
+ * This method will be called by telephony services to get carrier-specific configuration
+ * values. The returned config will be saved by the system until,
+ * <ol>
+ * <li>The carrier app package is updated, or</li>
+ * <li>The carrier app requests a reload with
+ * {@link android.telephony.CarrierConfigManager#reloadCarrierConfigForSubId
+ * reloadCarrierConfigForSubId}.</li>
+ * </ol>
+ * This method can be called after a SIM card loads, which may be before or after boot.
+ * </p>
+ * <p>
+ * This method should not block for a long time. If expensive operations (e.g. network access)
+ * are required, this method can schedule the work and return null. Then, use
+ * {@link android.telephony.CarrierConfigManager#reloadCarrierConfigForSubId
+ * reloadCarrierConfigForSubId} to trigger a reload when the config is ready.
+ * </p>
+ * <p>
+ * Implementations should use the keys defined in {@link android.telephony.CarrierConfigManager
+ * CarrierConfigManager}. Any configuration values not set in the returned {@link Bundle} may be
+ * overridden by the system's default configuration service.
+ * </p>
+ *
+ * @param id contains details about the current carrier that can be used do decide what
+ * configuration values to return.
+ * @return a {@link Bundle} object containing the configuration or null if default values should
+ * be used.
+ */
+ public abstract Bundle onLoadConfig(CarrierIdentifier id);
+
+ /** @hide */
+ @Override
+ public final IBinder onBind(Intent intent) {
+ if (!SERVICE_INTERFACE.equals(intent.getAction())) {
+ return null;
+ }
+ return mStubWrapper;
+ }
+
+ /**
+ * A wrapper around ICarrierConfigService that forwards calls to implementations of
+ * {@link CarrierConfigService}.
+ *
+ * @hide
+ */
+ private class ICarrierConfigServiceWrapper extends ICarrierConfigService.Stub {
+
+ @Override
+ public Bundle getCarrierConfig(CarrierIdentifier id) {
+ return CarrierConfigService.this.onLoadConfig(id);
+ }
+ }
+}
diff --git a/core/java/android/service/carrier/CarrierIdentifier.aidl b/core/java/android/service/carrier/CarrierIdentifier.aidl
new file mode 100644
index 000000000000..48b13983050d
--- /dev/null
+++ b/core/java/android/service/carrier/CarrierIdentifier.aidl
@@ -0,0 +1,19 @@
+/**
+ * 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 android.service.carrier;
+
+parcelable CarrierIdentifier;
diff --git a/core/java/android/service/carrier/CarrierIdentifier.java b/core/java/android/service/carrier/CarrierIdentifier.java
new file mode 100644
index 000000000000..495fea657b4e
--- /dev/null
+++ b/core/java/android/service/carrier/CarrierIdentifier.java
@@ -0,0 +1,117 @@
+/**
+ * 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 android.service.carrier;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Used to pass info to CarrierConfigService implementations so they can decide what values to
+ * return.
+ */
+public class CarrierIdentifier implements Parcelable {
+
+ /** Used to create a {@link CarrierIdentifier} from a {@link Parcel}. */
+ public static final Creator<CarrierIdentifier> CREATOR = new Creator<CarrierIdentifier>() {
+ @Override
+ public CarrierIdentifier createFromParcel(Parcel parcel) {
+ return new CarrierIdentifier(parcel);
+ }
+
+ @Override
+ public CarrierIdentifier[] newArray(int i) {
+ return new CarrierIdentifier[i];
+ }
+ };
+
+ private String mMcc;
+ private String mMnc;
+ private String mSpn;
+ private String mImsi;
+ private String mGid1;
+ private String mGid2;
+
+ public CarrierIdentifier(String mcc, String mnc, String spn, String imsi, String gid1,
+ String gid2) {
+ mMcc = mcc;
+ mMnc = mnc;
+ mSpn = spn;
+ mImsi = imsi;
+ mGid1 = gid1;
+ mGid2 = gid2;
+ }
+
+ /** @hide */
+ public CarrierIdentifier(Parcel parcel) {
+ readFromParcel(parcel);
+ }
+
+ /** Get the mobile country code. */
+ public String getMcc() {
+ return mMcc;
+ }
+
+ /** Get the mobile network code. */
+ public String getMnc() {
+ return mMnc;
+ }
+
+ /** Get the service provider name. */
+ public String getSpn() {
+ return mSpn;
+ }
+
+ /** Get the international mobile subscriber identity. */
+ public String getImsi() {
+ return mImsi;
+ }
+
+ /** Get the group identifier level 1. */
+ public String getGid1() {
+ return mGid1;
+ }
+
+ /** Get the group identifier level 2. */
+ public String getGid2() {
+ return mGid2;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeString(mMcc);
+ out.writeString(mMnc);
+ out.writeString(mSpn);
+ out.writeString(mImsi);
+ out.writeString(mGid1);
+ out.writeString(mGid2);
+ }
+
+ /** @hide */
+ public void readFromParcel(Parcel in) {
+ mMcc = in.readString();
+ mMnc = in.readString();
+ mSpn = in.readString();
+ mImsi = in.readString();
+ mGid1 = in.readString();
+ mGid2 = in.readString();
+ }
+}
diff --git a/core/java/android/service/carrier/ICarrierConfigService.aidl b/core/java/android/service/carrier/ICarrierConfigService.aidl
new file mode 100644
index 000000000000..d8390b66a04b
--- /dev/null
+++ b/core/java/android/service/carrier/ICarrierConfigService.aidl
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2015, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.carrier;
+
+import android.os.Bundle;
+import android.service.carrier.CarrierIdentifier;
+
+/**
+ * Service used to get carrier config from carrier apps.
+ *
+ * @see android.service.carrier.CarrierConfigService
+ * @hide
+ */
+interface ICarrierConfigService {
+
+ /** @see android.service.carrier.CarrierConfigService#onLoadConfig */
+ Bundle getCarrierConfig(in CarrierIdentifier id);
+} \ No newline at end of file
diff --git a/core/java/android/service/gatekeeper/IGateKeeperService.aidl b/core/java/android/service/gatekeeper/IGateKeeperService.aidl
index 2f3e296f483f..4f4670116389 100644
--- a/core/java/android/service/gatekeeper/IGateKeeperService.aidl
+++ b/core/java/android/service/gatekeeper/IGateKeeperService.aidl
@@ -53,13 +53,27 @@ interface IGateKeeperService {
* Verifies an enrolled handle against a provided, plaintext blob.
* @param uid The Android user ID associated to this enrollment
* @param challenge a challenge to authenticate agaisnt the device credential. If successful
- * authentication occurs, this value will be written to the returned
+ * authentication occurs, this value will be written to the returned
* authentication attestation.
* @param enrolledPasswordHandle The handle against which the provided password will be
* verified.
* @param The plaintext blob to verify against enrolledPassword.
* @return an opaque attestation of authentication on success, or null.
*/
- byte[] verifyChallenge(int uid, long challenge, in byte[] enrolledPasswordHandle,
+ byte[] verifyChallenge(int uid, long challenge, in byte[] enrolledPasswordHandle,
in byte[] providedPassword);
+
+ /**
+ * Retrieves the secure identifier for the user with the provided Android ID,
+ * or 0 if none is found.
+ * @param uid the Android user id
+ */
+ long getSecureUserId(int uid);
+
+ /**
+ * Clears secure user id associated with the provided Android ID.
+ * Must be called when password is set to NONE.
+ * @param uid the Android user id.
+ */
+ void clearSecureUserId(int uid);
}
diff --git a/core/java/android/service/trust/ITrustAgentServiceCallback.aidl b/core/java/android/service/trust/ITrustAgentServiceCallback.aidl
index 76b2be0a6760..ec66cc8d3623 100644
--- a/core/java/android/service/trust/ITrustAgentServiceCallback.aidl
+++ b/core/java/android/service/trust/ITrustAgentServiceCallback.aidl
@@ -24,7 +24,7 @@ import android.os.UserHandle;
* @hide
*/
oneway interface ITrustAgentServiceCallback {
- void grantTrust(CharSequence message, long durationMs, boolean initiatedByUser);
+ void grantTrust(CharSequence message, long durationMs, int flags);
void revokeTrust();
void setManagingTrust(boolean managingTrust);
void onConfigureCompleted(boolean result, IBinder token);
diff --git a/core/java/android/service/trust/TrustAgentService.java b/core/java/android/service/trust/TrustAgentService.java
index a3178e2d5cad..9d7ffad5052e 100644
--- a/core/java/android/service/trust/TrustAgentService.java
+++ b/core/java/android/service/trust/TrustAgentService.java
@@ -17,6 +17,7 @@
package android.service.trust;
import android.Manifest;
+import android.annotation.IntDef;
import android.annotation.SdkConstant;
import android.annotation.SystemApi;
import android.app.Service;
@@ -32,6 +33,8 @@ import android.os.RemoteException;
import android.util.Log;
import android.util.Slog;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.List;
/**
@@ -69,6 +72,7 @@ import java.util.List;
*/
@SystemApi
public class TrustAgentService extends Service {
+
private final String TAG = TrustAgentService.class.getSimpleName() +
"[" + getClass().getSimpleName() + "]";
private static final boolean DEBUG = false;
@@ -86,6 +90,34 @@ public class TrustAgentService extends Service {
*/
public static final String TRUST_AGENT_META_DATA = "android.service.trust.trustagent";
+
+ /**
+ * Flag for {@link #grantTrust(CharSequence, long, int)} indicating that trust is being granted
+ * as the direct result of user action - such as solving a security challenge. The hint is used
+ * by the system to optimize the experience. Behavior may vary by device and release, so
+ * one should only set this parameter if it meets the above criteria rather than relying on
+ * the behavior of any particular device or release.
+ */
+ public static final int FLAG_GRANT_TRUST_INITIATED_BY_USER = 1 << 0;
+
+ /**
+ * Flag for {@link #grantTrust(CharSequence, long, int)} indicating that the agent would like
+ * to dismiss the keyguard. When using this flag, the {@code TrustAgentService} must ensure
+ * it is only set in response to a direct user action with the expectation of dismissing the
+ * keyguard.
+ */
+ public static final int FLAG_GRANT_TRUST_DISMISS_KEYGUARD = 1 << 1;
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(flag = true,
+ value = {
+ FLAG_GRANT_TRUST_INITIATED_BY_USER,
+ FLAG_GRANT_TRUST_DISMISS_KEYGUARD,
+ })
+ public @interface GrantTrustFlags {}
+
+
private static final int MSG_UNLOCK_ATTEMPT = 1;
private static final int MSG_CONFIGURE = 2;
private static final int MSG_TRUST_TIMEOUT = 3;
@@ -228,11 +260,35 @@ public class TrustAgentService extends Service {
* direct result of user action - such as solving a security challenge. The hint is used
* by the system to optimize the experience. Behavior may vary by device and release, so
* one should only set this parameter if it meets the above criteria rather than relying on
- * the behavior of any particular device or release.
+ * the behavior of any particular device or release. Corresponds to
+ * {@link #FLAG_GRANT_TRUST_INITIATED_BY_USER}.
* @throws IllegalStateException if the agent is not currently managing trust.
+ *
+ * @deprecated use {@link #grantTrust(CharSequence, long, int)} instead.
*/
+ @Deprecated
public final void grantTrust(
final CharSequence message, final long durationMs, final boolean initiatedByUser) {
+ grantTrust(message, durationMs, initiatedByUser ? FLAG_GRANT_TRUST_INITIATED_BY_USER : 0);
+ }
+
+ /**
+ * Call to grant trust on the device.
+ *
+ * @param message describes why the device is trusted, e.g. "Trusted by location".
+ * @param durationMs amount of time in milliseconds to keep the device in a trusted state.
+ * Trust for this agent will automatically be revoked when the timeout expires unless
+ * extended by a subsequent call to this function. The timeout is measured from the
+ * invocation of this function as dictated by {@link SystemClock#elapsedRealtime())}.
+ * For security reasons, the value should be no larger than necessary.
+ * The value may be adjusted by the system as necessary to comply with a policy controlled
+ * by the system or {@link DevicePolicyManager} restrictions. See {@link #onTrustTimeout()}
+ * for determining when trust expires.
+ * @param flags TBDocumented
+ * @throws IllegalStateException if the agent is not currently managing trust.
+ */
+ public final void grantTrust(
+ final CharSequence message, final long durationMs, @GrantTrustFlags final int flags) {
synchronized (mLock) {
if (!mManagingTrust) {
throw new IllegalStateException("Cannot grant trust if agent is not managing trust."
@@ -240,7 +296,7 @@ public class TrustAgentService extends Service {
}
if (mCallback != null) {
try {
- mCallback.grantTrust(message.toString(), durationMs, initiatedByUser);
+ mCallback.grantTrust(message.toString(), durationMs, flags);
} catch (RemoteException e) {
onError("calling enableTrust()");
}
@@ -250,7 +306,7 @@ public class TrustAgentService extends Service {
mPendingGrantTrustTask = new Runnable() {
@Override
public void run() {
- grantTrust(message, durationMs, initiatedByUser);
+ grantTrust(message, durationMs, flags);
}
};
}
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 1674950e66ce..016541fe3e90 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -17,6 +17,7 @@
package android.service.wallpaper;
import android.content.res.TypedArray;
+import android.graphics.Canvas;
import android.os.SystemProperties;
import android.view.WindowInsets;
@@ -185,6 +186,7 @@ public abstract class WallpaperService extends Service {
DisplayManager mDisplayManager;
Display mDisplay;
+ private int mDisplayState;
final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() {
{
@@ -228,7 +230,19 @@ public abstract class WallpaperService extends Service {
throw new UnsupportedOperationException(
"Wallpapers do not support keep screen on");
}
-
+
+ @Override
+ public Canvas lockCanvas() {
+ if (mDisplayState == Display.STATE_DOZE
+ || mDisplayState == Display.STATE_DOZE_SUSPEND) {
+ try {
+ mSession.pokeDrawLock(mWindow);
+ } catch (RemoteException e) {
+ // System server died, can be ignored.
+ }
+ }
+ return super.lockCanvas();
+ }
};
final class WallpaperInputEventReceiver extends InputEventReceiver {
@@ -831,9 +845,12 @@ public abstract class WallpaperService extends Service {
mWindow.setSession(mSession);
+ mLayout.packageName = getPackageName();
+
mDisplayManager = (DisplayManager)getSystemService(Context.DISPLAY_SERVICE);
mDisplayManager.registerDisplayListener(mDisplayListener, mCaller.getHandler());
mDisplay = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY);
+ mDisplayState = mDisplay.getState();
if (DEBUG) Log.v(TAG, "onCreate(): " + this);
onCreate(mSurfaceHolder);
@@ -873,8 +890,8 @@ public abstract class WallpaperService extends Service {
void reportVisibility() {
if (!mDestroyed) {
- boolean visible = mVisible
- & mDisplay != null && mDisplay.getState() != Display.STATE_OFF;
+ mDisplayState = mDisplay == null ? Display.STATE_UNKNOWN : mDisplay.getState();
+ boolean visible = mVisible && mDisplayState != Display.STATE_OFF;
if (mReportedVisible != visible) {
mReportedVisible = visible;
if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible
diff --git a/core/java/android/text/TextDirectionHeuristics.java b/core/java/android/text/TextDirectionHeuristics.java
index 866137cc3a63..354c15fae66f 100644
--- a/core/java/android/text/TextDirectionHeuristics.java
+++ b/core/java/android/text/TextDirectionHeuristics.java
@@ -81,29 +81,47 @@ public class TextDirectionHeuristics {
private static final int STATE_FALSE = 1;
private static final int STATE_UNKNOWN = 2;
- private static int isRtlText(int directionality) {
- switch (directionality) {
- case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
- return STATE_FALSE;
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
- return STATE_TRUE;
- default:
- return STATE_UNKNOWN;
- }
- }
-
- private static int isRtlTextOrFormat(int directionality) {
- switch (directionality) {
+ /* Returns STATE_TRUE for strong RTL characters, STATE_FALSE for strong LTR characters, and
+ * STATE_UNKNOWN for everything else.
+ */
+ private static int isRtlCodePoint(int codePoint) {
+ switch (Character.getDirectionality(codePoint)) {
case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
- case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
- case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
return STATE_FALSE;
case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
return STATE_TRUE;
+ case Character.DIRECTIONALITY_UNDEFINED:
+ // Unassigned characters still have bidi direction, defined at:
+ // http://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedBidiClass.txt
+
+ if ((0x0590 <= codePoint && codePoint <= 0x08FF) ||
+ (0xFB1D <= codePoint && codePoint <= 0xFDCF) ||
+ (0xFDF0 <= codePoint && codePoint <= 0xFDFF) ||
+ (0xFE70 <= codePoint && codePoint <= 0xFEFF) ||
+ (0x10800 <= codePoint && codePoint <= 0x10FFF) ||
+ (0x1E800 <= codePoint && codePoint <= 0x1EFFF)) {
+ // Unassigned RTL character
+ return STATE_TRUE;
+ } else if (
+ // Potentially-unassigned Default_Ignorable. Ranges are from unassigned
+ // characters that have Unicode property Other_Default_Ignorable_Code_Point
+ // plus some enlargening to cover bidi isolates and simplify checks.
+ (0x2065 <= codePoint && codePoint <= 0x2069) ||
+ (0xFFF0 <= codePoint && codePoint <= 0xFFF8) ||
+ (0xE0000 <= codePoint && codePoint <= 0xE0FFF) ||
+ // Non-character
+ (0xFDD0 <= codePoint && codePoint <= 0xFDEF) ||
+ ((codePoint & 0xFFFE) == 0xFFFE) ||
+ // Currency symbol
+ (0x20A0 <= codePoint && codePoint <= 0x20CF) ||
+ // Unpaired surrogate
+ (0xD800 <= codePoint && codePoint <= 0xDFFF)) {
+ return STATE_UNKNOWN;
+ } else {
+ // Unassigned LTR character
+ return STATE_FALSE;
+ }
default:
return STATE_UNKNOWN;
}
@@ -181,14 +199,26 @@ public class TextDirectionHeuristics {
/**
* Algorithm that uses the first strong directional character to determine the paragraph
- * direction. This is the standard Unicode Bidirectional algorithm.
+ * direction. This is the standard Unicode Bidirectional Algorithm (steps P2 and P3), with the
+ * exception that if no strong character is found, UNKNOWN is returned.
*/
private static class FirstStrong implements TextDirectionAlgorithm {
@Override
public int checkRtl(CharSequence cs, int start, int count) {
int result = STATE_UNKNOWN;
- for (int i = start, e = start + count; i < e && result == STATE_UNKNOWN; ++i) {
- result = isRtlTextOrFormat(Character.getDirectionality(cs.charAt(i)));
+ int openIsolateCount = 0;
+ for (int cp, i = start, end = start + count;
+ i < end && result == STATE_UNKNOWN;
+ i += Character.charCount(cp)) {
+ cp = Character.codePointAt(cs, i);
+ if (0x2066 <= cp && cp <= 0x2068) { // Opening isolates
+ openIsolateCount += 1;
+ } else if (cp == 0x2069) { // POP DIRECTIONAL ISOLATE (PDI)
+ if (openIsolateCount > 0) openIsolateCount -= 1;
+ } else if (openIsolateCount == 0) {
+ // Only consider the characters outside isolate pairs
+ result = isRtlCodePoint(cp);
+ }
}
return result;
}
@@ -200,9 +230,10 @@ public class TextDirectionHeuristics {
}
/**
- * Algorithm that uses the presence of any strong directional non-format
- * character (e.g. excludes LRE, LRO, RLE, RLO) to determine the
- * direction of text.
+ * Algorithm that uses the presence of any strong directional character of the type indicated
+ * in the constructor parameter to determine the direction of text.
+ *
+ * Characters inside isolate pairs are skipped.
*/
private static class AnyStrong implements TextDirectionAlgorithm {
private final boolean mLookForRtl;
@@ -210,22 +241,31 @@ public class TextDirectionHeuristics {
@Override
public int checkRtl(CharSequence cs, int start, int count) {
boolean haveUnlookedFor = false;
- for (int i = start, e = start + count; i < e; ++i) {
- switch (isRtlText(Character.getDirectionality(cs.charAt(i)))) {
- case STATE_TRUE:
- if (mLookForRtl) {
- return STATE_TRUE;
- }
- haveUnlookedFor = true;
- break;
- case STATE_FALSE:
- if (!mLookForRtl) {
- return STATE_FALSE;
- }
- haveUnlookedFor = true;
- break;
- default:
- break;
+ int openIsolateCount = 0;
+ for (int cp, i = start, end = start + count; i < end; i += Character.charCount(cp)) {
+ cp = Character.codePointAt(cs, i);
+ if (0x2066 <= cp && cp <= 0x2068) { // Opening isolates
+ openIsolateCount += 1;
+ } else if (cp == 0x2069) { // POP DIRECTIONAL ISOLATE (PDI)
+ if (openIsolateCount > 0) openIsolateCount -= 1;
+ } else if (openIsolateCount == 0) {
+ // Only consider the characters outside isolate pairs
+ switch (isRtlCodePoint(cp)) {
+ case STATE_TRUE:
+ if (mLookForRtl) {
+ return STATE_TRUE;
+ }
+ haveUnlookedFor = true;
+ break;
+ case STATE_FALSE:
+ if (!mLookForRtl) {
+ return STATE_FALSE;
+ }
+ haveUnlookedFor = true;
+ break;
+ default:
+ break;
+ }
}
}
if (haveUnlookedFor) {
diff --git a/core/java/android/text/method/BaseKeyListener.java b/core/java/android/text/method/BaseKeyListener.java
index 07c1ec3a9ff9..fe7571f62176 100644
--- a/core/java/android/text/method/BaseKeyListener.java
+++ b/core/java/android/text/method/BaseKeyListener.java
@@ -97,7 +97,7 @@ public abstract class BaseKeyListener extends MetaKeyKeyListener
// Delete a character.
final int start = Selection.getSelectionEnd(content);
final int end;
- if (isForwardDelete || event.isShiftPressed() || isShiftActive) {
+ if (isForwardDelete) {
end = TextUtils.getOffsetAfter(content, start);
} else {
end = TextUtils.getOffsetBefore(content, start);
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 71863b7022e8..71e2251a8020 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -170,6 +170,15 @@ public final class Display {
public static final int FLAG_PRESENTATION = 1 << 3;
/**
+ * Display flag: Indicates that the contents of the display should not be scaled
+ * to fit the physical screen dimensions. Used for development only to emulate
+ * devices with smaller physicals screens while preserving density.
+ *
+ * @hide
+ */
+ public static final int FLAG_SCALING_DISABLED = 1 << 30;
+
+ /**
* Display type: Unknown display type.
* @hide
*/
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index ecf45b446e11..243961c15dc4 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -538,6 +538,9 @@ public final class DisplayInfo implements Parcelable {
if ((flags & Display.FLAG_PRESENTATION) != 0) {
result.append(", FLAG_PRESENTATION");
}
+ if ((flags & Display.FLAG_SCALING_DISABLED) != 0) {
+ result.append(", FLAG_SCALING_DISABLED");
+ }
return result.toString();
}
}
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index d6625c837128..5994d4fbae39 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -70,6 +70,7 @@ interface IWindowManager
int getBaseDisplayDensity(int displayId);
void setForcedDisplayDensity(int displayId, int density);
void clearForcedDisplayDensity(int displayId);
+ void setForcedDisplayScalingMode(int displayId, int mode); // 0 = auto, 1 = disable
void setOverscan(int displayId, int left, int top, int right, int bottom);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 25fa34904f7a..6176b9a14ff5 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -18173,7 +18173,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// flag not set, setMeasuredDimension() was not invoked, we raise
// an exception to warn the developer
if ((mPrivateFlags & PFLAG_MEASURED_DIMENSION_SET) != PFLAG_MEASURED_DIMENSION_SET) {
- throw new IllegalStateException("onMeasure() did not set the"
+ throw new IllegalStateException("View with id " + getId() + ": "
+ + getClass().getName() + "#onMeasure() did not set the"
+ " measured dimension by calling"
+ " setMeasuredDimension()");
}
@@ -20431,11 +20432,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
static int adjust(int measureSpec, int delta) {
final int mode = getMode(measureSpec);
+ int size = getSize(measureSpec);
if (mode == UNSPECIFIED) {
// No need to adjust size for UNSPECIFIED mode.
- return makeMeasureSpec(0, UNSPECIFIED);
+ return makeMeasureSpec(size, UNSPECIFIED);
}
- int size = getSize(measureSpec) + delta;
+ size += delta;
if (size < 0) {
Log.e(VIEW_LOG_TAG, "MeasureSpec.adjust: new size would be negative! (" + size +
") spec: " + toString(measureSpec) + " delta: " + delta);
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 98b895d893cc..afc0eeef91eb 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -494,6 +494,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
*/
private int mNestedScrollAxes;
+ // Used to manage the list of transient views, added by addTransientView()
+ private List<Integer> mTransientIndices = null;
+ private List<View> mTransientViews = null;
+
+
/**
* Empty ActionMode used as a sentinel in recursive entries to startActionModeForChild.
*
@@ -2822,6 +2827,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
child.dispatchAttachedToWindow(info,
visibility | (child.mViewFlags & VISIBILITY_MASK));
}
+ final int transientCount = mTransientIndices == null ? 0 : mTransientIndices.size();
+ for (int i = 0; i < transientCount; ++i) {
+ View view = mTransientViews.get(i);
+ view.dispatchAttachedToWindow(info, visibility | (view.mViewFlags & VISIBILITY_MASK));
+ }
}
@Override
@@ -2991,6 +3001,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
children[i].dispatchDetachedFromWindow();
}
clearDisappearingChildren();
+ final int transientCount = mTransientViews == null ? 0 : mTransientIndices.size();
+ for (int i = 0; i < transientCount; ++i) {
+ View view = mTransientViews.get(i);
+ view.dispatchDetachedFromWindow();
+ }
super.dispatchDetachedFromWindow();
}
@@ -3291,6 +3306,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
final long drawingTime = getDrawingTime();
if (usingRenderNodeProperties) canvas.insertReorderBarrier();
+ final int transientCount = mTransientIndices == null ? 0 : mTransientIndices.size();
+ int transientIndex = transientCount != 0 ? 0 : -1;
// Only use the preordered list if not HW accelerated, since the HW pipeline will do the
// draw reordering internally
final ArrayList<View> preorderedList = usingRenderNodeProperties
@@ -3298,6 +3315,17 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
final boolean customOrder = preorderedList == null
&& isChildrenDrawingOrderEnabled();
for (int i = 0; i < childrenCount; i++) {
+ while (transientIndex >= 0 && mTransientIndices.get(transientIndex) == i) {
+ final View transientChild = mTransientViews.get(transientIndex);
+ if ((transientChild.mViewFlags & VISIBILITY_MASK) == VISIBLE ||
+ transientChild.getAnimation() != null) {
+ more |= drawChild(canvas, transientChild, drawingTime);
+ }
+ transientIndex++;
+ if (transientIndex >= transientCount) {
+ transientIndex = -1;
+ }
+ }
int childIndex = customOrder ? getChildDrawingOrder(childrenCount, i) : i;
final View child = (preorderedList == null)
? children[childIndex] : preorderedList.get(childIndex);
@@ -3305,6 +3333,18 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
more |= drawChild(canvas, child, drawingTime);
}
}
+ while (transientIndex >= 0) {
+ // there may be additional transient views after the normal views
+ final View transientChild = mTransientViews.get(transientIndex);
+ if ((transientChild.mViewFlags & VISIBILITY_MASK) == VISIBLE ||
+ transientChild.getAnimation() != null) {
+ more |= drawChild(canvas, transientChild, drawingTime);
+ }
+ transientIndex++;
+ if (transientIndex >= transientCount) {
+ break;
+ }
+ }
if (preorderedList != null) preorderedList.clear();
// Draw any disappearing views that have animations
@@ -3785,6 +3825,135 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
/**
+ * This method adds a view to this container at the specified index purely for the
+ * purposes of allowing that view to draw even though it is not a normal child of
+ * the container. That is, the view does not participate in layout, focus, accessibility,
+ * input, or other normal view operations; it is purely an item to be drawn during the normal
+ * rendering operation of this container. The index that it is added at is the order
+ * in which it will be drawn, with respect to the other views in the container.
+ * For example, a transient view added at index 0 will be drawn before all other views
+ * in the container because it will be drawn first (including before any real view
+ * at index 0). There can be more than one transient view at any particular index;
+ * these views will be drawn in the order in which they were added to the list of
+ * transient views. The index of transient views can also be greater than the number
+ * of normal views in the container; that just means that they will be drawn after all
+ * other views are drawn.
+ *
+ * <p>Note that since transient views do not participate in layout, they must be sized
+ * manually or, more typically, they should just use the size that they had before they
+ * were removed from their container.</p>
+ *
+ * <p>Transient views are useful for handling animations of views that have been removed
+ * from the container, but which should be animated out after the removal. Adding these
+ * views as transient views allows them to participate in drawing without side-effecting
+ * the layout of the container.</p>
+ *
+ * <p>Transient views must always be explicitly {@link #removeTransientView(View) removed}
+ * from the container when they are no longer needed. For example, a transient view
+ * which is added in order to fade it out in its old location should be removed
+ * once the animation is complete.</p>
+ *
+ * @param view The view to be added
+ * @param index The index at which this view should be drawn, must be >= 0.
+ * This value is relative to the {@link #getChildAt(int) index} values in the normal
+ * child list of this container, where any transient view at a particular index will
+ * be drawn before any normal child at that same index.
+ */
+ public void addTransientView(View view, int index) {
+ if (index < 0) {
+ return;
+ }
+ if (mTransientIndices == null) {
+ mTransientIndices = new ArrayList<Integer>();
+ mTransientViews = new ArrayList<View>();
+ }
+ final int oldSize = mTransientIndices.size();
+ if (oldSize > 0) {
+ int insertionIndex;
+ for (insertionIndex = 0; insertionIndex < oldSize; ++insertionIndex) {
+ if (index < mTransientIndices.get(insertionIndex)) {
+ break;
+ }
+ }
+ mTransientIndices.add(insertionIndex, index);
+ mTransientViews.add(insertionIndex, view);
+ } else {
+ mTransientIndices.add(index);
+ mTransientViews.add(view);
+ }
+ view.mParent = this;
+ view.dispatchAttachedToWindow(mAttachInfo, (mViewFlags&VISIBILITY_MASK));
+ invalidate(true);
+ }
+
+ /**
+ * Removes a view from the list of transient views in this container. If there is no
+ * such transient view, this method does nothing.
+ *
+ * @param view The transient view to be removed
+ */
+ public void removeTransientView(View view) {
+ if (mTransientViews == null) {
+ return;
+ }
+ final int size = mTransientViews.size();
+ for (int i = 0; i < size; ++i) {
+ if (view == mTransientViews.get(i)) {
+ mTransientViews.remove(i);
+ mTransientIndices.remove(i);
+ view.mParent = null;
+ view.dispatchDetachedFromWindow();
+ invalidate(true);
+ return;
+ }
+ }
+ }
+
+ /**
+ * Returns the number of transient views in this container. Specific transient
+ * views and the index at which they were added can be retrieved via
+ * {@link #getTransientView(int)} and {@link #getTransientViewIndex(int)}.
+ *
+ * @see #addTransientView(View, int)
+ * @return The number of transient views in this container
+ */
+ public int getTransientViewCount() {
+ return mTransientIndices == null ? 0 : mTransientIndices.size();
+ }
+
+ /**
+ * Given a valid position within the list of transient views, returns the index of
+ * the transient view at that position.
+ *
+ * @param position The position of the index being queried. Must be at least 0
+ * and less than the value returned by {@link #getTransientViewCount()}.
+ * @return The index of the transient view stored in the given position if the
+ * position is valid, otherwise -1
+ */
+ public int getTransientViewIndex(int position) {
+ if (position < 0 || mTransientIndices == null || position >= mTransientIndices.size()) {
+ return -1;
+ }
+ return mTransientIndices.get(position);
+ }
+
+ /**
+ * Given a valid position within the list of transient views, returns the
+ * transient view at that position.
+ *
+ * @param position The position of the view being queried. Must be at least 0
+ * and less than the value returned by {@link #getTransientViewCount()}.
+ * @return The transient view stored in the given position if the
+ * position is valid, otherwise null
+ */
+ public View getTransientView(int position) {
+ if (mTransientViews == null || position >= mTransientViews.size()) {
+ return null;
+ }
+ return mTransientViews.get(position);
+ }
+
+ /**
* <p>Adds a child view. If no layout parameters are already set on the child, the
* default parameters for this ViewGroup are set on the child.</p>
*
@@ -4096,6 +4265,16 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
if (child.getVisibility() != View.GONE) {
notifySubtreeAccessibilityStateChangedIfNeeded();
}
+
+ if (mTransientIndices != null) {
+ final int transientCount = mTransientIndices.size();
+ for (int i = 0; i < transientCount; ++i) {
+ final int oldIndex = mTransientIndices.get(i);
+ if (index <= oldIndex) {
+ mTransientIndices.set(i, oldIndex + 1);
+ }
+ }
+ }
}
private void addInArray(View child, int index) {
@@ -4340,6 +4519,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
if (view.getVisibility() != View.GONE) {
notifySubtreeAccessibilityStateChangedIfNeeded();
}
+
+ int transientCount = mTransientIndices == null ? 0 : mTransientIndices.size();
+ for (int i = 0; i < transientCount; ++i) {
+ final int oldIndex = mTransientIndices.get(i);
+ if (index < oldIndex) {
+ mTransientIndices.set(i, oldIndex - 1);
+ }
+ }
}
/**
@@ -6353,6 +6540,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
public void onStopNestedScroll(View child) {
// Stop any recursive nested scrolling.
stopNestedScroll();
+ mNestedScrollAxes = 0;
}
/**
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index d6f9f786c033..ff74c605dcd2 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -703,9 +703,9 @@ public abstract class AbsSeekBar extends ProgressBar {
// fallthrough
case KeyEvent.KEYCODE_DPAD_RIGHT:
increment = isLayoutRtl() ? -increment : increment;
- int progress = getProgress() + increment;
- if (progress > 0 && progress < getMax()) {
- setProgress(progress, true);
+
+ // Let progress bar handle clamping values.
+ if (setProgress(getProgress() + increment, true)) {
onKeyChange();
return true;
}
@@ -729,10 +729,10 @@ public abstract class AbsSeekBar extends ProgressBar {
if (isEnabled()) {
final int progress = getProgress();
if (progress > 0) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
}
if (progress < getMax()) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
}
}
}
@@ -743,29 +743,26 @@ public abstract class AbsSeekBar extends ProgressBar {
if (super.performAccessibilityActionInternal(action, arguments)) {
return true;
}
+
if (!isEnabled()) {
return false;
}
- final int progress = getProgress();
- final int increment = Math.max(1, Math.round((float) getMax() / 5));
- switch (action) {
- case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
- if (progress <= 0) {
- return false;
- }
- setProgress(progress - increment, true);
- onKeyChange();
- return true;
+
+ if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD
+ || action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
+ int increment = Math.max(1, Math.round((float) getMax() / 5));
+ if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
+ increment = -increment;
}
- case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
- if (progress >= getMax()) {
- return false;
- }
- setProgress(progress + increment, true);
+
+ // Let progress bar handle clamping values.
+ if (setProgress(getProgress() + increment, true)) {
onKeyChange();
return true;
}
+ return false;
}
+
return false;
}
diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java
index 4b5407a8a5dc..552b274065f9 100644
--- a/core/java/android/widget/FastScroller.java
+++ b/core/java/android/widget/FastScroller.java
@@ -662,7 +662,8 @@ class FastScroller {
final int adjMaxWidth = maxWidth - marginLeft - marginRight;
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
- final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(container.height(),
+ MeasureSpec.UNSPECIFIED);
view.measure(widthMeasureSpec, heightMeasureSpec);
// Align to the left or right.
@@ -701,7 +702,8 @@ class FastScroller {
final int containerWidth = container.width();
final int adjMaxWidth = containerWidth - marginLeft - marginRight;
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(adjMaxWidth, MeasureSpec.AT_MOST);
- final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(container.height(),
+ MeasureSpec.UNSPECIFIED);
preview.measure(widthMeasureSpec, heightMeasureSpec);
// Align at the vertical center, 10% from the top.
@@ -766,7 +768,8 @@ class FastScroller {
final Rect container = mContainerRect;
final int maxWidth = container.width();
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.AT_MOST);
- final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(container.height(),
+ MeasureSpec.UNSPECIFIED);
track.measure(widthMeasureSpec, heightMeasureSpec);
final int top;
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index be0ca71907df..9ecdc9c35214 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -1071,7 +1071,8 @@ public class GridView extends AbsListView {
p.forceAdd = true;
int childHeightSpec = getChildMeasureSpec(
- MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 0, p.height);
+ MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(heightMeasureSpec),
+ MeasureSpec.UNSPECIFIED), 0, p.height);
int childWidthSpec = getChildMeasureSpec(
MeasureSpec.makeMeasureSpec(mColumnWidth, MeasureSpec.EXACTLY), 0, p.width);
child.measure(childWidthSpec, childHeightSpec);
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index da15302b3552..72f51c91da5f 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -1058,8 +1058,11 @@ public class LinearLayout extends ViewGroup {
// use as much space as it wants because we can shrink things
// later (and re-measure).
if (baselineAligned) {
- final int freeSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
- child.measure(freeSpec, freeSpec);
+ final int freeWidthSpec = MeasureSpec.makeMeasureSpec(
+ MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.UNSPECIFIED);
+ final int freeHeightSpec = MeasureSpec.makeMeasureSpec(
+ MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.UNSPECIFIED);
+ child.measure(freeWidthSpec, freeHeightSpec);
} else {
skippedMeasure = true;
}
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index def5929e33ca..a79c8e891c9a 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -1155,7 +1155,7 @@ public class ListView extends AbsListView {
heightMode == MeasureSpec.UNSPECIFIED)) {
final View child = obtainView(0, mIsScrap);
- measureScrapChild(child, 0, widthMeasureSpec);
+ measureScrapChild(child, 0, widthMeasureSpec, heightSize);
childWidth = child.getMeasuredWidth();
childHeight = child.getMeasuredHeight();
@@ -1188,7 +1188,7 @@ public class ListView extends AbsListView {
mWidthMeasureSpec = widthMeasureSpec;
}
- private void measureScrapChild(View child, int position, int widthMeasureSpec) {
+ private void measureScrapChild(View child, int position, int widthMeasureSpec, int heightHint) {
LayoutParams p = (LayoutParams) child.getLayoutParams();
if (p == null) {
p = (AbsListView.LayoutParams) generateDefaultLayoutParams();
@@ -1204,7 +1204,7 @@ public class ListView extends AbsListView {
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
} else {
- childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ childHeightSpec = MeasureSpec.makeMeasureSpec(heightHint, MeasureSpec.UNSPECIFIED);
}
child.measure(childWidthSpec, childHeightSpec);
}
@@ -1271,7 +1271,7 @@ public class ListView extends AbsListView {
for (i = startPosition; i <= endPosition; ++i) {
child = obtainView(i, isScrap);
- measureScrapChild(child, i, widthMeasureSpec);
+ measureScrapChild(child, i, widthMeasureSpec, maxHeight);
if (i > 0) {
// Count the divider for all but one child
@@ -1941,7 +1941,8 @@ public class ListView extends AbsListView {
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
} else {
- childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ childHeightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(),
+ MeasureSpec.UNSPECIFIED);
}
child.measure(childWidthSpec, childHeightSpec);
} else {
@@ -2695,7 +2696,8 @@ public class ListView extends AbsListView {
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
} else {
- childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ childHeightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(),
+ MeasureSpec.UNSPECIFIED);
}
child.measure(childWidthSpec, childHeightSpec);
}
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 24e9cbef3091..b59ae17ebcea 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -43,6 +43,7 @@ import android.graphics.drawable.shapes.Shape;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
+import android.util.MathUtils;
import android.util.Pools.SynchronizedPool;
import android.view.Gravity;
import android.view.RemotableViewMethod;
@@ -1341,23 +1342,22 @@ public class ProgressBar extends View {
}
@android.view.RemotableViewMethod
- synchronized void setProgress(int progress, boolean fromUser) {
+ synchronized boolean setProgress(int progress, boolean fromUser) {
if (mIndeterminate) {
- return;
+ // Not applicable.
+ return false;
}
- if (progress < 0) {
- progress = 0;
- }
+ progress = MathUtils.constrain(progress, 0, mMax);
- if (progress > mMax) {
- progress = mMax;
+ if (progress == mProgress) {
+ // No change from current.
+ return false;
}
- if (progress != mProgress) {
- mProgress = progress;
- refreshProgress(R.id.progress, mProgress, fromUser);
- }
+ mProgress = progress;
+ refreshProgress(R.id.progress, mProgress, fromUser);
+ return true;
}
/**
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index b95c27d35208..202616969eb3 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -1238,7 +1238,8 @@ public class ScrollView extends FrameLayout {
}
@Override
- protected void measureChild(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec) {
+ protected void measureChild(View child, int parentWidthMeasureSpec,
+ int parentHeightMeasureSpec) {
ViewGroup.LayoutParams lp = child.getLayoutParams();
int childWidthMeasureSpec;
@@ -1247,7 +1248,8 @@ public class ScrollView extends FrameLayout {
childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec, mPaddingLeft
+ mPaddingRight, lp.width);
- childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(
+ MeasureSpec.getSize(parentHeightMeasureSpec), MeasureSpec.UNSPECIFIED);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
@@ -1261,7 +1263,7 @@ public class ScrollView extends FrameLayout {
mPaddingLeft + mPaddingRight + lp.leftMargin + lp.rightMargin
+ widthUsed, lp.width);
final int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(
- lp.topMargin + lp.bottomMargin, MeasureSpec.UNSPECIFIED);
+ MeasureSpec.getSize(parentHeightMeasureSpec), MeasureSpec.UNSPECIFIED);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index 3746ec6108bc..095cc444c025 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -811,9 +811,9 @@ public class Spinner extends AbsSpinner implements OnClickListener {
View itemView = null;
int itemType = 0;
final int widthMeasureSpec =
- MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.UNSPECIFIED);
final int heightMeasureSpec =
- MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.UNSPECIFIED);
// Make sure the number of items we'll measure is capped. If it's a huge data set
// with wildly varying sizes, oh well.
diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java
index 9496e6295dfc..aa7168c617f0 100644
--- a/core/java/android/widget/TabWidget.java
+++ b/core/java/android/widget/TabWidget.java
@@ -173,11 +173,12 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
}
// First, measure with no constraint
- final int unspecifiedWidth = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ final int width = MeasureSpec.getSize(widthMeasureSpec);
+ final int unspecifiedWidth = MeasureSpec.makeMeasureSpec(width, MeasureSpec.UNSPECIFIED);
mImposedTabsHeight = -1;
super.measureHorizontal(unspecifiedWidth, heightMeasureSpec);
- int extraWidth = getMeasuredWidth() - MeasureSpec.getSize(widthMeasureSpec);
+ int extraWidth = getMeasuredWidth() - width;
if (extraWidth > 0) {
final int count = getChildCount();
diff --git a/core/java/android/widget/TableLayout.java b/core/java/android/widget/TableLayout.java
index 093bdcf61d21..6fdd8748bd6d 100644
--- a/core/java/android/widget/TableLayout.java
+++ b/core/java/android/widget/TableLayout.java
@@ -467,7 +467,7 @@ public class TableLayout extends LinearLayout {
*/
@Override
void measureVertical(int widthMeasureSpec, int heightMeasureSpec) {
- findLargestCells(widthMeasureSpec);
+ findLargestCells(widthMeasureSpec, heightMeasureSpec);
shrinkAndStretchColumns(widthMeasureSpec);
super.measureVertical(widthMeasureSpec, heightMeasureSpec);
@@ -479,7 +479,7 @@ public class TableLayout extends LinearLayout {
*
* @param widthMeasureSpec the measure constraint imposed by our parent
*/
- private void findLargestCells(int widthMeasureSpec) {
+ private void findLargestCells(int widthMeasureSpec, int heightMeasureSpec) {
boolean firstRow = true;
// find the maximum width for each column
@@ -502,7 +502,7 @@ public class TableLayout extends LinearLayout {
final ViewGroup.LayoutParams layoutParams = row.getLayoutParams();
layoutParams.height = LayoutParams.WRAP_CONTENT;
- final int[] widths = row.getColumnsWidths(widthMeasureSpec);
+ final int[] widths = row.getColumnsWidths(widthMeasureSpec, heightMeasureSpec);
final int newLength = widths.length;
// this is the first row, we just need to copy the values
if (firstRow) {
diff --git a/core/java/android/widget/TableRow.java b/core/java/android/widget/TableRow.java
index faf5b84809c4..f73ee49da2f1 100644
--- a/core/java/android/widget/TableRow.java
+++ b/core/java/android/widget/TableRow.java
@@ -283,7 +283,7 @@ public class TableRow extends LinearLayout {
* column, in this row
* {@hide}
*/
- int[] getColumnsWidths(int widthMeasureSpec) {
+ int[] getColumnsWidths(int widthMeasureSpec, int heightMeasureSpec) {
final int numColumns = getVirtualChildCount();
if (mColumnWidths == null || numColumns != mColumnWidths.length) {
mColumnWidths = new int[numColumns];
@@ -302,7 +302,9 @@ public class TableRow extends LinearLayout {
spec = getChildMeasureSpec(widthMeasureSpec, 0, LayoutParams.WRAP_CONTENT);
break;
case LayoutParams.MATCH_PARENT:
- spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ spec = MeasureSpec.makeMeasureSpec(
+ MeasureSpec.getSize(heightMeasureSpec),
+ MeasureSpec.UNSPECIFIED);
break;
default:
spec = MeasureSpec.makeMeasureSpec(layoutParams.width, MeasureSpec.EXACTLY);
diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl
index 4f0e29ebed39..7c5c56555bdf 100644
--- a/core/java/com/android/internal/app/IBatteryStats.aidl
+++ b/core/java/com/android/internal/app/IBatteryStats.aidl
@@ -95,9 +95,6 @@ interface IBatteryStats {
void noteWifiState(int wifiState, String accessPoint);
void noteWifiSupplicantStateChanged(int supplState, boolean failedAuth);
void noteWifiRssiChanged(int newRssi);
- void noteBluetoothOn();
- void noteBluetoothOff();
- void noteBluetoothState(int bluetoothState);
void noteFullWifiLockAcquired(int uid);
void noteFullWifiLockReleased(int uid);
void noteWifiScanStarted(int uid);
diff --git a/core/java/com/android/internal/os/BatteryStatsHelper.java b/core/java/com/android/internal/os/BatteryStatsHelper.java
index 59dbec6098d3..a53d46c8cead 100644
--- a/core/java/com/android/internal/os/BatteryStatsHelper.java
+++ b/core/java/com/android/internal/os/BatteryStatsHelper.java
@@ -136,6 +136,14 @@ public final class BatteryStatsHelper {
profile.getAveragePower(PowerProfile.POWER_WIFI_CONTROLLER_TX) != 0;
}
+ public static boolean checkHasBluetoothPowerReporting(BatteryStats stats,
+ PowerProfile profile) {
+ return stats.hasBluetoothActivityReporting() &&
+ profile.getAveragePower(PowerProfile.POWER_BLUETOOTH_CONTROLLER_IDLE) != 0 &&
+ profile.getAveragePower(PowerProfile.POWER_BLUETOOTH_CONTROLLER_RX) != 0 &&
+ profile.getAveragePower(PowerProfile.POWER_BLUETOOTH_CONTROLLER_TX) != 0;
+ }
+
public BatteryStatsHelper(Context context) {
this(context, true);
}
@@ -256,7 +264,8 @@ public final class BatteryStatsHelper {
}
public static String makemAh(double power) {
- if (power < .00001) return String.format("%.8f", power);
+ if (power == 0) return "0";
+ else if (power < .00001) return String.format("%.8f", power);
else if (power < .0001) return String.format("%.7f", power);
else if (power < .001) return String.format("%.6f", power);
else if (power < .01) return String.format("%.5f", power);
@@ -342,7 +351,11 @@ public final class BatteryStatsHelper {
mWifiPowerCalculator.reset();
if (mBluetoothPowerCalculator == null) {
- mBluetoothPowerCalculator = new BluetoothPowerCalculator();
+ if (checkHasBluetoothPowerReporting(mStats, mPowerProfile)) {
+ mBluetoothPowerCalculator = new BluetoothPowerCalculator();
+ } else {
+ mBluetoothPowerCalculator = new BluetoothPowerCalculator();
+ }
}
mBluetoothPowerCalculator.reset();
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 87605f680d27..405c861a498a 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -19,8 +19,6 @@ package com.android.internal.os;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.bluetooth.BluetoothActivityEnergyInfo;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothHeadset;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
@@ -84,7 +82,6 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
@@ -107,7 +104,7 @@ public final class BatteryStatsImpl extends BatteryStats {
private static final int MAGIC = 0xBA757475; // 'BATSTATS'
// Current on-disk Parcel version
- private static final int VERSION = 123 + (USE_OLD_HISTORY ? 1000 : 0);
+ private static final int VERSION = 125 + (USE_OLD_HISTORY ? 1000 : 0);
// Maximum number of items we will record in the history.
private static final int MAX_HISTORY_ITEMS = 2000;
@@ -176,7 +173,7 @@ public final class BatteryStatsImpl extends BatteryStats {
}
public interface ExternalStatsSync {
- void scheduleSync();
+ void scheduleSync(String reason);
}
public final MyHandler mHandler;
@@ -250,6 +247,8 @@ public final class BatteryStatsImpl extends BatteryStats {
int mNumHistoryTagChars = 0;
int mHistoryBufferLastPos = -1;
boolean mHistoryOverflow = false;
+ int mActiveHistoryStates = 0xffffffff;
+ int mActiveHistoryStates2 = 0xffffffff;
long mLastHistoryElapsedRealtime = 0;
long mTrackRunningHistoryElapsedRealtime = 0;
long mTrackRunningHistoryUptime = 0;
@@ -313,7 +312,7 @@ public final class BatteryStatsImpl extends BatteryStats {
int mWakeLockNesting;
boolean mWakeLockImportant;
- boolean mRecordAllHistory;
+ public boolean mRecordAllHistory;
boolean mNoAutoReset;
int mScreenState = Display.STATE_UNKNOWN;
@@ -384,12 +383,6 @@ public final class BatteryStatsImpl extends BatteryStats {
final StopwatchTimer[] mWifiSignalStrengthsTimer =
new StopwatchTimer[NUM_WIFI_SIGNAL_STRENGTH_BINS];
- boolean mBluetoothOn;
- StopwatchTimer mBluetoothOnTimer;
-
- int mBluetoothState = -1;
- final StopwatchTimer[] mBluetoothStateTimer = new StopwatchTimer[NUM_BLUETOOTH_STATES];
-
int mMobileRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW;
long mMobileRadioActiveStartTime;
StopwatchTimer mMobileRadioActiveTimer;
@@ -398,8 +391,7 @@ public final class BatteryStatsImpl extends BatteryStats {
LongSamplingCounter mMobileRadioActiveUnknownTime;
LongSamplingCounter mMobileRadioActiveUnknownCount;
- /** Bluetooth headset object */
- BluetoothHeadset mBtHeadset;
+ int mWifiRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW;
/**
* These provide time bases that discount the time the device is plugged
@@ -458,9 +450,6 @@ public final class BatteryStatsImpl extends BatteryStats {
long mLastWriteTime = 0; // Milliseconds
- private int mBluetoothPingCount;
- private int mBluetoothPingStart = -1;
-
private int mPhoneServiceState = -1;
private int mPhoneServiceStateRaw = -1;
private int mPhoneSimStateRaw = -1;
@@ -1803,32 +1792,6 @@ public final class BatteryStatsImpl extends BatteryStats {
return kwlt;
}
- private int getCurrentBluetoothPingCount() {
- if (mBtHeadset != null) {
- List<BluetoothDevice> deviceList = mBtHeadset.getConnectedDevices();
- if (deviceList.size() > 0) {
- return mBtHeadset.getBatteryUsageHint(deviceList.get(0));
- }
- }
- return -1;
- }
-
- public int getBluetoothPingCount() {
- if (mBluetoothPingStart == -1) {
- return mBluetoothPingCount;
- } else if (mBtHeadset != null) {
- return getCurrentBluetoothPingCount() - mBluetoothPingStart;
- }
- return 0;
- }
-
- public void setBtHeadset(BluetoothHeadset headset) {
- if (headset != null && mBtHeadset == null && isOnBattery() && mBluetoothPingStart == -1) {
- mBluetoothPingStart = getCurrentBluetoothPingCount();
- }
- mBtHeadset = headset;
- }
-
private int writeHistoryTag(HistoryTag tag) {
Integer idxObj = mHistoryTagPool.get(tag);
int idx;
@@ -2259,8 +2222,8 @@ public final class BatteryStatsImpl extends BatteryStats {
}
final long timeDiff = (mHistoryBaseTime+elapsedRealtimeMs) - mHistoryLastWritten.time;
- final int diffStates = mHistoryLastWritten.states^cur.states;
- final int diffStates2 = mHistoryLastWritten.states2^cur.states2;
+ final int diffStates = mHistoryLastWritten.states^(cur.states&mActiveHistoryStates);
+ final int diffStates2 = mHistoryLastWritten.states2^(cur.states2&mActiveHistoryStates2);
final int lastDiffStates = mHistoryLastWritten.states^mHistoryLastLastWritten.states;
final int lastDiffStates2 = mHistoryLastWritten.states2^mHistoryLastLastWritten.states2;
if (DEBUG) Slog.i(TAG, "ADD: tdelta=" + timeDiff + " diff="
@@ -2325,11 +2288,32 @@ public final class BatteryStatsImpl extends BatteryStats {
return;
}
+ // After overflow, we allow various bit-wise states to settle to 0.
+ boolean writeAnyway = false;
+ final int curStates = cur.states & HistoryItem.SETTLE_TO_ZERO_STATES
+ & mActiveHistoryStates;
+ if (mHistoryLastWritten.states != curStates) {
+ // mActiveHistoryStates keeps track of which bits in .states are now being
+ // forced to 0.
+ int old = mActiveHistoryStates;
+ mActiveHistoryStates &= curStates | ~HistoryItem.SETTLE_TO_ZERO_STATES;
+ writeAnyway |= old != mActiveHistoryStates;
+ }
+ final int curStates2 = cur.states2 & HistoryItem.SETTLE_TO_ZERO_STATES2
+ & mActiveHistoryStates2;
+ if (mHistoryLastWritten.states2 != curStates2) {
+ // mActiveHistoryStates2 keeps track of which bits in .states2 are now being
+ // forced to 0.
+ int old = mActiveHistoryStates2;
+ mActiveHistoryStates2 &= curStates2 | ~HistoryItem.SETTLE_TO_ZERO_STATES2;
+ writeAnyway |= old != mActiveHistoryStates2;
+ }
+
// Once we've reached the maximum number of items, we only
// record changes to the battery level and the most interesting states.
// Once we've reached the maximum maximum number of items, we only
// record changes to the battery level.
- if (mHistoryLastWritten.batteryLevel == cur.batteryLevel &&
+ if (!writeAnyway && mHistoryLastWritten.batteryLevel == cur.batteryLevel &&
(dataSize >= MAX_MAX_HISTORY_BUFFER
|| ((mHistoryLastWritten.states^cur.states)
& HistoryItem.MOST_INTERESTING_STATES) == 0
@@ -2360,6 +2344,8 @@ public final class BatteryStatsImpl extends BatteryStats {
mHistoryBufferLastPos = mHistoryBuffer.dataPosition();
mHistoryLastLastWritten.setTo(mHistoryLastWritten);
mHistoryLastWritten.setTo(mHistoryBaseTime + elapsedRealtimeMs, cmd, cur);
+ mHistoryLastWritten.states &= mActiveHistoryStates;
+ mHistoryLastWritten.states2 &= mActiveHistoryStates2;
writeHistoryDelta(mHistoryBuffer, mHistoryLastWritten, mHistoryLastLastWritten);
mLastHistoryElapsedRealtime = elapsedRealtimeMs;
cur.wakelockTag = null;
@@ -2411,8 +2397,8 @@ public final class BatteryStatsImpl extends BatteryStats {
// into one record.
if (mHistoryEnd != null && mHistoryEnd.cmd == HistoryItem.CMD_UPDATE
&& (mHistoryBaseTime+elapsedRealtimeMs) < (mHistoryEnd.time+1000)
- && ((mHistoryEnd.states^cur.states)&mChangedStates) == 0
- && ((mHistoryEnd.states2^cur.states2)&mChangedStates2) == 0) {
+ && ((mHistoryEnd.states^cur.states)&mChangedStates&mActiveHistoryStates) == 0
+ && ((mHistoryEnd.states2^cur.states2)&mChangedStates2&mActiveHistoryStates2) == 0) {
// If the current is the same as the one before, then we no
// longer need the entry.
if (mHistoryLastEnd != null && mHistoryLastEnd.cmd == HistoryItem.CMD_UPDATE
@@ -2424,8 +2410,8 @@ public final class BatteryStatsImpl extends BatteryStats {
mHistoryEnd = mHistoryLastEnd;
mHistoryLastEnd = null;
} else {
- mChangedStates |= mHistoryEnd.states^cur.states;
- mChangedStates2 |= mHistoryEnd.states^cur.states2;
+ mChangedStates |= mHistoryEnd.states^(cur.states&mActiveHistoryStates);
+ mChangedStates2 |= mHistoryEnd.states^(cur.states2&mActiveHistoryStates2);
mHistoryEnd.setTo(mHistoryEnd.time, HistoryItem.CMD_UPDATE, cur);
}
return;
@@ -2447,7 +2433,7 @@ public final class BatteryStatsImpl extends BatteryStats {
if (mHistoryEnd != null && mHistoryEnd.batteryLevel
== cur.batteryLevel &&
(mNumHistoryItems >= MAX_MAX_HISTORY_ITEMS
- || ((mHistoryEnd.states^cur.states)
+ || ((mHistoryEnd.states^(cur.states&mActiveHistoryStates))
& HistoryItem.MOST_INTERESTING_STATES) == 0)) {
return;
}
@@ -2456,7 +2442,7 @@ public final class BatteryStatsImpl extends BatteryStats {
addHistoryRecordLocked(elapsedRealtimeMs, HistoryItem.CMD_UPDATE);
}
- void addHistoryEventLocked(long elapsedRealtimeMs, long uptimeMs, int code,
+ public void addHistoryEventLocked(long elapsedRealtimeMs, long uptimeMs, int code,
String name, int uid) {
mHistoryCur.eventCode = code;
mHistoryCur.eventTag = mHistoryCur.localEventTag;
@@ -2515,23 +2501,15 @@ public final class BatteryStatsImpl extends BatteryStats {
mNumHistoryTagChars = 0;
mHistoryBufferLastPos = -1;
mHistoryOverflow = false;
+ mActiveHistoryStates = 0xffffffff;
+ mActiveHistoryStates2 = 0xffffffff;
mLastRecordedClockTime = 0;
mLastRecordedClockRealtime = 0;
}
public void updateTimeBasesLocked(boolean unplugged, boolean screenOff, long uptime,
long realtime) {
- if (mOnBatteryTimeBase.setRunning(unplugged, uptime, realtime)) {
- if (unplugged) {
- // Track bt headset ping count
- mBluetoothPingStart = getCurrentBluetoothPingCount();
- mBluetoothPingCount = 0;
- } else {
- // Track bt headset ping count
- mBluetoothPingCount = getBluetoothPingCount();
- mBluetoothPingStart = -1;
- }
- }
+ mOnBatteryTimeBase.setRunning(unplugged, uptime, realtime);
boolean unpluggedScreenOff = unplugged && screenOff;
if (unpluggedScreenOff != mOnBatteryScreenOffTimeBase.isRunning()) {
@@ -3396,7 +3374,7 @@ public final class BatteryStatsImpl extends BatteryStats {
if (!mPhoneOn) {
final long elapsedRealtime = SystemClock.elapsedRealtime();
final long uptime = SystemClock.uptimeMillis();
- mHistoryCur.states |= HistoryItem.STATE_PHONE_IN_CALL_FLAG;
+ mHistoryCur.states2 |= HistoryItem.STATE2_PHONE_IN_CALL_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Phone on to: "
+ Integer.toHexString(mHistoryCur.states));
addHistoryRecordLocked(elapsedRealtime, uptime);
@@ -3409,7 +3387,7 @@ public final class BatteryStatsImpl extends BatteryStats {
if (mPhoneOn) {
final long elapsedRealtime = SystemClock.elapsedRealtime();
final long uptime = SystemClock.uptimeMillis();
- mHistoryCur.states &= ~HistoryItem.STATE_PHONE_IN_CALL_FLAG;
+ mHistoryCur.states2 &= ~HistoryItem.STATE2_PHONE_IN_CALL_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Phone off to: "
+ Integer.toHexString(mHistoryCur.states));
addHistoryRecordLocked(elapsedRealtime, uptime);
@@ -3626,7 +3604,7 @@ public final class BatteryStatsImpl extends BatteryStats {
addHistoryRecordLocked(elapsedRealtime, uptime);
mWifiOn = true;
mWifiOnTimer.startRunningLocked(elapsedRealtime);
- scheduleSyncExternalStatsLocked();
+ scheduleSyncExternalStatsLocked("wifi-off");
}
}
@@ -3640,7 +3618,7 @@ public final class BatteryStatsImpl extends BatteryStats {
addHistoryRecordLocked(elapsedRealtime, uptime);
mWifiOn = false;
mWifiOnTimer.stopRunningLocked(elapsedRealtime);
- scheduleSyncExternalStatsLocked();
+ scheduleSyncExternalStatsLocked("wifi-on");
}
}
@@ -3788,6 +3766,25 @@ public final class BatteryStatsImpl extends BatteryStats {
}
}
+ public void noteWifiRadioPowerState(int powerState, long timestampNs) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
+ final long uptime = SystemClock.uptimeMillis();
+ if (mWifiRadioPowerState != powerState) {
+ final boolean active =
+ powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_MEDIUM
+ || powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH;
+ if (active) {
+ mHistoryCur.states |= HistoryItem.STATE_WIFI_RADIO_ACTIVE_FLAG;
+ } else {
+ mHistoryCur.states &= ~HistoryItem.STATE_WIFI_RADIO_ACTIVE_FLAG;
+ }
+ if (DEBUG_HISTORY) Slog.v(TAG, "Wifi network active " + active + " to: "
+ + Integer.toHexString(mHistoryCur.states));
+ addHistoryRecordLocked(elapsedRealtime, uptime);
+ mWifiRadioPowerState = powerState;
+ }
+ }
+
public void noteWifiRunningLocked(WorkSource ws) {
if (!mGlobalWifiRunning) {
final long elapsedRealtime = SystemClock.elapsedRealtime();
@@ -3803,7 +3800,7 @@ public final class BatteryStatsImpl extends BatteryStats {
int uid = mapUid(ws.get(i));
getUidStatsLocked(uid).noteWifiRunningLocked(elapsedRealtime);
}
- scheduleSyncExternalStatsLocked();
+ scheduleSyncExternalStatsLocked("wifi-running");
} else {
Log.w(TAG, "noteWifiRunningLocked -- called while WIFI running");
}
@@ -3842,7 +3839,7 @@ public final class BatteryStatsImpl extends BatteryStats {
int uid = mapUid(ws.get(i));
getUidStatsLocked(uid).noteWifiStoppedLocked(elapsedRealtime);
}
- scheduleSyncExternalStatsLocked();
+ scheduleSyncExternalStatsLocked("wifi-stopped");
} else {
Log.w(TAG, "noteWifiStoppedLocked -- called while WIFI not running");
}
@@ -3857,7 +3854,7 @@ public final class BatteryStatsImpl extends BatteryStats {
}
mWifiState = wifiState;
mWifiStateTimer[wifiState].startRunningLocked(elapsedRealtime);
- scheduleSyncExternalStatsLocked();
+ scheduleSyncExternalStatsLocked("wifi-state");
}
}
@@ -3919,46 +3916,6 @@ public final class BatteryStatsImpl extends BatteryStats {
}
}
- public void noteBluetoothOnLocked() {
- if (!mBluetoothOn) {
- final long elapsedRealtime = SystemClock.elapsedRealtime();
- final long uptime = SystemClock.uptimeMillis();
- mHistoryCur.states |= HistoryItem.STATE_BLUETOOTH_ON_FLAG;
- if (DEBUG_HISTORY) Slog.v(TAG, "Bluetooth on to: "
- + Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(elapsedRealtime, uptime);
- mBluetoothOn = true;
- mBluetoothOnTimer.startRunningLocked(elapsedRealtime);
- scheduleSyncExternalStatsLocked();
- }
- }
-
- public void noteBluetoothOffLocked() {
- if (mBluetoothOn) {
- final long elapsedRealtime = SystemClock.elapsedRealtime();
- final long uptime = SystemClock.uptimeMillis();
- mHistoryCur.states &= ~HistoryItem.STATE_BLUETOOTH_ON_FLAG;
- if (DEBUG_HISTORY) Slog.v(TAG, "Bluetooth off to: "
- + Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(elapsedRealtime, uptime);
- mBluetoothOn = false;
- mBluetoothOnTimer.stopRunningLocked(elapsedRealtime);
- scheduleSyncExternalStatsLocked();
- }
- }
-
- public void noteBluetoothStateLocked(int bluetoothState) {
- if (DEBUG) Log.i(TAG, "Bluetooth state -> " + bluetoothState);
- if (mBluetoothState != bluetoothState) {
- final long elapsedRealtime = SystemClock.elapsedRealtime();
- if (mBluetoothState >= 0) {
- mBluetoothStateTimer[mBluetoothState].stopRunningLocked(elapsedRealtime);
- }
- mBluetoothState = bluetoothState;
- mBluetoothStateTimer[bluetoothState].startRunningLocked(elapsedRealtime);
- }
- }
-
int mWifiFullLockNesting = 0;
public void noteFullWifiLockAcquiredLocked(int uid) {
@@ -4313,20 +4270,6 @@ public final class BatteryStatsImpl extends BatteryStats {
return mWifiSignalStrengthsTimer[strengthBin].getCountLocked(which);
}
- @Override public long getBluetoothOnTime(long elapsedRealtimeUs, int which) {
- return mBluetoothOnTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
- }
-
- @Override public long getBluetoothStateTime(int bluetoothState,
- long elapsedRealtimeUs, int which) {
- return mBluetoothStateTimer[bluetoothState].getTotalTimeLocked(
- elapsedRealtimeUs, which);
- }
-
- @Override public int getBluetoothStateCount(int bluetoothState, int which) {
- return mBluetoothStateTimer[bluetoothState].getCountLocked(which);
- }
-
@Override public boolean hasBluetoothActivityReporting() {
return mHasBluetoothEnergyReporting;
}
@@ -6780,10 +6723,6 @@ public final class BatteryStatsImpl extends BatteryStats {
mWifiSignalStrengthsTimer[i] = new StopwatchTimer(null, -800-i, null,
mOnBatteryTimeBase);
}
- mBluetoothOnTimer = new StopwatchTimer(null, -6, null, mOnBatteryTimeBase);
- for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
- mBluetoothStateTimer[i] = new StopwatchTimer(null, -500-i, null, mOnBatteryTimeBase);
- }
mAudioOnTimer = new StopwatchTimer(null, -7, null, mOnBatteryTimeBase);
mVideoOnTimer = new StopwatchTimer(null, -8, null, mOnBatteryTimeBase);
mFlashlightOnTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase);
@@ -7399,10 +7338,6 @@ public final class BatteryStatsImpl extends BatteryStats {
for (int i=0; i<NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
mWifiSignalStrengthsTimer[i].reset(false);
}
- mBluetoothOnTimer.reset(false);
- for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
- mBluetoothStateTimer[i].reset(false);
- }
for (int i=0; i< NUM_CONTROLLER_ACTIVITY_TYPES; i++) {
mBluetoothActivityCounters[i].reset(false);
mWifiActivityCounters[i].reset(false);
@@ -7727,16 +7662,12 @@ public final class BatteryStatsImpl extends BatteryStats {
mWifiActivityCounters[CONTROLLER_IDLE_TIME].addCountLocked(
info.getControllerIdleTimeMillis());
- final double powerDrainMaMs;
- if (mPowerProfile.getAveragePower(
- PowerProfile.POWER_WIFI_CONTROLLER_OPERATING_VOLTAGE) == 0) {
- powerDrainMaMs = 0.0;
- } else {
- powerDrainMaMs = info.getControllerEnergyUsed()
- / mPowerProfile.getAveragePower(
- PowerProfile.POWER_WIFI_CONTROLLER_OPERATING_VOLTAGE);
+ final double opVoltage = mPowerProfile.getAveragePower(
+ PowerProfile.POWER_WIFI_CONTROLLER_OPERATING_VOLTAGE);
+ if (opVoltage != 0) {
+ mWifiActivityCounters[CONTROLLER_POWER_DRAIN].addCountLocked(
+ (long)(info.getControllerEnergyUsed() / opVoltage));
}
- mWifiActivityCounters[CONTROLLER_POWER_DRAIN].addCountLocked((long) powerDrainMaMs);
}
}
@@ -7824,8 +7755,13 @@ public final class BatteryStatsImpl extends BatteryStats {
info.getControllerTxTimeMillis());
mBluetoothActivityCounters[CONTROLLER_IDLE_TIME].addCountLocked(
info.getControllerIdleTimeMillis());
- mBluetoothActivityCounters[CONTROLLER_POWER_DRAIN].addCountLocked(
- info.getControllerEnergyUsed());
+
+ final double opVoltage = mPowerProfile.getAveragePower(
+ PowerProfile.POWER_BLUETOOTH_CONTROLLER_OPERATING_VOLTAGE);
+ if (opVoltage != 0) {
+ mBluetoothActivityCounters[CONTROLLER_POWER_DRAIN].addCountLocked(
+ (long) (info.getControllerEnergyUsed() / opVoltage));
+ }
}
}
@@ -7871,9 +7807,9 @@ public final class BatteryStatsImpl extends BatteryStats {
if (mCharging != charging) {
mCharging = charging;
if (charging) {
- mHistoryCur.states |= HistoryItem.STATE_CHARGING_FLAG;
+ mHistoryCur.states2 |= HistoryItem.STATE2_CHARGING_FLAG;
} else {
- mHistoryCur.states &= ~HistoryItem.STATE_CHARGING_FLAG;
+ mHistoryCur.states2 &= ~HistoryItem.STATE2_CHARGING_FLAG;
}
mHandler.sendEmptyMessage(MSG_REPORT_CHARGING);
return true;
@@ -8039,9 +7975,9 @@ public final class BatteryStatsImpl extends BatteryStats {
}
}
- private void scheduleSyncExternalStatsLocked() {
+ private void scheduleSyncExternalStatsLocked(String reason) {
if (mExternalSync != null) {
- mExternalSync.scheduleSync();
+ mExternalSync.scheduleSync(reason);
}
}
@@ -8067,7 +8003,7 @@ public final class BatteryStatsImpl extends BatteryStats {
}
}
// Always start out assuming charging, that will be updated later.
- mHistoryCur.states |= HistoryItem.STATE_CHARGING_FLAG;
+ mHistoryCur.states2 |= HistoryItem.STATE2_CHARGING_FLAG;
mHistoryCur.batteryStatus = (byte)status;
mHistoryCur.batteryLevel = (byte)level;
mMaxChargeStepLevel = mMinDischargeStepLevel =
@@ -8109,7 +8045,7 @@ public final class BatteryStatsImpl extends BatteryStats {
// TODO(adamlesinski): Schedule the creation of a HistoryStepDetails record
// which will pull external stats.
- scheduleSyncExternalStatsLocked();
+ scheduleSyncExternalStatsLocked("battery-level");
}
if (mHistoryCur.batteryStatus != status) {
mHistoryCur.batteryStatus = (byte)status;
@@ -8910,6 +8846,7 @@ public final class BatteryStatsImpl extends BatteryStats {
mMobileRadioActiveAdjustedTime.readSummaryFromParcelLocked(in);
mMobileRadioActiveUnknownTime.readSummaryFromParcelLocked(in);
mMobileRadioActiveUnknownCount.readSummaryFromParcelLocked(in);
+ mWifiRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW;
mWifiOn = false;
mWifiOnTimer.readSummaryFromParcelLocked(in);
mGlobalWifiRunning = false;
@@ -8923,16 +8860,9 @@ public final class BatteryStatsImpl extends BatteryStats {
for (int i=0; i<NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
mWifiSignalStrengthsTimer[i].readSummaryFromParcelLocked(in);
}
- mBluetoothOn = false;
- mBluetoothOnTimer.readSummaryFromParcelLocked(in);
- for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
- mBluetoothStateTimer[i].readSummaryFromParcelLocked(in);
- }
-
for (int i = 0; i < NUM_CONTROLLER_ACTIVITY_TYPES; i++) {
mBluetoothActivityCounters[i].readSummaryFromParcelLocked(in);
}
-
for (int i = 0; i < NUM_CONTROLLER_ACTIVITY_TYPES; i++) {
mWifiActivityCounters[i].readSummaryFromParcelLocked(in);
}
@@ -9246,10 +9176,6 @@ public final class BatteryStatsImpl extends BatteryStats {
for (int i=0; i<NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
mWifiSignalStrengthsTimer[i].writeSummaryFromParcelLocked(out, NOWREAL_SYS);
}
- mBluetoothOnTimer.writeSummaryFromParcelLocked(out, NOWREAL_SYS);
- for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
- mBluetoothStateTimer[i].writeSummaryFromParcelLocked(out, NOWREAL_SYS);
- }
for (int i=0; i< NUM_CONTROLLER_ACTIVITY_TYPES; i++) {
mBluetoothActivityCounters[i].writeSummaryFromParcelLocked(out);
}
@@ -9542,6 +9468,7 @@ public final class BatteryStatsImpl extends BatteryStats {
mMobileRadioActiveAdjustedTime = new LongSamplingCounter(mOnBatteryTimeBase, in);
mMobileRadioActiveUnknownTime = new LongSamplingCounter(mOnBatteryTimeBase, in);
mMobileRadioActiveUnknownCount = new LongSamplingCounter(mOnBatteryTimeBase, in);
+ mWifiRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW;
mWifiOn = false;
mWifiOnTimer = new StopwatchTimer(null, -4, null, mOnBatteryTimeBase, in);
mGlobalWifiRunning = false;
@@ -9558,17 +9485,9 @@ public final class BatteryStatsImpl extends BatteryStats {
mWifiSignalStrengthsTimer[i] = new StopwatchTimer(null, -800-i,
null, mOnBatteryTimeBase, in);
}
- mBluetoothOn = false;
- mBluetoothOnTimer = new StopwatchTimer(null, -6, null, mOnBatteryTimeBase, in);
- for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
- mBluetoothStateTimer[i] = new StopwatchTimer(null, -500-i,
- null, mOnBatteryTimeBase, in);
- }
-
for (int i = 0; i < NUM_CONTROLLER_ACTIVITY_TYPES; i++) {
mBluetoothActivityCounters[i] = new LongSamplingCounter(mOnBatteryTimeBase, in);
}
-
for (int i = 0; i < NUM_CONTROLLER_ACTIVITY_TYPES; i++) {
mWifiActivityCounters[i] = new LongSamplingCounter(mOnBatteryTimeBase, in);
}
@@ -9598,9 +9517,6 @@ public final class BatteryStatsImpl extends BatteryStats {
mChargeStepTracker.readFromParcel(in);
mLastWriteTime = in.readLong();
- mBluetoothPingCount = in.readInt();
- mBluetoothPingStart = -1;
-
mKernelWakelockStats.clear();
int NKW = in.readInt();
for (int ikw = 0; ikw < NKW; ikw++) {
@@ -9718,10 +9634,6 @@ public final class BatteryStatsImpl extends BatteryStats {
for (int i=0; i<NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
mWifiSignalStrengthsTimer[i].writeToParcel(out, uSecRealtime);
}
- mBluetoothOnTimer.writeToParcel(out, uSecRealtime);
- for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
- mBluetoothStateTimer[i].writeToParcel(out, uSecRealtime);
- }
for (int i=0; i< NUM_CONTROLLER_ACTIVITY_TYPES; i++) {
mBluetoothActivityCounters[i].writeToParcel(out);
}
@@ -9748,8 +9660,6 @@ public final class BatteryStatsImpl extends BatteryStats {
mChargeStepTracker.writeToParcel(out);
out.writeLong(mLastWriteTime);
- out.writeInt(getBluetoothPingCount());
-
if (inclUids) {
out.writeInt(mKernelWakelockStats.size());
for (Map.Entry<String, SamplingTimer> ent : mKernelWakelockStats.entrySet()) {
@@ -9851,6 +9761,7 @@ public final class BatteryStatsImpl extends BatteryStats {
mMobileRadioActiveTimer.logState(pr, " ");
pr.println("*** Mobile network active adjusted timer:");
mMobileRadioActiveAdjustedTime.logState(pr, " ");
+ pr.println("*** mWifiRadioPowerState=" + mWifiRadioPowerState);
pr.println("*** Wifi timer:");
mWifiOnTimer.logState(pr, " ");
pr.println("*** WifiRunning timer:");
@@ -9867,12 +9778,6 @@ public final class BatteryStatsImpl extends BatteryStats {
pr.println("*** Wifi signal strength #" + i + ":");
mWifiSignalStrengthsTimer[i].logState(pr, " ");
}
- pr.println("*** Bluetooth timer:");
- mBluetoothOnTimer.logState(pr, " ");
- for (int i=0; i< NUM_BLUETOOTH_STATES; i++) {
- pr.println("*** Bluetooth active type #" + i + ":");
- mBluetoothStateTimer[i].logState(pr, " ");
- }
pr.println("*** Flashlight timer:");
mFlashlightOnTimer.logState(pr, " ");
}
diff --git a/core/java/com/android/internal/os/WifiPowerCalculator.java b/core/java/com/android/internal/os/WifiPowerCalculator.java
index 4fb8b55a5ddc..961b0df61596 100644
--- a/core/java/com/android/internal/os/WifiPowerCalculator.java
+++ b/core/java/com/android/internal/os/WifiPowerCalculator.java
@@ -71,7 +71,7 @@ public class WifiPowerCalculator extends PowerCalculator {
app.wifiRunningTimeMs = idleTimeMs + rxTimeMs + txTimeMs;
double powerDrain = stats.getWifiControllerActivity(BatteryStats.CONTROLLER_POWER_DRAIN,
- statsType) / (1000*60*60);
+ statsType) / (double)(1000*60*60);
if (powerDrain == 0) {
// Some controllers do not report power drain, so we can calculate it here.
powerDrain = ((idleTimeMs * mIdleCurrentMa) + (txTimeMs * mTxCurrentMa)
diff --git a/core/java/com/android/internal/os/WifiPowerEstimator.java b/core/java/com/android/internal/os/WifiPowerEstimator.java
index 01723673d194..c4e2ef632d4f 100644
--- a/core/java/com/android/internal/os/WifiPowerEstimator.java
+++ b/core/java/com/android/internal/os/WifiPowerEstimator.java
@@ -63,7 +63,7 @@ public class WifiPowerEstimator extends PowerCalculator {
mTotalAppWifiRunningTimeMs += app.wifiRunningTimeMs;
final double wifiLockPower = (app.wifiRunningTimeMs * mWifiPowerOn) / (1000*60*60);
- final long wifiScanTimeMs = u.getWifiScanTime(rawRealtimeUs, statsType);
+ final long wifiScanTimeMs = u.getWifiScanTime(rawRealtimeUs, statsType) / 1000;
final double wifiScanPower = (wifiScanTimeMs * mWifiPowerScan) / (1000*60*60);
double wifiBatchScanPower = 0;
diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java
index 42d875df11fb..2946456aecce 100644
--- a/core/java/com/android/internal/widget/ActionBarContextView.java
+++ b/core/java/com/android/internal/widget/ActionBarContextView.java
@@ -367,7 +367,8 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi
if (mTitleLayout != null && mCustomView == null) {
if (mTitleOptional) {
- final int titleWidthSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ final int titleWidthSpec = MeasureSpec.makeMeasureSpec(contentWidth,
+ MeasureSpec.UNSPECIFIED);
mTitleLayout.measure(titleWidthSpec, childSpecHeight);
final int titleWidth = mTitleLayout.getMeasuredWidth();
final boolean titleFits = titleWidth <= availableWidth;
diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java
index 0b1e0e5bcf6d..1e9694534355 100644
--- a/core/java/com/android/internal/widget/FloatingToolbar.java
+++ b/core/java/com/android/internal/widget/FloatingToolbar.java
@@ -1070,7 +1070,8 @@ public final class FloatingToolbar {
private static PopupWindow createPopupWindow(View content) {
ViewGroup popupContentHolder = new LinearLayout(content.getContext());
PopupWindow popupWindow = new PopupWindow(popupContentHolder);
- popupWindow.setWindowLayoutType(WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL);
+ popupWindow.setWindowLayoutType(
+ WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL);
popupWindow.setAnimationStyle(0);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
content.setLayoutParams(new ViewGroup.LayoutParams(
diff --git a/core/java/com/android/internal/widget/SlidingTab.java b/core/java/com/android/internal/widget/SlidingTab.java
index 65feab174e9a..0066ed0db859 100644
--- a/core/java/com/android/internal/widget/SlidingTab.java
+++ b/core/java/com/android/internal/widget/SlidingTab.java
@@ -400,11 +400,13 @@ public class SlidingTab extends ViewGroup {
/**
* Ensure all the dependent widgets are measured.
*/
- public void measure() {
- tab.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
- View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
- text.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
- View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
+ public void measure(int widthMeasureSpec, int heightMeasureSpec) {
+ int width = MeasureSpec.getSize(widthMeasureSpec);
+ int height = MeasureSpec.getSize(heightMeasureSpec);
+ tab.measure(View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.UNSPECIFIED),
+ View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.UNSPECIFIED));
+ text.measure(View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.UNSPECIFIED),
+ View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.UNSPECIFIED));
}
/**
@@ -491,8 +493,8 @@ public class SlidingTab extends ViewGroup {
}
}
- mLeftSlider.measure();
- mRightSlider.measure();
+ mLeftSlider.measure(widthMeasureSpec, heightMeasureSpec);
+ mRightSlider.measure(widthMeasureSpec, heightMeasureSpec);
final int leftTabWidth = mLeftSlider.getTabWidth();
final int rightTabWidth = mRightSlider.getTabWidth();
final int leftTabHeight = mLeftSlider.getTabHeight();
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 1f688e107fd1..610c7ed83335 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -957,6 +957,13 @@ static jint android_media_AudioTrack_attachAuxEffect(JNIEnv *env, jobject thiz,
return nativeToJavaStatus( lpTrack->attachAuxEffect(effectId) );
}
+static jboolean android_media_AudioTrack_setOutputDevice(
+ JNIEnv *env, jobject thiz, jint device_id) {
+
+ sp<AudioTrack> lpTrack = getAudioTrack(env, thiz);
+ return lpTrack->setOutputDevice(device_id) == NO_ERROR;
+}
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
static JNINativeMethod gMethods[] = {
@@ -1002,6 +1009,8 @@ static JNINativeMethod gMethods[] = {
"(F)I", (void *)android_media_AudioTrack_setAuxEffectSendLevel},
{"native_attachAuxEffect",
"(I)I", (void *)android_media_AudioTrack_attachAuxEffect},
+ {"native_setOutputDevice", "(I)Z",
+ (void *)android_media_AudioTrack_setOutputDevice},
};
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 13877fb549d0..ec57eba5d4da 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -517,13 +517,6 @@
android:description="@string/permdesc_accessCoarseLocation"
android:protectionLevel="dangerous" />
- <!-- Allows an application to create mock location providers for testing. -->
- <permission android:name="android.permission.ACCESS_MOCK_LOCATION"
- android:permissionGroup="android.permission-group.LOCATION"
- android:label="@string/permlab_accessMockLocation"
- android:description="@string/permdesc_accessMockLocation"
- android:protectionLevel="dangerous" />
-
<!-- ====================================================================== -->
<!-- Permissions for accessing the device telephony -->
<!-- ====================================================================== -->
@@ -734,12 +727,6 @@
<!-- =============================================================== -->
<eat-comment />
-
- <!-- =============================================================== -->
- <!-- Permissions for accessing the user dictionary -->
- <!-- =============================================================== -->
- <eat-comment />
-
<!-- Used for permissions that provide access to the user
calendar to create / view events.-->
<permission-group android:name="android.permission-group.USER_DICTIONARY"
@@ -848,6 +835,12 @@
android:protectionLevel="signature|system" />
<uses-permission android:name="android.permission.LOCATION_HARDWARE"/>
+ <!-- Allows an application to create mock location providers for testing. -->
+ <permission android:name="android.permission.ACCESS_MOCK_LOCATION"
+ android:label="@string/permlab_accessMockLocation"
+ android:description="@string/permdesc_accessMockLocation"
+ android:protectionLevel="normal" />
+
<!-- ======================================= -->
<!-- Permissions for accessing networks -->
<!-- ======================================= -->
@@ -2408,6 +2401,15 @@
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="signature" />
+ <!-- The system process that pulls carrier configuration from carrier apps will
+ have this permission. Carrier apps that provide
+ {@link android.service.carrier.CarrierConfigService} should require this
+ permission for clients binding to their service. -->
+ <permission android:name="android.permission.BIND_CARRIER_CONFIG_SERVICE"
+ android:label="@string/permlab_bindCarrierConfigService"
+ android:description="@string/permdesc_bindCarrierConfigService"
+ android:protectionLevel="signature|system" />
+
<!-- The system process is explicitly the only one allowed to launch the
confirmation UI for full backup/restore -->
<uses-permission android:name="android.permission.CONFIRM_FULL_BACKUP"/>
diff --git a/core/res/res/drawable/btn_colored_material.xml b/core/res/res/drawable/btn_colored_material.xml
new file mode 100644
index 000000000000..81cbe393bf80
--- /dev/null
+++ b/core/res/res/drawable/btn_colored_material.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+ android:insetLeft="@dimen/button_inset_horizontal_material"
+ android:insetTop="@dimen/button_inset_vertical_material"
+ android:insetRight="@dimen/button_inset_horizontal_material"
+ android:insetBottom="@dimen/button_inset_vertical_material">
+ <ripple android:color="?attr/colorControlHighlight">
+ <item>
+ <shape android:shape="rectangle"
+ android:tint="@color/btn_colored_material">
+ <corners android:radius="@dimen/control_corner_material" />
+ <solid android:color="@color/white" />
+ <padding android:left="@dimen/button_padding_horizontal_material"
+ android:top="@dimen/button_padding_vertical_material"
+ android:right="@dimen/button_padding_horizontal_material"
+ android:bottom="@dimen/button_padding_vertical_material" />
+ </shape>
+ </item>
+ </ripple>
+</inset>
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 0ac366d1fcfb..12d7e6009ebf 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -501,9 +501,16 @@
<attr name="excludeFromRecents" format="boolean" />
<!-- Specify that an Activity should be shown over the lock screen and,
- in a multiuser environment, across all users' windows -->
+ in a multiuser environment, across all users' windows.
+ @deprecated use {@link android.R.attr#showForAllUsers} instead. -->
<attr name="showOnLockScreen" format="boolean" />
+ <!-- Specify that an Activity should be shown even if the current/foreground user
+ is different from the user of the Activity. This will also force the
+ <code>android.view.LayoutParams.FLAG_SHOW_WHEN_LOCKED</code> flag
+ to be set for all windows of this activity -->
+ <attr name="showForAllUsers" format="boolean" />
+
<!-- Specify the authorities under which this content provider can be
found. Multiple authorities may be supplied by separating them
with a semicolon. Authority names should use a Java-style naming
@@ -1761,6 +1768,7 @@
<attr name="alwaysRetainTaskState" />
<attr name="stateNotNeeded" />
<attr name="excludeFromRecents" />
+ <!-- @deprecated use {@link android.R.attr#showForAllUsers} instead. -->
<attr name="showOnLockScreen" />
<!-- Specify whether the activity is enabled or not (that is, can be instantiated by the system).
It can also be specified for an application as a whole, in which case a value of "false"
@@ -1789,6 +1797,7 @@
<attr name="resumeWhilePausing" />
<attr name="resizeableActivity" />
<attr name="lockTaskMode" />
+ <attr name="showForAllUsers" />
</declare-styleable>
<!-- The <code>activity-alias</code> tag declares a new
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 282c80b9e50b..208afb7d96c9 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2641,6 +2641,7 @@
<public type="style" name="Theme.Material.DayNight.Panel" />
<public type="style" name="Theme.Material.Light.LightStatusBar" />
<public type="style" name="ThemeOverlay.Material.Dialog" />
+ <public type="style" name="TextAppearance.Material.Widget.Button.Inverse" />
<public type="id" name="pasteAsPlainText" />
<public type="id" name="undo" />
@@ -2668,4 +2669,6 @@
<public type="attr" name="leftIndents" />
<public type="attr" name="rightIndents" />
+
+ <public type="attr" name="showForAllUsers" />
</resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 3d1fd7ce720d..59366cc934dc 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1323,6 +1323,108 @@
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_use_sip">Allows the app to make and receive SIP calls.</string>
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_register_sim_subscription">register new telecom SIM connections</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_register_sim_subscription">Allows the app to register new telecom SIM connections.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_register_call_provider">register new telecom connections</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_register_call_provider">Allows the app to register new telecom connections.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_connection_manager">manage telecom connections</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_connection_manager">Allows the app to manage telecom connections.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_bind_incall_service">interact with in-call screen</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_bind_incall_service">Allows the app to control when and how the user sees the in-call screen.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_bind_connection_service">interact with telephony services</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_bind_connection_service">Allows the app to interact with telephony services to make/receive calls.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_control_incall_experience">provide an in-call user experience</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_control_incall_experience">Allows the app to provide an in-call user experience.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_readNetworkUsageHistory">read historical network usage</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_readNetworkUsageHistory">Allows the app to read historical network usage for specific networks and apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_manageNetworkPolicy">manage network policy</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_manageNetworkPolicy">Allows the app to manage network policies and define app-specific rules.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_modifyNetworkAccounting">modify network usage accounting</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_modifyNetworkAccounting">Allows the app to modify how network usage is accounted against apps. Not for use by normal apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_accessNotifications">access notifications</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_accessNotifications">Allows the app to retrieve, examine, and clear notifications, including those posted by other apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_bindNotificationListenerService">bind to a notification listener service</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_bindNotificationListenerService">Allows the holder to bind to the top-level interface of a notification listener service. Should never be needed for normal apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_bindConditionProviderService">bind to a condition provider service</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_bindConditionProviderService">Allows the holder to bind to the top-level interface of a condition provider service. Should never be needed for normal apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_bindDreamService">bind to a dream service</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_bindDreamService">Allows the holder to bind to the top-level interface of a dream service. Should never be needed for normal apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_invokeCarrierSetup">invoke the carrier-provided configuration app</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_invokeCarrierSetup">Allows the holder to invoke the carrier-provided configuration app. Should never be needed for normal apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_accessNetworkConditions">listen for observations on network conditions</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_accessNetworkConditions">Allows an application to listen for observations on network conditions. Should never be needed for normal apps.</string>
+
+ <string name="permlab_setInputCalibration">change input device calibration</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_setInputCalibration">Allows the app to modify the calibration parameters of the touch screen. Should never be needed for normal apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_accessDrmCertificates">access DRM certificates</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_accessDrmCertificates">Allows an application to provision and use DRM certficates. Should never be needed for normal apps.</string>
+
+ <string name="permlab_handoverStatus">Receive Android Beam transfer status</string>
+ <string name="permdesc_handoverStatus">Allows this application to receive information about current Android Beam transfers</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_removeDrmCertificates">remove DRM certificates</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_removeDrmCertificates">Allows an application to remove DRM certficates. Should never be needed for normal apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_bindCarrierMessagingService">bind to a carrier messaging service</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_bindCarrierMessagingService">Allows the holder to bind to the top-level interface of a carrier messaging service. Should never be needed for normal apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_bindCarrierConfigService">bind to a carrier config service</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_bindCarrierConfigService">Allows the holder to bind to a carrier config service. Should never be needed for normal apps.</string>
+
<!-- Policy administration -->
<!-- Title of policy access to limiting the user's password choices -->
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index 88cac7271190..b874f6379e16 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -289,6 +289,10 @@ please see styles_device_defaults.xml.
<style name="TextAppearance.Material.Widget"/>
<style name="TextAppearance.Material.Widget.Button" parent="TextAppearance.Material.Button" />
+ <style name="TextAppearance.Material.Widget.Button.Inverse">
+ <item name="textColor">?attr/textColorPrimaryInverse</item>
+ </style>
+
<style name="TextAppearance.Material.Widget.EditText">
<item name="textColor">?attr/textColorPrimaryInverse</item>
<item name="textColorHint">?attr/textColorHintInverse</item>
@@ -461,7 +465,8 @@ please see styles_device_defaults.xml.
<!-- Colored bordered ink button -->
<style name="Widget.Material.Button.Colored">
- <item name="backgroundTint">@color/btn_colored_material</item>
+ <item name="background">@drawable/btn_colored_material</item>
+ <item name="textAppearance">@style/TextAppearance.Material.Widget.Button.Inverse</item>
</style>
<!-- Small bordered ink button -->
diff --git a/docs/html/guide/topics/manifest/application-element.jd b/docs/html/guide/topics/manifest/application-element.jd
index b5af9c38e992..d6ad656f2a51 100644
--- a/docs/html/guide/topics/manifest/application-element.jd
+++ b/docs/html/guide/topics/manifest/application-element.jd
@@ -32,6 +32,7 @@ page.title=&lt;application&gt;
android:<a href="#testOnly">testOnly</a>=["true" | "false"]
android:<a href="#theme">theme</a>="<i>resource or theme</i>"
android:<a href="#uioptions">uiOptions</a>=["none" | "splitActionBarWhenNarrow"]
+ android:<a href="#usesCleartextTraffic">usesCleartextTraffic</a>=["true" | "false"]
android:<a href="#vmSafeMode">vmSafeMode</a>=["true" | "false"] &gt;
. . .
&lt;/application&gt;</pre></dd>
@@ -446,6 +447,32 @@ href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer guide.<
<p>This attribute was added in API level 14.</p>
</dd>
+<dt><a name="usesCleartextTraffic"></a>{@code android:usesCleartextTraffic}</dt>
+<dd>Indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP.
+The default value is {@code "true"}.
+
+<p>When the attribute is set to {@code "false"}, platform components (for example, HTTP and FTP
+stacks, {@link android.webkit.WebView}, {@link android.app.DownloadManager},
+{@link android.media.MediaPlayer}) will refuse the app's requests to use cleartext traffic.
+Third-party libraries are strongly encouraged to honor this setting as well. The key reason for
+avoiding cleartext traffic is the lack of confidentiality, authenticity, and protections against
+tampering: a network attacker can eavesdrop on transmitted data and also modify it without being
+detected.
+
+<p>This flag is honored on a best effort basis because it's impossible to prevent all cleartext
+traffic from Android applications given the level of access provided to them. For example, there's
+no expectation that the {@link java.net.Socket} API will honor this flag because it cannot
+determine whether its traffic is in cleartext. However, most network traffic from applications is
+handled by higher-level network stacks/components which can honor this flag by either reading it
+from {@link android.content.pm.ApplicationInfo#flags ApplicationInfo.flags} or
+{@link android.security.NetworkSecurityPolicy#isCleartextTrafficPermitted() NetworkSecurityPolicy.isCleartextTrafficPermitted()}.
+
+<p>During app development, StrictMode can be used to identify any cleartext traffic from the app: see
+{@link android.os.StrictMode.VmPolicy.Builder#detectCleartextNetwork() StrictMode.VmPolicy.Builder.detectCleartextNetwork()}.
+
+<p>This attribute was added in API level 23.</p>
+</dd>
+
<dt><a name="vmSafeMode"></a>{@code android:vmSafeMode}</dt>
<dd>Indicates whether the app would like the virtual machine (VM) to operate
in safe mode. The default value is {@code "false"}.
diff --git a/keystore/java/android/security/AndroidKeyStore.java b/keystore/java/android/security/AndroidKeyStore.java
index 1c068be7fc8f..c259c25b0e5c 100644
--- a/keystore/java/android/security/AndroidKeyStore.java
+++ b/keystore/java/android/security/AndroidKeyStore.java
@@ -535,6 +535,12 @@ public class AndroidKeyStore extends KeyStoreSpi {
args.addInt(KeymasterDefs.KM_TAG_USER_AUTH_TYPE,
KeyStoreKeyProperties.UserAuthenticator.allToKeymaster(
params.getUserAuthenticators()));
+ long secureUserId = GateKeeper.getSecureUserId();
+ if (secureUserId == 0) {
+ throw new IllegalStateException("Secure lock screen must be enabled"
+ + " to import keys requiring user authentication");
+ }
+ args.addLong(KeymasterDefs.KM_TAG_USER_SECURE_ID, secureUserId);
}
if (params.isInvalidatedOnNewFingerprintEnrolled()) {
// TODO: Add the invalidate on fingerprint enrolled constraint once Keymaster supports
diff --git a/keystore/java/android/security/GateKeeper.java b/keystore/java/android/security/GateKeeper.java
new file mode 100644
index 000000000000..c9f06e9bbc81
--- /dev/null
+++ b/keystore/java/android/security/GateKeeper.java
@@ -0,0 +1,30 @@
+package android.security;
+
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.os.UserHandle;
+import android.service.gatekeeper.IGateKeeperService;
+
+/**
+ * Convenience class for accessing the gatekeeper service.
+ *
+ * @hide
+ */
+public abstract class GateKeeper {
+
+ private GateKeeper() {}
+
+ public static IGateKeeperService getService() {
+ return IGateKeeperService.Stub.asInterface(
+ ServiceManager.getService("android.service.gatekeeper.IGateKeeperService"));
+ }
+
+ public static long getSecureUserId() throws IllegalStateException {
+ try {
+ return GateKeeper.getService().getSecureUserId(UserHandle.myUserId());
+ } catch (RemoteException e) {
+ throw new IllegalStateException(
+ "Failed to obtain secure user ID from gatekeeper", e);
+ }
+ }
+}
diff --git a/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java b/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java
index 72c485ad56d9..d1abe12d6353 100644
--- a/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java
+++ b/keystore/java/android/security/KeyStoreKeyGeneratorSpi.java
@@ -167,6 +167,12 @@ public abstract class KeyStoreKeyGeneratorSpi extends KeyGeneratorSpi {
args.addInt(KeymasterDefs.KM_TAG_USER_AUTH_TYPE,
KeyStoreKeyProperties.UserAuthenticator.allToKeymaster(
spec.getUserAuthenticators()));
+ long secureUserId = GateKeeper.getSecureUserId();
+ if (secureUserId == 0) {
+ throw new IllegalStateException("Secure lock screen must be enabled"
+ + " to generate keys requiring user authentication");
+ }
+ args.addLong(KeymasterDefs.KM_TAG_USER_SECURE_ID, secureUserId);
}
if (spec.isInvalidatedOnNewFingerprintEnrolled()) {
// TODO: Add the invalidate on fingerprint enrolled constraint once Keymaster supports
diff --git a/keystore/java/android/security/KeyStoreKeyProperties.java b/keystore/java/android/security/KeyStoreKeyProperties.java
index b1f330f355ef..206103f44908 100644
--- a/keystore/java/android/security/KeyStoreKeyProperties.java
+++ b/keystore/java/android/security/KeyStoreKeyProperties.java
@@ -217,7 +217,7 @@ public abstract class KeyStoreKeyProperties {
}
@Retention(RetentionPolicy.SOURCE)
- @IntDef({Origin.GENERATED, Origin.IMPORTED})
+ @IntDef({Origin.GENERATED, Origin.IMPORTED, Origin.UNKNOWN})
public @interface OriginEnum {}
/**
@@ -233,14 +233,22 @@ public abstract class KeyStoreKeyProperties {
public static final int IMPORTED = 1 << 1;
/**
+ * Origin of the key is unknown. This can occur only for keys backed by an old TEE
+ * implementation which does not record origin information.
+ */
+ public static final int UNKNOWN = 1 << 2;
+
+ /**
* @hide
*/
public static @OriginEnum int fromKeymaster(int origin) {
switch (origin) {
- case KeymasterDefs.KM_ORIGIN_HARDWARE:
+ case KeymasterDefs.KM_ORIGIN_GENERATED:
return GENERATED;
case KeymasterDefs.KM_ORIGIN_IMPORTED:
return IMPORTED;
+ case KeymasterDefs.KM_ORIGIN_UNKNOWN:
+ return UNKNOWN;
default:
throw new IllegalArgumentException("Unknown origin: " + origin);
}
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index aa722d025d6c..d06534ef9d9c 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1009,12 +1009,13 @@ void OpenGLRenderer::composeLayerRegion(Layer* layer, const Rect& rect) {
TextureVertex::set(mesh++, r->left, r->bottom, u1, v2);
TextureVertex::set(mesh++, r->right, r->bottom, u2, v2);
}
+ Rect modelRect = Rect(rect.getWidth(), rect.getHeight());
Glop glop;
GlopBuilder(mRenderState, mCaches, &glop)
.setMeshTexturedIndexedQuads(&quadVertices[0], count * 6)
.setFillLayer(layer->getTexture(), layer->getColorFilter(), getLayerAlpha(layer), layer->getMode(), Blend::ModeOrderSwap::NoSwap)
.setTransform(currentSnapshot()->getOrthoMatrix(), *currentTransform(), false)
- .setModelViewOffsetRectSnap(0, 0, rect)
+ .setModelViewOffsetRectSnap(rect.left, rect.top, modelRect)
.setRoundRectClipState(currentSnapshot()->roundRectClipState)
.build();
DRAW_DOUBLE_STENCIL_IF(!layer->hasDrawnSinceUpdate, renderGlop(glop));
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index fac69eacb280..6c41a2abbb7b 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -1851,6 +1851,39 @@ public class AudioTrack
return err == 0 ? SUCCESS : ERROR;
}
+ //--------------------------------------------------------------------------
+ // Explicit Routing
+ //--------------------
+ private AudioDeviceInfo mPreferredDevice = null;
+
+ /**
+ * Specifies an audio device (via and {@link AudioDeviceInfo} object) to route
+ * the output from this AudioTrack.
+ * @param deviceSpec The {@link AudioDeviceInfo} specifying the physical audio device.
+ * If deviceSpec is null, default routing is restored.
+ * @return true if succesful, false if the specified {@link AudioDeviceInfo} is non-null and
+ * does not correspond to a valid audio output device.
+ */
+ public boolean setPreferredOutputDevice(AudioDeviceInfo deviceSpec) {
+ // Do some validation....
+ if (deviceSpec != null && !deviceSpec.isSink()) {
+ return false;
+ }
+
+ mPreferredDevice = deviceSpec;
+ int routingDeviceId = mPreferredDevice != null ? deviceSpec.getId() : 0;
+
+ return native_setOutputDevice(routingDeviceId);
+ }
+
+ /**
+ * Returns the selected output specified by {@link #setPreferredOutputDevice}. Note that this
+ * is not guarenteed to correspond to the actual device being used for playback.
+ */
+ public AudioDeviceInfo getPreferredOutputDevice() {
+ return mPreferredDevice;
+ }
+
//---------------------------------------------------------
// Interface definitions
//--------------------
@@ -2027,6 +2060,8 @@ public class AudioTrack
private native final int native_attachAuxEffect(int effectId);
private native final int native_setAuxEffectSendLevel(float level);
+ private native final boolean native_setOutputDevice(int deviceId);
+
//---------------------------------------------------------
// Utility methods
//------------------
diff --git a/media/java/android/media/MediaSync.java b/media/java/android/media/MediaSync.java
index 7350bd4a8242..9446c0ccb7e6 100644
--- a/media/java/android/media/MediaSync.java
+++ b/media/java/android/media/MediaSync.java
@@ -43,9 +43,9 @@ import java.util.List;
* // MediaCodec videoDecoder = ...;
* videoDecoder.configure(format, inputSurface, ...);
* ...
- * sync.configureAudioTrack(audioTrack, nativeSampleRateInHz);
+ * sync.configureAudioTrack(audioTrack);
* sync.setCallback(new MediaSync.Callback() {
- * \@Override
+ * {@literal @Override}
* public void onReturnAudioBuffer(MediaSync sync, ByteBuffer audioBuffer, int bufferIndex) {
* ...
* }
@@ -151,8 +151,6 @@ final public class MediaSync {
private Handler mCallbackHandler = null;
private MediaSync.Callback mCallback = null;
- private int mNativeSampleRateInHz = 0;
-
private Thread mAudioThread = null;
// Created on mAudioThread when mAudioThread is started. When used on user thread, they should
// be guarded by checking mAudioThread.
@@ -247,20 +245,17 @@ final public class MediaSync {
* Configures the audio track for MediaSync.
*
* @param audioTrack Specify an AudioTrack through which to render the audio data.
- * @throws IllegalArgumentException if the audioTrack has been released, or is invalid,
- * or nativeSampleRateInHz is invalid.
+ * @throws IllegalArgumentException if the audioTrack has been released, or is invalid.
* @throws IllegalStateException if not in the Initialized state, or another audio track
* has already been configured.
*/
- public void configureAudioTrack(AudioTrack audioTrack, int nativeSampleRateInHz) {
- if (audioTrack != null && nativeSampleRateInHz <= 0) {
- final String msg = "Native sample rate " + nativeSampleRateInHz + " is invalid";
- throw new IllegalArgumentException(msg);
- }
+ public void configureAudioTrack(AudioTrack audioTrack) {
+ // AudioTrack has sanity check for configured sample rate.
+ int nativeSampleRateInHz = (audioTrack == null ? 0 : audioTrack.getSampleRate());
+
native_configureAudioTrack(audioTrack, nativeSampleRateInHz);
mAudioTrack = audioTrack;
- mNativeSampleRateInHz = nativeSampleRateInHz;
- if (mAudioThread == null) {
+ if (audioTrack != null && mAudioThread == null) {
createAudioThread();
}
}
@@ -349,8 +344,9 @@ final public class MediaSync {
int status = AudioTrack.SUCCESS;
if (mAudioTrack != null) {
- int playbackSampleRate = (int)(rate * mNativeSampleRateInHz + 0.5);
- rate = playbackSampleRate / (float)mNativeSampleRateInHz;
+ int nativeSampleRateInHz = mAudioTrack.getSampleRate();
+ int playbackSampleRate = (int)(rate * nativeSampleRateInHz + 0.5);
+ rate = playbackSampleRate / (float)nativeSampleRateInHz;
try {
if (rate == 0.0) {
diff --git a/packages/DocumentsUI/res/layout/dialog_create_dir.xml b/packages/DocumentsUI/res/layout/dialog_create_dir.xml
index 54e26b40dfdf..5ed476fc3287 100644
--- a/packages/DocumentsUI/res/layout/dialog_create_dir.xml
+++ b/packages/DocumentsUI/res/layout/dialog_create_dir.xml
@@ -22,6 +22,7 @@
<EditText
android:id="@android:id/text1"
android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content"
+ android:inputType="text" />
</FrameLayout>
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
index a88497cdf103..be71b034f3f9 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
@@ -23,6 +23,7 @@ import android.content.res.Resources;
import android.graphics.Canvas;
import android.media.AudioManager;
import android.os.SystemClock;
+import android.service.trust.TrustAgentService;
import android.telephony.TelephonyManager;
import android.util.AttributeSet;
import android.util.Log;
@@ -69,14 +70,27 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
}
@Override
- public void onTrustInitiatedByUser(int userId) {
+ public void onTrustGrantedWithFlags(int flags, int userId) {
if (userId != mLockPatternUtils.getCurrentUser()) return;
if (!isAttachedToWindow()) return;
-
- if (isVisibleToUser()) {
- dismiss(false /* authenticated */);
- } else {
- mViewMediatorCallback.playTrustedSound();
+ boolean bouncerVisible = isVisibleToUser();
+ boolean initiatedByUser =
+ (flags & TrustAgentService.FLAG_GRANT_TRUST_INITIATED_BY_USER) != 0;
+ boolean dismissKeyguard =
+ (flags & TrustAgentService.FLAG_GRANT_TRUST_DISMISS_KEYGUARD) != 0;
+
+ if (initiatedByUser || dismissKeyguard) {
+ if (mViewMediatorCallback.isScreenOn() && (bouncerVisible || dismissKeyguard)) {
+ if (!bouncerVisible) {
+ // The trust agent dismissed the keyguard without the user proving
+ // that they are present (by swiping up to show the bouncer). That's fine if
+ // the user proved presence via some other way to the trust agent.
+ Log.i(TAG, "TrustAgent dismissed Keyguard.");
+ }
+ dismiss(false /* authenticated */);
+ } else {
+ mViewMediatorCallback.playTrustedSound();
+ }
}
}
};
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 50c9f2d9aa38..1eec53250a07 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -58,12 +58,12 @@ import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
import android.hardware.fingerprint.FingerprintUtils;
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
+import android.service.trust.TrustAgentService;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.TelephonyManager;
import android.util.Log;
-import android.util.Slog;
import android.util.SparseBooleanArray;
import com.google.android.collect.Lists;
@@ -245,15 +245,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private SparseBooleanArray mUserFaceUnlockRunning = new SparseBooleanArray();
@Override
- public void onTrustChanged(boolean enabled, int userId, boolean initiatedByUser) {
+ public void onTrustChanged(boolean enabled, int userId, int flags) {
mUserHasTrust.put(userId, enabled);
-
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onTrustChanged(userId);
- if (enabled && initiatedByUser) {
- cb.onTrustInitiatedByUser(userId);
+ if (enabled && flags != 0) {
+ cb.onTrustGrantedWithFlags(flags, userId);
}
}
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 756a7a4ee656..26e69731a319 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -171,9 +171,9 @@ public class KeyguardUpdateMonitorCallback {
public void onTrustManagedChanged(int userId) { }
/**
- * Called when the user has proved to a trust agent that they want to use the device.
+ * Called after trust was granted with non-zero flags.
*/
- public void onTrustInitiatedByUser(int userId) { }
+ public void onTrustGrantedWithFlags(int flags, int userId) { }
/**
* Called when a fingerprint is recognized.
diff --git a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
index 5bbcc8ce4335..f5c809a61db1 100644
--- a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
@@ -76,4 +76,9 @@ public interface ViewMediatorCallback {
* (legacy API)
*/
boolean isInputRestricted();
+
+ /**
+ * @return true if the screen is on
+ */
+ boolean isScreenOn();
}
diff --git a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java
index e6a0dd7af20e..b8f16e7929dc 100644
--- a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java
+++ b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java
@@ -38,7 +38,7 @@ public class SampleTrustAgent extends TrustAgentService
* <pre>
* $ adb shell am broadcast -a action.sample_trust_agent.grant_trust\
* -e extra.message SampleTrust\
- * --el extra.duration 1000 --ez extra.init_by_user false
+ * --el extra.duration 1000 --ez extra.init_by_user false --ez extra.dismiss_keyguard false
* </pre>
*/
private static final boolean ALLOW_EXTERNAL_BROADCASTS = false;
@@ -51,6 +51,7 @@ public class SampleTrustAgent extends TrustAgentService
private static final String EXTRA_MESSAGE = "extra.message";
private static final String EXTRA_DURATION = "extra.duration";
private static final String EXTRA_INITIATED_BY_USER = "extra.init_by_user";
+ private static final String EXTRA_DISMISS_KEYGUARD = "extra.dismiss_keyguard";
private static final String PREFERENCE_REPORT_UNLOCK_ATTEMPTS
= "preference.report_unlock_attempts";
@@ -141,10 +142,17 @@ public class SampleTrustAgent extends TrustAgentService
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (ACTION_GRANT_TRUST.equals(action)) {
+ int flags = 0;
+ if (intent.getBooleanExtra(EXTRA_INITIATED_BY_USER, false)) {
+ flags |= TrustAgentService.FLAG_GRANT_TRUST_INITIATED_BY_USER;
+ }
+ if (intent.getBooleanExtra(EXTRA_DISMISS_KEYGUARD, false)) {
+ flags |= TrustAgentService.FLAG_GRANT_TRUST_DISMISS_KEYGUARD;
+ }
+
try {
grantTrust(intent.getStringExtra(EXTRA_MESSAGE),
- intent.getLongExtra(EXTRA_DURATION, 0),
- intent.getBooleanExtra(EXTRA_INITIATED_BY_USER, false));
+ intent.getLongExtra(EXTRA_DURATION, 0), flags);
} catch (IllegalStateException e) {
logAndShowToast("IllegalStateException: " + e.getMessage());
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 97a4c551379c..f16fb5cd2f34 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -505,6 +505,11 @@ public class KeyguardViewMediator extends SystemUI {
public boolean isInputRestricted() {
return KeyguardViewMediator.this.isInputRestricted();
}
+
+ @Override
+ public boolean isScreenOn() {
+ return mScreenOn;
+ }
};
public void userActivity() {
diff --git a/rs/java/android/renderscript/ScriptIntrinsicBLAS.java b/rs/java/android/renderscript/ScriptIntrinsicBLAS.java
index 16b703356b47..6cfdfee5ecae 100644
--- a/rs/java/android/renderscript/ScriptIntrinsicBLAS.java
+++ b/rs/java/android/renderscript/ScriptIntrinsicBLAS.java
@@ -24,7 +24,6 @@ import java.lang.annotation.RetentionPolicy;
*
* BLAS
*
- * @hide
**/
public final class ScriptIntrinsicBLAS extends ScriptIntrinsic {
private Allocation mLUT;
@@ -1492,7 +1491,6 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic {
*
* 8-bit GEMM-like operation for neural networks
*
- * @hide
**/
public void BNNM(Allocation A, int a_offset, Allocation B, int b_offset, Allocation C, int c_offset, int c_mult) {
validateL3(Element.U8(mRS), NO_TRANSPOSE, TRANSPOSE, 0, A, B, C);
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index ee73b1a6ea84..16689eed5f12 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -388,7 +388,9 @@ public class LockSettingsService extends ILockSettings.Stub {
byte[] currentHandle = getCurrentHandle(userId);
if (pattern == null) {
+ getGateKeeperService().clearSecureUserId(userId);
mStorage.writePatternHash(null, userId);
+ maybeUpdateKeystore(null, userId);
return;
}
@@ -414,7 +416,9 @@ public class LockSettingsService extends ILockSettings.Stub {
byte[] currentHandle = getCurrentHandle(userId);
if (password == null) {
+ getGateKeeperService().clearSecureUserId(userId);
mStorage.writePasswordHash(null, userId);
+ maybeUpdateKeystore(null, userId);
return;
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index f25808baf6a0..b65893274c13 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -7851,6 +7851,27 @@ public final class ActivityManagerService extends ActivityManagerNative
rti.lastActiveTime = tr.lastActiveTime;
rti.affiliatedTaskId = tr.mAffiliatedTaskId;
rti.affiliatedTaskColor = tr.mAffiliatedTaskColor;
+ rti.numActivities = 0;
+
+ ActivityRecord base = null;
+ ActivityRecord top = null;
+ ActivityRecord tmp;
+
+ for (int i = tr.mActivities.size() - 1; i >= 0; --i) {
+ tmp = tr.mActivities.get(i);
+ if (tmp.finishing) {
+ continue;
+ }
+ base = tmp;
+ if (top == null || (top.state == ActivityState.INITIALIZING)) {
+ top = base;
+ }
+ rti.numActivities++;
+ }
+
+ rti.baseActivity = (base != null) ? base.intent.getComponent() : null;
+ rti.topActivity = (top != null) ? top.intent.getComponent() : null;
+
return rti;
}
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 6210d600c736..5b1543e8ad30 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -16,7 +16,7 @@
package com.android.server.am;
-import static android.content.pm.ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN;
+import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
import static com.android.server.am.ActivityManagerDebugConfig.*;
@@ -375,7 +375,7 @@ final class ActivityStack {
}
boolean okToShowLocked(ActivityRecord r) {
- return isCurrentProfileLocked(r.userId) || (r.info.flags & FLAG_SHOW_ON_LOCK_SCREEN) != 0;
+ return isCurrentProfileLocked(r.userId) || (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0;
}
final ActivityRecord topRunningActivityLocked(ActivityRecord notTop) {
@@ -624,7 +624,7 @@ final class ActivityStack {
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
ActivityRecord r = activities.get(activityNdx);
- if (notCurrentUserTask && (r.info.flags & FLAG_SHOW_ON_LOCK_SCREEN) == 0) {
+ if (notCurrentUserTask && (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0) {
return null;
}
if (!r.finishing && r.intent.getComponent().equals(cls) && r.userId == userId) {
@@ -2024,7 +2024,7 @@ final class ActivityStack {
// Now put task at top.
int taskNdx = mTaskHistory.size();
final boolean notShownWhenLocked =
- (newActivity != null && (newActivity.info.flags & FLAG_SHOW_ON_LOCK_SCREEN) == 0)
+ (newActivity != null && (newActivity.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0)
|| (newActivity == null && task.topRunningActivityLocked(null) == null);
if (!isCurrentProfileLocked(task.userId) && notShownWhenLocked) {
// Put non-current user tasks below current user tasks.
@@ -2074,7 +2074,7 @@ final class ActivityStack {
r.putInHistory();
mWindowManager.addAppToken(task.mActivities.indexOf(r), r.appToken,
r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
- (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0,
+ (r.info.flags & ActivityInfo.FLAG_SHOW_FOR_ALL_USERS) != 0,
r.userId, r.info.configChanges, task.voiceSession != null,
r.mLaunchTaskBehind);
if (VALIDATE_TOKENS) {
@@ -2138,7 +2138,7 @@ final class ActivityStack {
}
mWindowManager.addAppToken(task.mActivities.indexOf(r),
r.appToken, r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
- (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0, r.userId,
+ (r.info.flags & ActivityInfo.FLAG_SHOW_FOR_ALL_USERS) != 0, r.userId,
r.info.configChanges, task.voiceSession != null, r.mLaunchTaskBehind);
boolean doShow = true;
if (newTask) {
@@ -2190,7 +2190,7 @@ final class ActivityStack {
// because there is nothing for it to animate on top of.
mWindowManager.addAppToken(task.mActivities.indexOf(r), r.appToken,
r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
- (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0, r.userId,
+ (r.info.flags & ActivityInfo.FLAG_SHOW_FOR_ALL_USERS) != 0, r.userId,
r.info.configChanges, task.voiceSession != null, r.mLaunchTaskBehind);
ActivityOptions.abort(options);
options = null;
@@ -4061,6 +4061,7 @@ final class ActivityStack {
}
ActivityRecord r = null;
ActivityRecord top = null;
+ ActivityRecord tmp;
int numActivities = 0;
int numRunning = 0;
final ArrayList<ActivityRecord> activities = task.mActivities;
@@ -4068,7 +4069,11 @@ final class ActivityStack {
continue;
}
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
- r = activities.get(activityNdx);
+ tmp = activities.get(activityNdx);
+ if (tmp.finishing) {
+ continue;
+ }
+ r = tmp;
// Initialize state for next task if needed.
if (top == null || (top.state == ActivityState.INITIALIZING)) {
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 690848349d5d..58bdc280a3de 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2826,7 +2826,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
final ActivityRecord r = activities.get(activityNdx);
mWindowManager.addAppToken(0, r.appToken, task.taskId, stack.mStackId,
r.info.screenOrientation, r.fullscreen,
- (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0,
+ (r.info.flags & ActivityInfo.FLAG_SHOW_FOR_ALL_USERS) != 0,
r.userId, r.info.configChanges, task.voiceSession != null,
r.mLaunchTaskBehind);
}
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index bfc4fc7c89e0..905adc0b02d9 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -18,8 +18,6 @@ package com.android.server.am;
import android.bluetooth.BluetoothActivityEnergyInfo;
import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothHeadset;
-import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
@@ -40,7 +38,6 @@ import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.WorkSource;
-import android.telephony.DataConnectionRealTimeInfo;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.util.Slog;
@@ -71,8 +68,6 @@ public final class BatteryStatsService extends IBatteryStats.Stub
final BatteryStatsImpl mStats;
final BatteryStatsHandler mHandler;
Context mContext;
- private boolean mBluetoothPendingStats;
- private BluetoothHeadset mBluetoothHeadset;
PowerManagerInternal mPowerManagerInternal;
class BatteryStatsHandler extends Handler implements BatteryStatsImpl.ExternalStatsSync {
@@ -87,11 +82,11 @@ public final class BatteryStatsService extends IBatteryStats.Stub
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_SYNC_EXTERNAL_STATS:
- updateExternalStats();
+ updateExternalStats((String)msg.obj);
break;
case MSG_WRITE_TO_DISK:
- updateExternalStats();
+ updateExternalStats("write");
synchronized (mStats) {
mStats.writeAsyncLocked();
}
@@ -100,9 +95,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub
}
@Override
- public void scheduleSync() {
+ public void scheduleSync(String reason) {
if (!hasMessages(MSG_SYNC_EXTERNAL_STATS)) {
- sendEmptyMessage(MSG_SYNC_EXTERNAL_STATS);
+ Message msg = Message.obtain(this, MSG_SYNC_EXTERNAL_STATS, reason);
+ sendMessage(msg);
}
}
}
@@ -140,7 +136,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
public void shutdown() {
Slog.w("BatteryStats", "Writing battery stats before shutdown...");
- updateExternalStats();
+ updateExternalStats("shutdown");
synchronized (mStats) {
mStats.shutdownLocked();
}
@@ -231,7 +227,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
//Slog.i("foo", "SENDING BATTERY INFO:");
//mStats.dumpLocked(new LogPrinter(Log.INFO, "foo", Log.LOG_ID_SYSTEM));
Parcel out = Parcel.obtain();
- updateExternalStats();
+ updateExternalStats("get-stats");
synchronized (mStats) {
mStats.writeToParcel(out, 0);
}
@@ -246,7 +242,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
//Slog.i("foo", "SENDING BATTERY INFO:");
//mStats.dumpLocked(new LogPrinter(Log.INFO, "foo", Log.LOG_ID_SYSTEM));
Parcel out = Parcel.obtain();
- updateExternalStats();
+ updateExternalStats("get-stats");
synchronized (mStats) {
mStats.writeToParcel(out, 0);
}
@@ -569,7 +565,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub
// There was a change in WiFi power state.
// Collect data now for the past activity.
- mHandler.scheduleSync();
+ mHandler.scheduleSync("wifi-data");
+ synchronized (mStats) {
+ mStats.noteWifiRadioPowerState(powerState, tsNanos);
+ }
}
public void noteWifiRunning(WorkSource ws) {
@@ -614,56 +613,6 @@ public final class BatteryStatsService extends IBatteryStats.Stub
}
}
- public void noteBluetoothOn() {
- enforceCallingPermission();
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- if (adapter != null) {
- adapter.getProfileProxy(mContext, mBluetoothProfileServiceListener,
- BluetoothProfile.HEADSET);
- }
- synchronized (mStats) {
- if (mBluetoothHeadset != null) {
- mStats.noteBluetoothOnLocked();
- mStats.setBtHeadset(mBluetoothHeadset);
- } else {
- mBluetoothPendingStats = true;
- }
- }
- }
-
- private BluetoothProfile.ServiceListener mBluetoothProfileServiceListener =
- new BluetoothProfile.ServiceListener() {
- public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mBluetoothHeadset = (BluetoothHeadset) proxy;
- synchronized (mStats) {
- if (mBluetoothPendingStats) {
- mStats.noteBluetoothOnLocked();
- mStats.setBtHeadset(mBluetoothHeadset);
- mBluetoothPendingStats = false;
- }
- }
- }
-
- public void onServiceDisconnected(int profile) {
- mBluetoothHeadset = null;
- }
- };
-
- public void noteBluetoothOff() {
- enforceCallingPermission();
- synchronized (mStats) {
- mBluetoothPendingStats = false;
- mStats.noteBluetoothOffLocked();
- }
- }
-
- public void noteBluetoothState(int bluetoothState) {
- enforceCallingPermission();
- synchronized (mStats) {
- mStats.noteBluetoothStateLocked(bluetoothState);
- }
- }
-
public void noteFullWifiLockAcquired(int uid) {
enforceCallingPermission();
synchronized (mStats) {
@@ -820,7 +769,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
// Sync external stats first as the battery has changed states. If we don't sync
// immediately here, we may not collect the relevant data later.
- updateExternalStats();
+ updateExternalStats("battery-state");
synchronized (mStats) {
mStats.setBatteryStateLocked(status, health, plugType, level, temp, volt);
}
@@ -974,9 +923,9 @@ public final class BatteryStatsService extends IBatteryStats.Stub
pw.println("Battery stats reset.");
noOutput = true;
}
- updateExternalStats();
+ updateExternalStats("dump");
} else if ("--write".equals(arg)) {
- updateExternalStats();
+ updateExternalStats("dump");
synchronized (mStats) {
mStats.writeSyncLocked();
pw.println("Battery stats written.");
@@ -1047,7 +996,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
}
// Fetch data from external sources and update the BatteryStatsImpl object with them.
- updateExternalStats();
+ updateExternalStats("dump");
if (useCheckinFormat) {
List<ApplicationInfo> apps = mContext.getPackageManager().getInstalledApplications(0);
@@ -1178,7 +1127,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
* We first grab a lock specific to this method, then once all the data has been collected,
* we grab the mStats lock and update the data.
*/
- void updateExternalStats() {
+ void updateExternalStats(String reason) {
synchronized (mExternalStatsLock) {
if (mContext == null) {
// We haven't started yet (which means the BatteryStatsImpl object has
@@ -1189,6 +1138,12 @@ public final class BatteryStatsService extends IBatteryStats.Stub
final WifiActivityEnergyInfo wifiEnergyInfo = pullWifiEnergyInfoLocked();
final BluetoothActivityEnergyInfo bluetoothEnergyInfo = pullBluetoothEnergyInfoLocked();
synchronized (mStats) {
+ if (mStats.mRecordAllHistory) {
+ final long elapsedRealtime = SystemClock.elapsedRealtime();
+ final long uptime = SystemClock.uptimeMillis();
+ mStats.addHistoryEventLocked(elapsedRealtime, uptime,
+ BatteryStats.HistoryItem.EVENT_COLLECT_EXTERNAL_STATS, reason, 0);
+ }
mStats.updateKernelWakelocksLocked();
mStats.updateMobileRadioStateLocked(SystemClock.elapsedRealtime());
mStats.updateWifiStateLocked(wifiEnergyInfo);
diff --git a/services/core/java/com/android/server/display/DisplayDevice.java b/services/core/java/com/android/server/display/DisplayDevice.java
index e16be71d1e46..ee36972f7c82 100644
--- a/services/core/java/com/android/server/display/DisplayDevice.java
+++ b/services/core/java/com/android/server/display/DisplayDevice.java
@@ -47,6 +47,10 @@ abstract class DisplayDevice {
// within a transaction from performTraversalInTransactionLocked.
private Surface mCurrentSurface;
+ // DEBUG STATE: Last device info which was written to the log, or null if none.
+ // Do not use for any other purpose.
+ DisplayDeviceInfo mDebugLastLoggedDeviceInfo;
+
public DisplayDevice(DisplayAdapter displayAdapter, IBinder displayToken, String uniqueId) {
mDisplayAdapter = displayAdapter;
mDisplayToken = displayToken;
diff --git a/services/core/java/com/android/server/display/DisplayDeviceInfo.java b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
index d1e73f075e80..ebf6e4e348ce 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceInfo.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
@@ -104,6 +104,16 @@ final class DisplayDeviceInfo {
public static final int TOUCH_EXTERNAL = 2;
/**
+ * Diff result: The {@link #state} fields differ.
+ */
+ public static final int DIFF_STATE = 1 << 0;
+
+ /**
+ * Diff result: Other fields differ.
+ */
+ public static final int DIFF_OTHER = 1 << 1;
+
+ /**
* Gets the name of the display device, which may be derived from EDID or
* other sources. The name may be localized and displayed to the user.
*/
@@ -238,26 +248,39 @@ final class DisplayDeviceInfo {
}
public boolean equals(DisplayDeviceInfo other) {
- return other != null
- && Objects.equal(name, other.name)
- && Objects.equal(uniqueId, other.uniqueId)
- && width == other.width
- && height == other.height
- && refreshRate == other.refreshRate
- && Arrays.equals(supportedRefreshRates, other.supportedRefreshRates)
- && densityDpi == other.densityDpi
- && xDpi == other.xDpi
- && yDpi == other.yDpi
- && appVsyncOffsetNanos == other.appVsyncOffsetNanos
- && presentationDeadlineNanos == other.presentationDeadlineNanos
- && flags == other.flags
- && touch == other.touch
- && rotation == other.rotation
- && type == other.type
- && Objects.equal(address, other.address)
- && state == other.state
- && ownerUid == other.ownerUid
- && Objects.equal(ownerPackageName, other.ownerPackageName);
+ return other != null && diff(other) == 0;
+ }
+
+ /**
+ * Computes the difference between display device infos.
+ * Assumes other is not null.
+ */
+ public int diff(DisplayDeviceInfo other) {
+ int diff = 0;
+ if (state != other.state) {
+ diff |= DIFF_STATE;
+ }
+ if (!Objects.equal(name, other.name)
+ || !Objects.equal(uniqueId, other.uniqueId)
+ || width != other.width
+ || height != other.height
+ || refreshRate != other.refreshRate
+ || !Arrays.equals(supportedRefreshRates, other.supportedRefreshRates)
+ || densityDpi != other.densityDpi
+ || xDpi != other.xDpi
+ || yDpi != other.yDpi
+ || appVsyncOffsetNanos != other.appVsyncOffsetNanos
+ || presentationDeadlineNanos != other.presentationDeadlineNanos
+ || flags != other.flags
+ || touch != other.touch
+ || rotation != other.rotation
+ || type != other.type
+ || !Objects.equal(address, other.address)
+ || ownerUid != other.ownerUid
+ || !Objects.equal(ownerPackageName, other.ownerPackageName)) {
+ diff |= DIFF_OTHER;
+ }
+ return diff;
}
@Override
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 9ea0444818aa..1e87433360af 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -668,13 +668,14 @@ public final class DisplayManagerService extends SystemService {
}
private void handleDisplayDeviceAddedLocked(DisplayDevice device) {
+ DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
if (mDisplayDevices.contains(device)) {
- Slog.w(TAG, "Attempted to add already added display device: "
- + device.getDisplayDeviceInfoLocked());
+ Slog.w(TAG, "Attempted to add already added display device: " + info);
return;
}
- Slog.i(TAG, "Display device added: " + device.getDisplayDeviceInfoLocked());
+ Slog.i(TAG, "Display device added: " + info);
+ device.mDebugLastLoggedDeviceInfo = info;
mDisplayDevices.add(device);
addLogicalDisplayLocked(device);
@@ -687,13 +688,20 @@ public final class DisplayManagerService extends SystemService {
private void handleDisplayDeviceChanged(DisplayDevice device) {
synchronized (mSyncRoot) {
+ DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
if (!mDisplayDevices.contains(device)) {
- Slog.w(TAG, "Attempted to change non-existent display device: "
- + device.getDisplayDeviceInfoLocked());
+ Slog.w(TAG, "Attempted to change non-existent display device: " + info);
return;
}
- Slog.i(TAG, "Display device changed: " + device.getDisplayDeviceInfoLocked());
+ int diff = device.mDebugLastLoggedDeviceInfo.diff(info);
+ if (diff == DisplayDeviceInfo.DIFF_STATE) {
+ Slog.i(TAG, "Display device changed state: \"" + info.name
+ + "\", " + Display.stateToString(info.state));
+ } else if (diff != 0) {
+ Slog.i(TAG, "Display device changed: " + info);
+ }
+ device.mDebugLastLoggedDeviceInfo = info;
device.applyPendingDisplayDeviceInfoChangesLocked();
if (updateLogicalDisplaysLocked()) {
@@ -708,13 +716,14 @@ public final class DisplayManagerService extends SystemService {
}
}
private void handleDisplayDeviceRemovedLocked(DisplayDevice device) {
+ DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
if (!mDisplayDevices.remove(device)) {
- Slog.w(TAG, "Attempted to remove non-existent display device: "
- + device.getDisplayDeviceInfoLocked());
+ Slog.w(TAG, "Attempted to remove non-existent display device: " + info);
return;
}
- Slog.i(TAG, "Display device removed: " + device.getDisplayDeviceInfoLocked());
+ Slog.i(TAG, "Display device removed: " + info);
+ device.mDebugLastLoggedDeviceInfo = info;
updateLogicalDisplaysLocked();
scheduleTraversalLocked(false);
diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java
index 3bb7818c339a..65dc72f4280a 100644
--- a/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -302,7 +302,10 @@ final class LogicalDisplay {
// multiplying the fractions by the product of their denominators before
// comparing them.
int displayRectWidth, displayRectHeight;
- if (physWidth * displayInfo.logicalHeight
+ if ((displayInfo.flags & Display.FLAG_SCALING_DISABLED) != 0) {
+ displayRectWidth = displayInfo.logicalWidth;
+ displayRectHeight = displayInfo.logicalHeight;
+ } else if (physWidth * displayInfo.logicalHeight
< physHeight * displayInfo.logicalWidth) {
// Letter box.
displayRectWidth = physWidth;
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 4ac2b48e377a..94f8dee08a5c 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -913,6 +913,12 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
}
}
+ @ServiceThreadOnly
+ boolean isConnected(int portId) {
+ assertRunOnServiceThread();
+ return mService.isConnected(portId);
+ }
+
private void notifyArcStatusToAudioService(boolean enabled) {
// Note that we don't set any name to ARC.
mService.getAudioManager().setWiredDeviceConnectionState(
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 49a96d81a6cc..2cbc1b9cdd77 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -780,6 +780,12 @@ public final class HdmiControlService extends SystemService {
return false;
}
+ @ServiceThreadOnly
+ boolean isConnected(int portId) {
+ assertRunOnServiceThread();
+ return mCecController.isConnected(portId);
+ }
+
void runOnServiceThread(Runnable runnable) {
mHandler.post(runnable);
}
diff --git a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
index a944a277696b..5f2d65172180 100644
--- a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
+++ b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
@@ -156,10 +156,13 @@ final class HotplugDetectionAction extends HdmiCecFeatureAction {
int index = -1;
while ((index = removed.nextSetBit(index + 1)) != -1) {
if (index == Constants.ADDR_AUDIO_SYSTEM) {
- ++mAvrStatusCount;
- Slog.w(TAG, "Ack not returned from AVR. count: " + mAvrStatusCount);
- if (mAvrStatusCount < AVR_COUNT_MAX) {
- continue;
+ HdmiDeviceInfo avr = tv().getAvrDeviceInfo();
+ if (avr != null && tv().isConnected(avr.getPortId())) {
+ ++mAvrStatusCount;
+ Slog.w(TAG, "Ack not returned from AVR. count: " + mAvrStatusCount);
+ if (mAvrStatusCount < AVR_COUNT_MAX) {
+ continue;
+ }
}
}
Slog.v(TAG, "Remove device by hot-plug detection:" + index);
diff --git a/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java b/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java
index d200d359bffb..9b4950b5b1ba 100644
--- a/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java
+++ b/services/core/java/com/android/server/hdmi/SetArcTransmissionStateAction.java
@@ -54,7 +54,7 @@ final class SetArcTransmissionStateAction extends HdmiCecFeatureAction {
boolean start() {
// Seq #37.
if (mEnabled) {
- // Enable ARC status immediately after sending <Report Arc Initiated>.
+ // Enable ARC status immediately before sending <Report Arc Initiated>.
// If AVR responds with <Feature Abort>, disable ARC status again.
// This is different from spec that says that turns ARC status to
// "Enabled" if <Report ARC Initiated> is acknowledged and no
@@ -80,12 +80,21 @@ final class SetArcTransmissionStateAction extends HdmiCecFeatureAction {
sendCommand(command, new HdmiControlService.SendMessageCallback() {
@Override
public void onSendCompleted(int error) {
- if (error != Constants.SEND_RESULT_SUCCESS) {
- // If fails to send <Report ARC Initiated>, disable ARC and
- // send <Report ARC Terminated> directly.
- setArcStatus(false);
- HdmiLogger.debug("Failed to send <Report Arc Initiated>.");
- finish();
+ switch (error) {
+ case Constants.SEND_RESULT_SUCCESS:
+ case Constants.SEND_RESULT_BUSY:
+ case Constants.SEND_RESULT_FAILURE:
+ // The result of the command transmission, unless it is an obvious
+ // failure indicated by the target device (or lack thereof), should
+ // not affect the ARC status. Ignores it silently.
+ break;
+ case Constants.SEND_RESULT_NAK:
+ // If <Report ARC Initiated> is negatively ack'ed, disable ARC and
+ // send <Report ARC Terminated> directly.
+ setArcStatus(false);
+ HdmiLogger.debug("Failed to send <Report Arc Initiated>.");
+ finish();
+ break;
}
}
});
diff --git a/services/core/java/com/android/server/job/controllers/AppIdleController.java b/services/core/java/com/android/server/job/controllers/AppIdleController.java
index 23d5c05e2ef0..98fb11b6aef2 100644
--- a/services/core/java/com/android/server/job/controllers/AppIdleController.java
+++ b/services/core/java/com/android/server/job/controllers/AppIdleController.java
@@ -107,7 +107,16 @@ public class AppIdleController extends StateController
@Override
public void dumpControllerState(PrintWriter pw) {
- // TODO:
+ pw.println("AppIdle");
+ pw.println("Plugged In: " + mPluggedIn);
+ synchronized (mTrackedTasks) {
+ for (JobStatus task : mTrackedTasks) {
+ pw.print(task.job.getService().getPackageName());
+ pw.print(":idle=" + !task.appNotIdleConstraintSatisfied.get());
+ pw.print(", ");
+ }
+ pw.println();
+ }
}
@Override
diff --git a/services/core/java/com/android/server/location/GpsLocationProvider.java b/services/core/java/com/android/server/location/GpsLocationProvider.java
index 7c41abbc3340..a279e0f4282f 100644
--- a/services/core/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/core/java/com/android/server/location/GpsLocationProvider.java
@@ -197,6 +197,8 @@ public class GpsLocationProvider implements LocationProviderInterface {
private static final int REMOVE_LISTENER = 9;
private static final int INJECT_NTP_TIME_FINISHED = 10;
private static final int DOWNLOAD_XTRA_DATA_FINISHED = 11;
+ private static final int SUBSCRIPTION_OR_SIM_CHANGED = 12;
+ private static final int INITIALIZE_HANDLER = 13;
// Request setid
private static final int AGPS_RIL_REQUEST_SETID_IMSI = 1;
@@ -338,8 +340,12 @@ public class GpsLocationProvider implements LocationProviderInterface {
// True if gps should be disabled (used to support battery saver mode in settings).
private boolean mDisableGps = false;
- // properties loaded from PROPERTIES_FILE
+ /**
+ * Properties loaded from PROPERTIES_FILE.
+ * It must be accessed only inside {@link #mHandler}.
+ */
private Properties mProperties;
+
private String mSuplServerHost;
private int mSuplServerPort = TCP_MIN_PORT;
private String mC2KServerHost;
@@ -462,7 +468,7 @@ public class GpsLocationProvider implements LocationProviderInterface {
new OnSubscriptionsChangedListener() {
@Override
public void onSubscriptionsChanged() {
- subscriptionOrSimChanged(mContext);
+ sendMessage(SUBSCRIPTION_OR_SIM_CHANGED, 0, null);
}
};
@@ -627,53 +633,22 @@ public class GpsLocationProvider implements LocationProviderInterface {
mBatteryStats = IBatteryStats.Stub.asInterface(ServiceManager.getService(
BatteryStats.SERVICE_NAME));
- // Load GPS configuration.
+ // Construct internal handler
+ mHandler = new ProviderHandler(looper);
+
+ // Load GPS configuration and register listeners in the background:
+ // some operations, such as opening files and registering broadcast receivers, can take a
+ // relative long time, so the ctor() is kept to create objects needed by this instance,
+ // while IO initialization and registration is delegated to our internal handler
+ // this approach is just fine because events are posted to our handler anyway
mProperties = new Properties();
- reloadGpsProperties(mContext, mProperties);
+ sendMessage(INITIALIZE_HANDLER, 0, null);
// Create a GPS net-initiated handler.
mNIHandler = new GpsNetInitiatedHandler(context,
mNetInitiatedListener,
mSuplEsEnabled);
- // TODO: When this object "finishes" we should unregister by invoking
- // SubscriptionManager.getInstance(mContext).unregister(mOnSubscriptionsChangedListener);
- // This is not strictly necessary because it will be unregistered if the
- // notification fails but it is good form.
-
- // Register for SubscriptionInfo list changes which is guaranteed
- // to invoke onSubscriptionsChanged the first time.
- SubscriptionManager.from(mContext)
- .addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
-
- // construct handler, listen for events
- mHandler = new ProviderHandler(looper);
- listenForBroadcasts();
-
- // also listen for PASSIVE_PROVIDER updates
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- LocationManager locManager =
- (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
- final long minTime = 0;
- final float minDistance = 0;
- final boolean oneShot = false;
- LocationRequest request = LocationRequest.createFromDeprecatedProvider(
- LocationManager.PASSIVE_PROVIDER,
- minTime,
- minDistance,
- oneShot);
- // Don't keep track of this request since it's done on behalf of other clients
- // (which are kept track of separately).
- request.setHideFromAppOps(true);
- locManager.requestLocationUpdates(
- request,
- new NetworkLocationListener(),
- mHandler.getLooper());
- }
- });
-
mListenerHelper = new GpsStatusListenerHelper(mHandler) {
@Override
protected boolean isAvailableInPlatform() {
@@ -731,33 +706,6 @@ public class GpsLocationProvider implements LocationProviderInterface {
};
}
- private void listenForBroadcasts() {
- IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION);
- intentFilter.addDataScheme("sms");
- intentFilter.addDataAuthority("localhost","7275");
- mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, mHandler);
-
- intentFilter = new IntentFilter();
- intentFilter.addAction(Intents.WAP_PUSH_RECEIVED_ACTION);
- try {
- intentFilter.addDataType("application/vnd.omaloc-supl-init");
- } catch (IntentFilter.MalformedMimeTypeException e) {
- Log.w(TAG, "Malformed SUPL init mime type");
- }
- mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, mHandler);
-
- intentFilter = new IntentFilter();
- intentFilter.addAction(ALARM_WAKEUP);
- intentFilter.addAction(ALARM_TIMEOUT);
- intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE);
- intentFilter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
- intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
- intentFilter.addAction(Intent.ACTION_SCREEN_ON);
- intentFilter.addAction(SIM_STATE_CHANGED);
- mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, mHandler);
- }
-
/**
* Returns the name of this provider.
*/
@@ -2012,13 +1960,85 @@ public class GpsLocationProvider implements LocationProviderInterface {
case UPDATE_LOCATION:
handleUpdateLocation((Location)msg.obj);
break;
+ case SUBSCRIPTION_OR_SIM_CHANGED:
+ subscriptionOrSimChanged(mContext);
+ break;
+ case INITIALIZE_HANDLER:
+ initialize();
+ break;
}
if (msg.arg2 == 1) {
// wakelock was taken for this message, release it
mWakeLock.release();
}
}
- };
+
+ /**
+ * This method is bound to {@link #GpsLocationProvider(Context, ILocationManager, Looper)}.
+ * It is in charge of loading properties and registering for events that will be posted to
+ * this handler.
+ */
+ private void initialize() {
+ // load default GPS configuration
+ // (this configuration might change in the future based on SIM changes)
+ reloadGpsProperties(mContext, mProperties);
+
+ // TODO: When this object "finishes" we should unregister by invoking
+ // SubscriptionManager.getInstance(mContext).unregister(mOnSubscriptionsChangedListener);
+ // This is not strictly necessary because it will be unregistered if the
+ // notification fails but it is good form.
+
+ // Register for SubscriptionInfo list changes which is guaranteed
+ // to invoke onSubscriptionsChanged the first time.
+ SubscriptionManager.from(mContext)
+ .addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
+
+ // listen for events
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION);
+ intentFilter.addDataScheme("sms");
+ intentFilter.addDataAuthority("localhost","7275");
+ mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this);
+
+ intentFilter = new IntentFilter();
+ intentFilter.addAction(Intents.WAP_PUSH_RECEIVED_ACTION);
+ try {
+ intentFilter.addDataType("application/vnd.omaloc-supl-init");
+ } catch (IntentFilter.MalformedMimeTypeException e) {
+ Log.w(TAG, "Malformed SUPL init mime type");
+ }
+ mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this);
+
+ intentFilter = new IntentFilter();
+ intentFilter.addAction(ALARM_WAKEUP);
+ intentFilter.addAction(ALARM_TIMEOUT);
+ intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE);
+ intentFilter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
+ intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
+ intentFilter.addAction(Intent.ACTION_SCREEN_ON);
+ intentFilter.addAction(SIM_STATE_CHANGED);
+ mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this);
+
+ // listen for PASSIVE_PROVIDER updates
+ LocationManager locManager =
+ (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
+ long minTime = 0;
+ float minDistance = 0;
+ boolean oneShot = false;
+ LocationRequest request = LocationRequest.createFromDeprecatedProvider(
+ LocationManager.PASSIVE_PROVIDER,
+ minTime,
+ minDistance,
+ oneShot);
+ // Don't keep track of this request since it's done on behalf of other clients
+ // (which are kept track of separately).
+ request.setHideFromAppOps(true);
+ locManager.requestLocationUpdates(
+ request,
+ new NetworkLocationListener(),
+ getLooper());
+ }
+ }
private final class NetworkLocationListener implements LocationListener {
@Override
diff --git a/services/core/java/com/android/server/trust/TrustAgentWrapper.java b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
index dec195d8172c..fb7d1864381b 100644
--- a/services/core/java/com/android/server/trust/TrustAgentWrapper.java
+++ b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
@@ -116,7 +116,7 @@ public class TrustAgentWrapper {
}
mTrusted = true;
mMessage = (CharSequence) msg.obj;
- boolean initiatedByUser = msg.arg1 != 0;
+ int flags = msg.arg1;
long durationMs = msg.getData().getLong(DATA_DURATION);
if (durationMs > 0) {
final long duration;
@@ -141,8 +141,8 @@ public class TrustAgentWrapper {
}
mTrustManagerService.mArchive.logGrantTrust(mUserId, mName,
(mMessage != null ? mMessage.toString() : null),
- durationMs, initiatedByUser);
- mTrustManagerService.updateTrust(mUserId, initiatedByUser);
+ durationMs, flags);
+ mTrustManagerService.updateTrust(mUserId, flags);
break;
case MSG_TRUST_TIMEOUT:
if (DEBUG) Slog.v(TAG, "Trust timed out : " + mName.flattenToShortString());
@@ -156,7 +156,7 @@ public class TrustAgentWrapper {
if (msg.what == MSG_REVOKE_TRUST) {
mTrustManagerService.mArchive.logRevokeTrust(mUserId, mName);
}
- mTrustManagerService.updateTrust(mUserId, false);
+ mTrustManagerService.updateTrust(mUserId, 0);
break;
case MSG_RESTART_TIMEOUT:
destroy();
@@ -171,7 +171,7 @@ public class TrustAgentWrapper {
if (DEBUG) Log.v(TAG, "Re-enabling agent because it acknowledged "
+ "enabled features: " + mName);
mTrustDisabledByDpm = false;
- mTrustManagerService.updateTrust(mUserId, false);
+ mTrustManagerService.updateTrust(mUserId, 0);
}
} else {
if (DEBUG) Log.w(TAG, "Ignoring MSG_SET_TRUST_AGENT_FEATURES_COMPLETED "
@@ -185,7 +185,7 @@ public class TrustAgentWrapper {
mMessage = null;
}
mTrustManagerService.mArchive.logManagingTrust(mUserId, mName, mManagingTrust);
- mTrustManagerService.updateTrust(mUserId, false);
+ mTrustManagerService.updateTrust(mUserId, 0);
break;
}
}
@@ -194,12 +194,12 @@ public class TrustAgentWrapper {
private ITrustAgentServiceCallback mCallback = new ITrustAgentServiceCallback.Stub() {
@Override
- public void grantTrust(CharSequence userMessage, long durationMs, boolean initiatedByUser) {
+ public void grantTrust(CharSequence userMessage, long durationMs, int flags) {
if (DEBUG) Slog.v(TAG, "enableTrust(" + userMessage + ", durationMs = " + durationMs
- + ", initiatedByUser = " + initiatedByUser + ")");
+ + ", flags = " + flags + ")");
Message msg = mHandler.obtainMessage(
- MSG_GRANT_TRUST, initiatedByUser ? 1 : 0, 0, userMessage);
+ MSG_GRANT_TRUST, flags, 0, userMessage);
msg.getData().putLong(DATA_DURATION, durationMs);
msg.sendToTarget();
}
@@ -381,7 +381,7 @@ public class TrustAgentWrapper {
}
if (mTrustDisabledByDpm != trustDisabled) {
mTrustDisabledByDpm = trustDisabled;
- mTrustManagerService.updateTrust(mUserId, false);
+ mTrustManagerService.updateTrust(mUserId, 0);
}
return trustDisabled;
}
diff --git a/services/core/java/com/android/server/trust/TrustArchive.java b/services/core/java/com/android/server/trust/TrustArchive.java
index 725371666acf..fd63d486d049 100644
--- a/services/core/java/com/android/server/trust/TrustArchive.java
+++ b/services/core/java/com/android/server/trust/TrustArchive.java
@@ -19,6 +19,7 @@ package com.android.server.trust;
import android.content.ComponentName;
import android.os.SystemClock;
import android.os.UserHandle;
+import android.service.trust.TrustAgentService;
import android.util.TimeUtils;
import java.io.PrintWriter;
@@ -48,20 +49,20 @@ public class TrustArchive {
// grantTrust
final String message;
final long duration;
- final boolean userInitiated;
+ final int flags;
// managingTrust
final boolean managingTrust;
private Event(int type, int userId, ComponentName agent, String message,
- long duration, boolean userInitiated, boolean managingTrust) {
+ long duration, int flags, boolean managingTrust) {
this.type = type;
this.userId = userId;
this.agent = agent;
this.elapsedTimestamp = SystemClock.elapsedRealtime();
this.message = message;
this.duration = duration;
- this.userInitiated = userInitiated;
+ this.flags = flags;
this.managingTrust = managingTrust;
}
}
@@ -69,33 +70,33 @@ public class TrustArchive {
ArrayDeque<Event> mEvents = new ArrayDeque<Event>();
public void logGrantTrust(int userId, ComponentName agent, String message,
- long duration, boolean userInitiated) {
+ long duration, int flags) {
addEvent(new Event(TYPE_GRANT_TRUST, userId, agent, message, duration,
- userInitiated, false));
+ flags, false));
}
public void logRevokeTrust(int userId, ComponentName agent) {
- addEvent(new Event(TYPE_REVOKE_TRUST, userId, agent, null, 0, false, false));
+ addEvent(new Event(TYPE_REVOKE_TRUST, userId, agent, null, 0, 0, false));
}
public void logTrustTimeout(int userId, ComponentName agent) {
- addEvent(new Event(TYPE_TRUST_TIMEOUT, userId, agent, null, 0, false, false));
+ addEvent(new Event(TYPE_TRUST_TIMEOUT, userId, agent, null, 0, 0, false));
}
public void logAgentDied(int userId, ComponentName agent) {
- addEvent(new Event(TYPE_AGENT_DIED, userId, agent, null, 0, false, false));
+ addEvent(new Event(TYPE_AGENT_DIED, userId, agent, null, 0, 0, false));
}
public void logAgentConnected(int userId, ComponentName agent) {
- addEvent(new Event(TYPE_AGENT_CONNECTED, userId, agent, null, 0, false, false));
+ addEvent(new Event(TYPE_AGENT_CONNECTED, userId, agent, null, 0, 0, false));
}
public void logAgentStopped(int userId, ComponentName agent) {
- addEvent(new Event(TYPE_AGENT_STOPPED, userId, agent, null, 0, false, false));
+ addEvent(new Event(TYPE_AGENT_STOPPED, userId, agent, null, 0, 0, false));
}
public void logManagingTrust(int userId, ComponentName agent, boolean managing) {
- addEvent(new Event(TYPE_MANAGING_TRUST, userId, agent, null, 0, false, managing));
+ addEvent(new Event(TYPE_MANAGING_TRUST, userId, agent, null, 0, 0, managing));
}
private void addEvent(Event e) {
@@ -129,8 +130,8 @@ public class TrustArchive {
}
switch (ev.type) {
case TYPE_GRANT_TRUST:
- writer.printf(", message=\"%s\", duration=%s, initiatedByUser=%d",
- ev.message, formatDuration(ev.duration), ev.userInitiated ? 1 : 0);
+ writer.printf(", message=\"%s\", duration=%s, flags=%s",
+ ev.message, formatDuration(ev.duration), dumpGrantFlags(ev.flags));
break;
case TYPE_MANAGING_TRUST:
writer.printf(", managingTrust=" + ev.managingTrust);
@@ -184,4 +185,20 @@ public class TrustArchive {
return "Unknown(" + type + ")";
}
}
+
+ private String dumpGrantFlags(int flags) {
+ StringBuilder sb = new StringBuilder();
+ if ((flags & TrustAgentService.FLAG_GRANT_TRUST_INITIATED_BY_USER) != 0) {
+ if (sb.length() != 0) sb.append('|');
+ sb.append("INITIATED_BY_USER");
+ }
+ if ((flags & TrustAgentService.FLAG_GRANT_TRUST_DISMISS_KEYGUARD) != 0) {
+ if (sb.length() != 0) sb.append('|');
+ sb.append("DISMISS_KEYGUARD");
+ }
+ if (sb.length() == 0) {
+ sb.append('0');
+ }
+ return sb.toString();
+ }
}
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index b38d33d14b8b..7d2fb433a0da 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -179,11 +179,11 @@ public class TrustManagerService extends SystemService {
private void updateTrustAll() {
List<UserInfo> userInfos = mUserManager.getUsers(true /* excludeDying */);
for (UserInfo userInfo : userInfos) {
- updateTrust(userInfo.id, false);
+ updateTrust(userInfo.id, 0);
}
}
- public void updateTrust(int userId, boolean initiatedByUser) {
+ public void updateTrust(int userId, int flags) {
dispatchOnTrustManagedChanged(aggregateIsTrustManaged(userId), userId);
boolean trusted = aggregateIsTrusted(userId);
boolean changed;
@@ -191,7 +191,7 @@ public class TrustManagerService extends SystemService {
changed = mUserIsTrusted.get(userId) != trusted;
mUserIsTrusted.put(userId, trusted);
}
- dispatchOnTrustChanged(trusted, userId, initiatedByUser);
+ dispatchOnTrustChanged(trusted, userId, flags);
if (changed) {
refreshDeviceLockedForUser(userId);
}
@@ -281,7 +281,7 @@ public class TrustManagerService extends SystemService {
if (userId == UserHandle.USER_ALL) {
updateTrustAll();
} else {
- updateTrust(userId, false /* initiatedByUser */);
+ updateTrust(userId, 0);
}
}
}
@@ -394,7 +394,7 @@ public class TrustManagerService extends SystemService {
}
}
if (trustMayHaveChanged) {
- updateTrust(userId, false);
+ updateTrust(userId, 0);
}
refreshAgentList(userId);
}
@@ -587,11 +587,11 @@ public class TrustManagerService extends SystemService {
}
}
- private void dispatchOnTrustChanged(boolean enabled, int userId, boolean initiatedByUser) {
- if (!enabled) initiatedByUser = false;
+ private void dispatchOnTrustChanged(boolean enabled, int userId, int flags) {
+ if (!enabled) flags = 0;
for (int i = 0; i < mTrustListeners.size(); i++) {
try {
- mTrustListeners.get(i).onTrustChanged(enabled, userId, initiatedByUser);
+ mTrustListeners.get(i).onTrustChanged(enabled, userId, flags);
} catch (DeadObjectException e) {
Slog.d(TAG, "Removing dead TrustListener.");
mTrustListeners.remove(i);
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index a04f6cbf7fac..e914cd4e7e36 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -56,7 +56,7 @@ class AppWindowToken extends WindowToken {
boolean appFullscreen;
int requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
boolean layoutConfigChanges;
- boolean showWhenLocked;
+ boolean showForAllUsers;
// The input dispatching timeout for this application token in nanoseconds.
long inputDispatchingTimeoutNanos;
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index f073c23878a6..f914369df6ef 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -66,6 +66,7 @@ class DisplayContent {
int mBaseDisplayWidth = 0;
int mBaseDisplayHeight = 0;
int mBaseDisplayDensity = 0;
+ boolean mDisplayScalingDisabled;
private final DisplayInfo mDisplayInfo = new DisplayInfo();
private final Display mDisplay;
@@ -360,6 +361,9 @@ class DisplayContent {
pw.print(mBaseDisplayWidth); pw.print("x"); pw.print(mBaseDisplayHeight);
pw.print(" "); pw.print(mBaseDisplayDensity); pw.print("dpi");
}
+ if (mDisplayScalingDisabled) {
+ pw.println(" noscale");
+ }
pw.print(" cur=");
pw.print(mDisplayInfo.logicalWidth);
pw.print("x"); pw.print(mDisplayInfo.logicalHeight);
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 34120a054d9b..0c3cf65705f2 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -107,9 +107,9 @@ class Task {
}
}
- boolean showWhenLocked() {
+ boolean showForAllUsers() {
final int tokensCount = mAppTokens.size();
- return (tokensCount != 0) && mAppTokens.get(tokensCount - 1).showWhenLocked;
+ return (tokensCount != 0) && mAppTokens.get(tokensCount - 1).showForAllUsers;
}
@Override
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index e845f833eab2..7cdf8b21c955 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -276,27 +276,26 @@ public class TaskStack {
}
void addTask(Task task, boolean toTop) {
- addTask(task, toTop, task.showWhenLocked());
+ addTask(task, toTop, task.showForAllUsers());
}
/**
* Put a Task in this stack. Used for adding and moving.
* @param task The task to add.
* @param toTop Whether to add it to the top or bottom.
- * @param showWhenLocked Whether to show the task when the device is locked
- * regardless of the current user.
+ * @param showForAllUsers Whether to show the task regardless of the current user.
*/
- void addTask(Task task, boolean toTop, boolean showWhenLocked) {
+ void addTask(Task task, boolean toTop, boolean showForAllUsers) {
int stackNdx;
if (!toTop) {
stackNdx = 0;
} else {
stackNdx = mTasks.size();
- if (!showWhenLocked && !mService.isCurrentProfileLocked(task.mUserId)) {
+ if (!showForAllUsers && !mService.isCurrentProfileLocked(task.mUserId)) {
// Place the task below all current user tasks.
while (--stackNdx >= 0) {
final Task tmpTask = mTasks.get(stackNdx);
- if (!tmpTask.showWhenLocked()
+ if (!tmpTask.showForAllUsers()
|| !mService.isCurrentProfileLocked(tmpTask.mUserId)) {
break;
}
@@ -498,7 +497,7 @@ public class TaskStack {
int top = mTasks.size();
for (int taskNdx = 0; taskNdx < top; ++taskNdx) {
Task task = mTasks.get(taskNdx);
- if (mService.isCurrentProfileLocked(task.mUserId) || task.showWhenLocked()) {
+ if (mService.isCurrentProfileLocked(task.mUserId) || task.showForAllUsers()) {
mTasks.remove(taskNdx);
mTasks.add(task);
--top;
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index e790fb02502e..964dcc2155e5 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -3620,13 +3620,13 @@ public class WindowManagerService extends IWindowManager.Stub
EventLog.writeEvent(EventLogTags.WM_TASK_CREATED, taskId, stackId);
Task task = new Task(taskId, stack, userId, this);
mTaskIdToTask.put(taskId, task);
- stack.addTask(task, !atoken.mLaunchTaskBehind /* toTop */, atoken.showWhenLocked);
+ stack.addTask(task, !atoken.mLaunchTaskBehind /* toTop */, atoken.showForAllUsers);
return task;
}
@Override
public void addAppToken(int addPos, IApplicationToken token, int taskId, int stackId,
- int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
+ int requestedOrientation, boolean fullscreen, boolean showForAllUsers, int userId,
int configChanges, boolean voiceInteraction, boolean launchTaskBehind) {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
"addAppToken()")) {
@@ -3656,7 +3656,7 @@ public class WindowManagerService extends IWindowManager.Stub
atoken = new AppWindowToken(this, token, voiceInteraction);
atoken.inputDispatchingTimeoutNanos = inputDispatchingTimeoutNanos;
atoken.appFullscreen = fullscreen;
- atoken.showWhenLocked = showWhenLocked;
+ atoken.showForAllUsers = showForAllUsers;
atoken.requestedOrientation = requestedOrientation;
atoken.layoutConfigChanges = (configChanges &
(ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_ORIENTATION)) != 0;
@@ -7249,8 +7249,15 @@ public class WindowManagerService extends IWindowManager.Stub
displayInfo.getLogicalMetrics(mRealDisplayMetrics,
CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO, null);
displayInfo.getAppMetrics(mDisplayMetrics);
+ if (displayContent.mDisplayScalingDisabled) {
+ displayInfo.flags |= Display.FLAG_SCALING_DISABLED;
+ } else {
+ displayInfo.flags &= ~Display.FLAG_SCALING_DISABLED;
+ }
+
mDisplayManagerInternal.setDisplayInfoOverrideFromWindowManager(
displayContent.getDisplayId(), displayInfo);
+
displayContent.mBaseDisplayRect.set(0, 0, dw, dh);
}
if (false) {
@@ -7547,7 +7554,7 @@ public class WindowManagerService extends IWindowManager.Stub
synchronized(mWindowMap) {
final DisplayContent displayContent = getDefaultDisplayContentLocked();
- readForcedDisplaySizeAndDensityLocked(displayContent);
+ readForcedDisplayPropertiesLocked(displayContent);
mDisplayReady = true;
}
@@ -8320,7 +8327,47 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- private void readForcedDisplaySizeAndDensityLocked(final DisplayContent displayContent) {
+ @Override
+ public void setForcedDisplayScalingMode(int displayId, int mode) {
+ if (mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.WRITE_SECURE_SETTINGS) !=
+ PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Must hold permission " +
+ android.Manifest.permission.WRITE_SECURE_SETTINGS);
+ }
+ if (displayId != Display.DEFAULT_DISPLAY) {
+ throw new IllegalArgumentException("Can only set the default display");
+ }
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ synchronized(mWindowMap) {
+ final DisplayContent displayContent = getDisplayContentLocked(displayId);
+ if (displayContent != null) {
+ if (mode < 0 || mode > 1) {
+ mode = 0;
+ }
+ setForcedDisplayScalingModeLocked(displayContent, mode);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.DISPLAY_SCALING_FORCE, mode);
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ private void setForcedDisplayScalingModeLocked(DisplayContent displayContent,
+ int mode) {
+ Slog.i(TAG, "Using display scaling mode: " + (mode == 0 ? "auto" : "off"));
+
+ synchronized(displayContent.mDisplaySizeLock) {
+ displayContent.mDisplayScalingDisabled = (mode != 0);
+ }
+ reconfigureDisplayLocked(displayContent);
+ }
+
+ private void readForcedDisplayPropertiesLocked(final DisplayContent displayContent) {
+ // Display size.
String sizeStr = Settings.Global.getString(mContext.getContentResolver(),
Settings.Global.DISPLAY_SIZE_FORCED);
if (sizeStr == null || sizeStr.length() == 0) {
@@ -8345,6 +8392,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
}
+
+ // Display density.
String densityStr = Settings.Global.getString(mContext.getContentResolver(),
Settings.Global.DISPLAY_DENSITY_FORCED);
if (densityStr == null || densityStr.length() == 0) {
@@ -8363,6 +8412,16 @@ public class WindowManagerService extends IWindowManager.Stub
} catch (NumberFormatException ex) {
}
}
+
+ // Display scaling mode.
+ int mode = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.DISPLAY_SCALING_FORCE, 0);
+ if (mode != 0) {
+ synchronized(displayContent.mDisplaySizeLock) {
+ Slog.i(TAG, "FORCED DISPLAY SCALING DISABLED");
+ displayContent.mDisplayScalingDisabled = true;
+ }
+ }
}
// displayContent must not be null
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index db3268d14fe0..4f795a65a9db 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -17,6 +17,7 @@
package com.android.server.wm;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
+import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
@@ -478,6 +479,12 @@ final class WindowState implements WindowManagerPolicy.WindowState {
if (mAppToken != null) {
final DisplayContent appDisplay = getDisplayContent();
mNotOnAppsDisplay = displayContent != appDisplay;
+
+ if (mAppToken.showForAllUsers) {
+ // Windows for apps that can show for all users should also show when the
+ // device is locked.
+ mAttrs.flags |= FLAG_SHOW_WHEN_LOCKED;
+ }
}
mWinAnimator = new WindowStateAnimator(this);
@@ -1353,7 +1360,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
win = win.mAttachedWindow;
}
if (win.mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW
- && win.mAppToken != null && win.mAppToken.showWhenLocked) {
+ && win.mAppToken != null && win.mAppToken.showForAllUsers) {
// Save some cycles by not calling getDisplayInfo unless it is an application
// window intended for all users.
final DisplayContent displayContent = win.getDisplayContent();
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 33a7fe10b0bc..a46585a47349 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -16,6 +16,7 @@
package android.telecom;
+import android.annotation.SystemApi;
import android.net.Uri;
import android.os.Bundle;
@@ -233,7 +234,6 @@ public final class Call {
private final int mVideoState;
private final StatusHints mStatusHints;
private final Bundle mExtras;
- private final int mCallSubstate;
/**
* Whether the supplied capabilities supports the specified capability.
@@ -430,14 +430,6 @@ public final class Call {
return mExtras;
}
- /**
- * @return The substate of the {@code Call}.
- * @hide
- */
- public int getCallSubstate() {
- return mCallSubstate;
- }
-
@Override
public boolean equals(Object o) {
if (o instanceof Details) {
@@ -456,8 +448,7 @@ public final class Call {
Objects.equals(mGatewayInfo, d.mGatewayInfo) &&
Objects.equals(mVideoState, d.mVideoState) &&
Objects.equals(mStatusHints, d.mStatusHints) &&
- Objects.equals(mExtras, d.mExtras) &&
- Objects.equals(mCallSubstate, d.mCallSubstate);
+ Objects.equals(mExtras, d.mExtras);
}
return false;
}
@@ -477,8 +468,7 @@ public final class Call {
Objects.hashCode(mGatewayInfo) +
Objects.hashCode(mVideoState) +
Objects.hashCode(mStatusHints) +
- Objects.hashCode(mExtras) +
- Objects.hashCode(mCallSubstate);
+ Objects.hashCode(mExtras);
}
/** {@hide} */
@@ -495,8 +485,7 @@ public final class Call {
GatewayInfo gatewayInfo,
int videoState,
StatusHints statusHints,
- Bundle extras,
- int callSubstate) {
+ Bundle extras) {
mHandle = handle;
mHandlePresentation = handlePresentation;
mCallerDisplayName = callerDisplayName;
@@ -510,11 +499,10 @@ public final class Call {
mVideoState = videoState;
mStatusHints = statusHints;
mExtras = extras;
- mCallSubstate = callSubstate;
}
}
- public static abstract class Listener {
+ public static abstract class Callback {
/**
* Invoked when the state of this {@code Call} has changed. See {@link #getState()}.
*
@@ -598,13 +586,21 @@ public final class Call {
public void onConferenceableCallsChanged(Call call, List<Call> conferenceableCalls) {}
}
+ /**
+ * @deprecated Use {@code Call.Callback} instead.
+ * @hide
+ */
+ @Deprecated
+ @SystemApi
+ public static abstract class Listener extends Callback { }
+
private final Phone mPhone;
private final String mTelecomCallId;
private final InCallAdapter mInCallAdapter;
private final List<String> mChildrenIds = new ArrayList<>();
private final List<Call> mChildren = new ArrayList<>();
private final List<Call> mUnmodifiableChildren = Collections.unmodifiableList(mChildren);
- private final List<Listener> mListeners = new CopyOnWriteArrayList<>();
+ private final List<Callback> mCallbacks = new CopyOnWriteArrayList<>();
private final List<Call> mConferenceableCalls = new ArrayList<>();
private final List<Call> mUnmodifiableConferenceableCalls =
Collections.unmodifiableList(mConferenceableCalls);
@@ -699,8 +695,8 @@ public final class Call {
* {@code Call} will temporarily pause playing the tones for a pre-defined period of time.
*
* If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_WAIT} symbol, this
- * {@code Call} will pause playing the tones and notify listeners via
- * {@link Listener#onPostDialWait(Call, String)}. At this point, the in-call app
+ * {@code Call} will pause playing the tones and notify callbacks via
+ * {@link Callback#onPostDialWait(Call, String)}. At this point, the in-call app
* should display to the user an indication of this state and an affordance to continue
* the postdial sequence. When the user decides to continue the postdial sequence, the in-call
* app should invoke the {@link #postDialContinue(boolean)} method.
@@ -841,25 +837,52 @@ public final class Call {
}
/**
+ * Registers a callback to this {@code Call}.
+ *
+ * @param callback A {@code Callback}.
+ */
+ public void registerCallback(Callback callback) {
+ mCallbacks.add(callback);
+ }
+
+ /**
+ * Unregisters a callback from this {@code Call}.
+ *
+ * @param callback A {@code Callback}.
+ */
+ public void unregisterCallback(Callback callback) {
+ if (callback != null) {
+ mCallbacks.remove(callback);
+ }
+ }
+
+ /**
* Adds a listener to this {@code Call}.
*
* @param listener A {@code Listener}.
+ * @deprecated Use {@link #registerCallback} instead.
+ * @hide
*/
+ @Deprecated
+ @SystemApi
public void addListener(Listener listener) {
- mListeners.add(listener);
+ registerCallback(listener);
}
/**
* Removes a listener from this {@code Call}.
*
* @param listener A {@code Listener}.
+ * @deprecated Use {@link #unregisterCallback} instead.
+ * @hide
*/
+ @Deprecated
+ @SystemApi
public void removeListener(Listener listener) {
- if (listener != null) {
- mListeners.remove(listener);
- }
+ unregisterCallback(listener);
}
+
/** {@hide} */
Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter) {
mPhone = phone;
@@ -889,8 +912,7 @@ public final class Call {
parcelableCall.getGatewayInfo(),
parcelableCall.getVideoState(),
parcelableCall.getStatusHints(),
- parcelableCall.getExtras(),
- parcelableCall.getCallSubstate());
+ parcelableCall.getExtras());
boolean detailsChanged = !Objects.equals(mDetails, details);
if (detailsChanged) {
mDetails = details;
@@ -991,56 +1013,56 @@ public final class Call {
}
private void fireStateChanged(int newState) {
- for (Listener listener : mListeners) {
- listener.onStateChanged(this, newState);
+ for (Callback callback : mCallbacks) {
+ callback.onStateChanged(this, newState);
}
}
private void fireParentChanged(Call newParent) {
- for (Listener listener : mListeners) {
- listener.onParentChanged(this, newParent);
+ for (Callback callback : mCallbacks) {
+ callback.onParentChanged(this, newParent);
}
}
private void fireChildrenChanged(List<Call> children) {
- for (Listener listener : mListeners) {
- listener.onChildrenChanged(this, children);
+ for (Callback callback : mCallbacks) {
+ callback.onChildrenChanged(this, children);
}
}
private void fireDetailsChanged(Details details) {
- for (Listener listener : mListeners) {
- listener.onDetailsChanged(this, details);
+ for (Callback callback : mCallbacks) {
+ callback.onDetailsChanged(this, details);
}
}
private void fireCannedTextResponsesLoaded(List<String> cannedTextResponses) {
- for (Listener listener : mListeners) {
- listener.onCannedTextResponsesLoaded(this, cannedTextResponses);
+ for (Callback callback : mCallbacks) {
+ callback.onCannedTextResponsesLoaded(this, cannedTextResponses);
}
}
private void fireVideoCallChanged(InCallService.VideoCall videoCall) {
- for (Listener listener : mListeners) {
- listener.onVideoCallChanged(this, videoCall);
+ for (Callback callback : mCallbacks) {
+ callback.onVideoCallChanged(this, videoCall);
}
}
private void firePostDialWait(String remainingPostDialSequence) {
- for (Listener listener : mListeners) {
- listener.onPostDialWait(this, remainingPostDialSequence);
+ for (Callback callback : mCallbacks) {
+ callback.onPostDialWait(this, remainingPostDialSequence);
}
}
private void fireCallDestroyed() {
- for (Listener listener : mListeners) {
- listener.onCallDestroyed(this);
+ for (Callback callback : mCallbacks) {
+ callback.onCallDestroyed(this);
}
}
private void fireConferenceableCallsChanged() {
- for (Listener listener : mListeners) {
- listener.onConferenceableCallsChanged(this, mUnmodifiableConferenceableCalls);
+ for (Callback callback : mCallbacks) {
+ callback.onConferenceableCallsChanged(this, mUnmodifiableConferenceableCalls);
}
}
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 476203196344..11632dcab9cc 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -200,48 +200,6 @@ public abstract class Connection implements IConferenceable {
// Next CAPABILITY value: 0x00200000
//**********************************************************************************************
- /**
- * Call substate bitmask values
- */
-
- /* Default case */
- /**
- * @hide
- */
- public static final int SUBSTATE_NONE = 0;
-
- /* Indicates that the call is connected but audio attribute is suspended */
- /**
- * @hide
- */
- public static final int SUBSTATE_AUDIO_CONNECTED_SUSPENDED = 0x1;
-
- /* Indicates that the call is connected but video attribute is suspended */
- /**
- * @hide
- */
- public static final int SUBSTATE_VIDEO_CONNECTED_SUSPENDED = 0x2;
-
- /* Indicates that the call is established but media retry is needed */
- /**
- * @hide
- */
- public static final int SUBSTATE_AVP_RETRY = 0x4;
-
- /* Indicates that the call is multitasking */
- /**
- * @hide
- */
- public static final int SUBSTATE_MEDIA_PAUSED = 0x8;
-
- /* Mask containing all the call substate bits set */
- /**
- * @hide
- */
- public static final int SUBSTATE_ALL = SUBSTATE_AUDIO_CONNECTED_SUSPENDED |
- SUBSTATE_VIDEO_CONNECTED_SUSPENDED | SUBSTATE_AVP_RETRY |
- SUBSTATE_MEDIA_PAUSED;
-
// Flag controlling whether PII is emitted into the logs
private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG);
@@ -380,7 +338,6 @@ public abstract class Connection implements IConferenceable {
public void onConferenceParticipantsChanged(Connection c,
List<ConferenceParticipant> participants) {}
public void onConferenceStarted() {}
- public void onCallSubstateChanged(Connection c, int substate) {}
}
public static abstract class VideoProvider {
@@ -807,7 +764,6 @@ public abstract class Connection implements IConferenceable {
private DisconnectCause mDisconnectCause;
private Conference mConference;
private ConnectionService mConnectionService;
- private int mCallSubstate;
/**
* Create a new Connection.
@@ -866,21 +822,6 @@ public abstract class Connection implements IConferenceable {
}
/**
- * Returns the call substate of the call.
- * Valid values: {@link Connection#SUBSTATE_NONE},
- * {@link Connection#SUBSTATE_AUDIO_CONNECTED_SUSPENDED},
- * {@link Connection#SUBSTATE_VIDEO_CONNECTED_SUSPENDED},
- * {@link Connection#SUBSTATE_AVP_RETRY},
- * {@link Connection#SUBSTATE_MEDIA_PAUSED}.
- *
- * @param callSubstate The new call substate.
- * @hide
- */
- public final int getCallSubstate() {
- return mCallSubstate;
- }
-
- /**
* @return The audio state of the connection, describing how its audio is currently
* being routed by the system. This is {@code null} if this Connection
* does not directly know about its audio state.
@@ -1054,25 +995,6 @@ public abstract class Connection implements IConferenceable {
}
/**
- * Set the call substate for the connection.
- * Valid values: {@link Connection#SUBSTATE_NONE},
- * {@link Connection#SUBSTATE_AUDIO_CONNECTED_SUSPENDED},
- * {@link Connection#SUBSTATE_VIDEO_CONNECTED_SUSPENDED},
- * {@link Connection#SUBSTATE_AVP_RETRY},
- * {@link Connection#SUBSTATE_MEDIA_PAUSED}.
- *
- * @param callSubstate The new call substate.
- * @hide
- */
- public final void setCallSubstate(int callSubstate) {
- Log.d(this, "setCallSubstate %d", callSubstate);
- mCallSubstate = callSubstate;
- for (Listener l : mListeners) {
- l.onCallSubstateChanged(this, mCallSubstate);
- }
- }
-
- /**
* Sets state to active (e.g., an ongoing connection where two or more parties can actively
* communicate).
*/
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index e36d32b52743..73d1644e9463 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -556,13 +556,6 @@ public abstract class ConnectionService extends Service {
mAdapter.setIsConferenced(id, conferenceId);
}
}
-
- @Override
- public void onCallSubstateChanged(Connection c, int callSubstate) {
- String id = mIdByConnection.get(c);
- Log.d(this, "Adapter set call substate %d", callSubstate);
- mAdapter.setCallSubstate(id, callSubstate);
- }
};
/** {@inheritDoc} */
@@ -632,8 +625,7 @@ public abstract class ConnectionService extends Service {
connection.getAudioModeIsVoip(),
connection.getStatusHints(),
connection.getDisconnectCause(),
- createIdList(connection.getConferenceables()),
- connection.getCallSubstate()));
+ createIdList(connection.getConferenceables())));
}
private void abort(String callId) {
@@ -956,7 +948,7 @@ public abstract class ConnectionService extends Service {
connection.getAudioModeIsVoip(),
connection.getStatusHints(),
connection.getDisconnectCause(),
- emptyList, connection.getCallSubstate());
+ emptyList);
mAdapter.addExistingConnection(id, parcelableConnection);
}
}
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
index a410976f4ec2..d026a28f1742 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
@@ -369,26 +369,4 @@ final class ConnectionServiceAdapter implements DeathRecipient {
}
}
}
-
- /**
- * Set the call substate for the connection.
- * Valid values: {@link Connection#CALL_SUBSTATE_NONE},
- * {@link Connection#CALL_SUBSTATE_AUDIO_CONNECTED_SUSPENDED},
- * {@link Connection#CALL_SUBSTATE_VIDEO_CONNECTED_SUSPENDED},
- * {@link Connection#CALL_SUBSTATE_AVP_RETRY},
- * {@link Connection#CALL_SUBSTATE_MEDIA_PAUSED}.
- *
- * @param callId The unique ID of the call to set the substate for.
- * @param callSubstate The new call substate.
- * @hide
- */
- public final void setCallSubstate(String callId, int callSubstate) {
- Log.v(this, "setCallSubstate: %d", callSubstate);
- for (IConnectionServiceAdapter adapter : mAdapters) {
- try {
- adapter.setCallSubstate(callId, callSubstate);
- } catch (RemoteException ignored) {
- }
- }
- }
}
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
index 5f937893cfe9..429f296e34d7 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
@@ -59,7 +59,6 @@ final class ConnectionServiceAdapterServant {
private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
private static final int MSG_ADD_EXISTING_CONNECTION = 21;
private static final int MSG_ON_POST_DIAL_CHAR = 22;
- private static final int MSG_SET_CALL_SUBSTATE = 23;
private final IConnectionServiceAdapter mDelegate;
@@ -221,10 +220,6 @@ final class ConnectionServiceAdapterServant {
}
break;
}
- case MSG_SET_CALL_SUBSTATE: {
- mDelegate.setCallSubstate((String) msg.obj, msg.arg1);
- break;
- }
}
}
};
@@ -389,12 +384,6 @@ final class ConnectionServiceAdapterServant {
args.arg2 = connection;
mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
}
-
- @Override
- public void setCallSubstate(String connectionId, int callSubstate) {
- mHandler.obtainMessage(MSG_SET_CALL_SUBSTATE, callSubstate, 0,
- connectionId).sendToTarget();
- }
};
public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index a17474ada520..7cbc0fc4beb1 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -216,9 +216,11 @@ public abstract class InCallService extends Service {
* if the {@code InCallService} is not in a state where it has an associated
* {@code Phone}.
* @hide
+ * @deprecated Use direct methods on InCallService instead of {@link Phone}.
*/
@SystemApi
- public final Phone getPhone() {
+ @Deprecated
+ public Phone getPhone() {
return mPhone;
}
@@ -282,8 +284,10 @@ public abstract class InCallService extends Service {
*
* @param phone The {@code Phone} object associated with this {@code InCallService}.
* @hide
+ * @deprecated Use direct methods on InCallService instead of {@link Phone}.
*/
@SystemApi
+ @Deprecated
public void onPhoneCreated(Phone phone) {
}
@@ -295,8 +299,10 @@ public abstract class InCallService extends Service {
*
* @param phone The {@code Phone} object associated with this {@code InCallService}.
* @hide
+ * @deprecated Use direct methods on InCallService instead of {@link Phone}.
*/
@SystemApi
+ @Deprecated
public void onPhoneDestroyed(Phone phone) {
}
@@ -357,12 +363,11 @@ public abstract class InCallService extends Service {
public static abstract class VideoCall {
/**
- * Sets a listener to invoke callback methods in the InCallUI after performing video
- * telephony actions.
+ * Registers a callback to receive commands and state changes for video calls.
*
- * @param videoCallListener The call video client.
+ * @param callback The video call callback.
*/
- public abstract void setVideoCallListener(VideoCall.Listener videoCallListener);
+ public abstract void registerCallback(VideoCall.Callback callback);
/**
* Sets the camera to be used for video recording in a video call.
@@ -405,7 +410,7 @@ public abstract class InCallService extends Service {
/**
* Issues a request to modify the properties of the current session. The request is sent to
* the remote device where it it handled by
- * {@link VideoCall.Listener#onSessionModifyRequestReceived}.
+ * {@link VideoCall.Callback#onSessionModifyRequestReceived}.
* Some examples of session modification requests: upgrade call from audio to video,
* downgrade call from video to audio, pause video.
*
@@ -417,9 +422,9 @@ public abstract class InCallService extends Service {
* Provides a response to a request to change the current call session video
* properties.
* This is in response to a request the InCall UI has received via
- * {@link VideoCall.Listener#onSessionModifyRequestReceived}.
+ * {@link VideoCall.Callback#onSessionModifyRequestReceived}.
* The response is handled on the remove device by
- * {@link VideoCall.Listener#onSessionModifyResponseReceived}.
+ * {@link VideoCall.Callback#onSessionModifyResponseReceived}.
*
* @param responseProfile The response call video properties.
*/
@@ -428,14 +433,14 @@ public abstract class InCallService extends Service {
/**
* Issues a request to the video provider to retrieve the camera capabilities.
* Camera capabilities are reported back to the caller via
- * {@link VideoCall.Listener#onCameraCapabilitiesChanged(CameraCapabilities)}.
+ * {@link VideoCall.Callback#onCameraCapabilitiesChanged(CameraCapabilities)}.
*/
public abstract void requestCameraCapabilities();
/**
* Issues a request to the video telephony framework to retrieve the cumulative data usage for
* the current call. Data usage is reported back to the caller via
- * {@link VideoCall.Listener#onCallDataUsageChanged}.
+ * {@link VideoCall.Callback#onCallDataUsageChanged}.
*/
public abstract void requestCallDataUsage();
@@ -448,9 +453,9 @@ public abstract class InCallService extends Service {
public abstract void setPauseImage(String uri);
/**
- * Listener class which invokes callbacks after video call actions occur.
+ * Callback class which invokes callbacks after video call actions occur.
*/
- public static abstract class Listener {
+ public static abstract class Callback {
/**
* Called when a session modification request is received from the remote device.
* The remote request is sent via
diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index adc648f2aa6c..c5c3d11a1690 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -54,7 +54,6 @@ public final class ParcelableCall implements Parcelable {
private final int mVideoState;
private final List<String> mConferenceableCallIds;
private final Bundle mExtras;
- private int mCallSubstate;
public ParcelableCall(
String id,
@@ -76,8 +75,7 @@ public final class ParcelableCall implements Parcelable {
StatusHints statusHints,
int videoState,
List<String> conferenceableCallIds,
- Bundle extras,
- int callSubstate) {
+ Bundle extras) {
mId = id;
mState = state;
mDisconnectCause = disconnectCause;
@@ -98,7 +96,6 @@ public final class ParcelableCall implements Parcelable {
mVideoState = videoState;
mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds);
mExtras = extras;
- mCallSubstate = callSubstate;
}
/** The unique ID of the call. */
@@ -235,14 +232,6 @@ public final class ParcelableCall implements Parcelable {
return mExtras;
}
- /**
- * The call substate.
- * @return The substate of the call.
- */
- public int getCallSubstate() {
- return mCallSubstate;
- }
-
/** Responsible for creating ParcelableCall objects for deserialized Parcels. */
public static final Parcelable.Creator<ParcelableCall> CREATOR =
new Parcelable.Creator<ParcelableCall> () {
@@ -273,7 +262,6 @@ public final class ParcelableCall implements Parcelable {
List<String> conferenceableCallIds = new ArrayList<>();
source.readList(conferenceableCallIds, classLoader);
Bundle extras = source.readParcelable(classLoader);
- int callSubstate = source.readInt();
return new ParcelableCall(
id,
state,
@@ -294,8 +282,7 @@ public final class ParcelableCall implements Parcelable {
statusHints,
videoState,
conferenceableCallIds,
- extras,
- callSubstate);
+ extras);
}
@Override
@@ -334,7 +321,6 @@ public final class ParcelableCall implements Parcelable {
destination.writeInt(mVideoState);
destination.writeList(mConferenceableCallIds);
destination.writeParcelable(mExtras, 0);
- destination.writeInt(mCallSubstate);
}
@Override
diff --git a/telecomm/java/android/telecom/ParcelableConnection.java b/telecomm/java/android/telecom/ParcelableConnection.java
index b60b99da3bcd..552e2503166d 100644
--- a/telecomm/java/android/telecom/ParcelableConnection.java
+++ b/telecomm/java/android/telecom/ParcelableConnection.java
@@ -46,7 +46,6 @@ public final class ParcelableConnection implements Parcelable {
private final StatusHints mStatusHints;
private final DisconnectCause mDisconnectCause;
private final List<String> mConferenceableConnectionIds;
- private final int mCallSubstate;
/** @hide */
public ParcelableConnection(
@@ -63,8 +62,7 @@ public final class ParcelableConnection implements Parcelable {
boolean isVoipAudioMode,
StatusHints statusHints,
DisconnectCause disconnectCause,
- List<String> conferenceableConnectionIds,
- int callSubstate) {
+ List<String> conferenceableConnectionIds) {
mPhoneAccount = phoneAccount;
mState = state;
mConnectionCapabilities = capabilities;
@@ -79,7 +77,6 @@ public final class ParcelableConnection implements Parcelable {
mStatusHints = statusHints;
mDisconnectCause = disconnectCause;
this.mConferenceableConnectionIds = conferenceableConnectionIds;
- mCallSubstate = callSubstate;
}
public PhoneAccountHandle getPhoneAccount() {
@@ -139,10 +136,6 @@ public final class ParcelableConnection implements Parcelable {
return mConferenceableConnectionIds;
}
- public int getCallSubstate() {
- return mCallSubstate;
- }
-
@Override
public String toString() {
return new StringBuilder()
@@ -177,7 +170,6 @@ public final class ParcelableConnection implements Parcelable {
DisconnectCause disconnectCause = source.readParcelable(classLoader);
List<String> conferenceableConnectionIds = new ArrayList<>();
source.readStringList(conferenceableConnectionIds);
- int callSubstate = source.readInt();
return new ParcelableConnection(
phoneAccount,
@@ -193,8 +185,7 @@ public final class ParcelableConnection implements Parcelable {
audioModeIsVoip,
statusHints,
disconnectCause,
- conferenceableConnectionIds,
- callSubstate);
+ conferenceableConnectionIds);
}
@Override
@@ -227,6 +218,5 @@ public final class ParcelableConnection implements Parcelable {
destination.writeParcelable(mStatusHints, 0);
destination.writeParcelable(mDisconnectCause, 0);
destination.writeStringList(mConferenceableConnectionIds);
- destination.writeInt(mCallSubstate);
}
}
diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java
index d9a9cdf84da3..c1c1129a2aab 100644
--- a/telecomm/java/android/telecom/Phone.java
+++ b/telecomm/java/android/telecom/Phone.java
@@ -16,6 +16,7 @@
package android.telecom;
+import android.annotation.SystemApi;
import android.util.ArrayMap;
import java.util.Collections;
@@ -26,7 +27,12 @@ import java.util.concurrent.CopyOnWriteArrayList;
/**
* A unified virtual device providing a means of voice (and other) communication on a device.
+ *
+ * @hide
+ * @deprecated Use {@link InCallService} directly instead of using this class.
*/
+@SystemApi
+@Deprecated
public final class Phone {
public abstract static class Listener {
@@ -100,12 +106,10 @@ public final class Phone {
private boolean mCanAddCall = true;
- /** {@hide} */
Phone(InCallAdapter adapter) {
mInCallAdapter = adapter;
}
- /** {@hide} */
final void internalAddCall(ParcelableCall parcelableCall) {
Call call = new Call(this, parcelableCall.getId(), mInCallAdapter);
mCallByTelecomCallId.put(parcelableCall.getId(), call);
@@ -115,14 +119,12 @@ public final class Phone {
fireCallAdded(call);
}
- /** {@hide} */
final void internalRemoveCall(Call call) {
mCallByTelecomCallId.remove(call.internalGetCallId());
mCalls.remove(call);
fireCallRemoved(call);
}
- /** {@hide} */
final void internalUpdateCall(ParcelableCall parcelableCall) {
Call call = mCallByTelecomCallId.get(parcelableCall.getId());
if (call != null) {
@@ -131,7 +133,6 @@ public final class Phone {
}
}
- /** {@hide} */
final void internalSetPostDialWait(String telecomId, String remaining) {
Call call = mCallByTelecomCallId.get(telecomId);
if (call != null) {
@@ -139,7 +140,6 @@ public final class Phone {
}
}
- /** {@hide} */
final void internalAudioStateChanged(AudioState audioState) {
if (!Objects.equals(mAudioState, audioState)) {
mAudioState = audioState;
@@ -147,17 +147,14 @@ public final class Phone {
}
}
- /** {@hide} */
final Call internalGetCallByTelecomId(String telecomId) {
return mCallByTelecomCallId.get(telecomId);
}
- /** {@hide} */
final void internalBringToForeground(boolean showDialpad) {
fireBringToForeground(showDialpad);
}
- /** {@hide} */
final void internalSetCanAddCall(boolean canAddCall) {
if (mCanAddCall != canAddCall) {
mCanAddCall = canAddCall;
@@ -167,7 +164,6 @@ public final class Phone {
/**
* Called to destroy the phone and cleanup any lingering calls.
- * @hide
*/
final void destroy() {
for (Call call : mCalls) {
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index 009ec5b49811..4c423f208f12 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -153,16 +153,6 @@ public final class RemoteConnection {
public void onVideoStateChanged(RemoteConnection connection, int videoState) {}
/**
- * Indicates that the call substate of this {@code RemoteConnection} has changed.
- * See {@link #getCallSubstate()}.
- *
- * @param connection The {@code RemoteConnection} invoking this method.
- * @param callSubstate The new call substate of the {@code RemoteConnection}.
- * @hide
- */
- public void onCallSubstateChanged(RemoteConnection connection, int callSubstate) {}
-
- /**
* Indicates that this {@code RemoteConnection} has been destroyed. No further requests
* should be made to the {@code RemoteConnection}, and references to it should be cleared.
*
@@ -414,7 +404,6 @@ public final class RemoteConnection {
private boolean mConnected;
private int mConnectionCapabilities;
private int mVideoState;
- private int mCallSubstate;
private VideoProvider mVideoProvider;
private boolean mIsVoipAudioMode;
private StatusHints mStatusHints;
@@ -595,15 +584,6 @@ public final class RemoteConnection {
}
/**
- *
- * @return The call substate of the {@code RemoteConnection}. See
- * @hide
- */
- public int getCallSubstate() {
- return mCallSubstate;
- }
-
- /**
* Obtains the video provider of this {@code RemoteConnection}.
* @return The video provider associated with this {@code RemoteConnection}.
* @hide
@@ -916,16 +896,6 @@ public final class RemoteConnection {
/**
* @hide
*/
- void setCallSubstate(int callSubstate) {
- mCallSubstate = callSubstate;
- for (Callback c : mCallbacks) {
- c.onCallSubstateChanged(this, callSubstate);
- }
- }
-
- /**
- * @hide
- */
void setVideoProvider(VideoProvider videoProvider) {
mVideoProvider = videoProvider;
for (Callback c : mCallbacks) {
diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java
index 7374a3b022ae..a9b725be133f 100644
--- a/telecomm/java/android/telecom/RemoteConnectionService.java
+++ b/telecomm/java/android/telecom/RemoteConnectionService.java
@@ -84,7 +84,6 @@ final class RemoteConnectionService {
}
connection.setConferenceableConnections(conferenceable);
connection.setVideoState(parcel.getVideoState());
- connection.setCallSubstate(parcel.getCallSubstate());
if (connection.getState() == Connection.STATE_DISCONNECTED) {
// ... then, if it was created in a disconnected state, that indicates
// failure on the providing end, so immediately mark it destroyed
@@ -312,12 +311,6 @@ final class RemoteConnectionService {
mOurConnectionServiceImpl.addRemoteExistingConnection(remoteConnction);
}
-
- @Override
- public void setCallSubstate(String callId, int callSubstate) {
- findConnectionForAction(callId, "callSubstate")
- .setCallSubstate(callSubstate);
- }
};
private final ConnectionServiceAdapterServant mServant =
diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java
index 04454489a0be..7bef6881f571 100644
--- a/telecomm/java/android/telecom/VideoCallImpl.java
+++ b/telecomm/java/android/telecom/VideoCallImpl.java
@@ -46,7 +46,7 @@ public class VideoCallImpl extends VideoCall {
private final IVideoProvider mVideoProvider;
private final VideoCallListenerBinder mBinder;
- private VideoCall.Listener mVideoCallListener;
+ private VideoCall.Callback mCallback;
private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() {
@Override
@@ -109,14 +109,14 @@ public class VideoCallImpl extends VideoCall {
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
- if (mVideoCallListener == null) {
+ if (mCallback == null) {
return;
}
SomeArgs args;
switch (msg.what) {
case MSG_RECEIVE_SESSION_MODIFY_REQUEST:
- mVideoCallListener.onSessionModifyRequestReceived((VideoProfile) msg.obj);
+ mCallback.onSessionModifyRequestReceived((VideoProfile) msg.obj);
break;
case MSG_RECEIVE_SESSION_MODIFY_RESPONSE:
args = (SomeArgs) msg.obj;
@@ -125,34 +125,34 @@ public class VideoCallImpl extends VideoCall {
VideoProfile requestProfile = (VideoProfile) args.arg2;
VideoProfile responseProfile = (VideoProfile) args.arg3;
- mVideoCallListener.onSessionModifyResponseReceived(
+ mCallback.onSessionModifyResponseReceived(
status, requestProfile, responseProfile);
} finally {
args.recycle();
}
break;
case MSG_HANDLE_CALL_SESSION_EVENT:
- mVideoCallListener.onCallSessionEvent((int) msg.obj);
+ mCallback.onCallSessionEvent((int) msg.obj);
break;
case MSG_CHANGE_PEER_DIMENSIONS:
args = (SomeArgs) msg.obj;
try {
int width = (int) args.arg1;
int height = (int) args.arg2;
- mVideoCallListener.onPeerDimensionsChanged(width, height);
+ mCallback.onPeerDimensionsChanged(width, height);
} finally {
args.recycle();
}
break;
case MSG_CHANGE_CALL_DATA_USAGE:
- mVideoCallListener.onCallDataUsageChanged((long) msg.obj);
+ mCallback.onCallDataUsageChanged((long) msg.obj);
break;
case MSG_CHANGE_CAMERA_CAPABILITIES:
- mVideoCallListener.onCameraCapabilitiesChanged(
+ mCallback.onCameraCapabilitiesChanged(
(CameraCapabilities) msg.obj);
break;
case MSG_CHANGE_VIDEO_QUALITY:
- mVideoCallListener.onVideoQualityChanged(msg.arg1);
+ mCallback.onVideoQualityChanged(msg.arg1);
break;
default:
break;
@@ -170,8 +170,8 @@ public class VideoCallImpl extends VideoCall {
}
/** {@inheritDoc} */
- public void setVideoCallListener(VideoCall.Listener videoCallListener) {
- mVideoCallListener = videoCallListener;
+ public void registerCallback(VideoCall.Callback callback) {
+ mCallback = callback;
}
/** {@inheritDoc} */
diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
index e6c28f3e913c..7e7e9cc4a904 100644
--- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
@@ -81,6 +81,4 @@ oneway interface IConnectionServiceAdapter {
void setConferenceableConnections(String callId, in List<String> conferenceableCallIds);
void addExistingConnection(String callId, in ParcelableConnection connection);
-
- void setCallSubstate(String callId, int callSubstate);
}
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
new file mode 100644
index 000000000000..b1fb3a612d52
--- /dev/null
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -0,0 +1,219 @@
+/*
+ * 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 android.telephony;
+
+import com.android.internal.telephony.ICarrierConfigLoader;
+
+import android.annotation.SystemApi;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+
+/**
+ * Provides access to telephony configuration values that are carrier-specific.
+ * <p>
+ * Users should obtain an instance of this class by calling
+ * {@code mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);}
+ * </p>
+ *
+ * @see Context#getSystemService
+ * @see Context#CARRIER_CONFIG_SERVICE
+ */
+public class CarrierConfigManager {
+ /**
+ * @hide
+ */
+ public CarrierConfigManager() {
+ }
+
+ /**
+ * This intent is broadcast by the system when carrier config changes.
+ */
+ public static final String
+ ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
+
+ /**
+ * Flag specifying whether VoLTE 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 BOOL_CARRIER_VOLTE_AVAILABLE = "bool_carrier_volte_available";
+
+ /**
+ * Flag specifying whether VoLTE availability is based on provisioning.
+ */
+ public static final String BOOL_CARRIER_VOLTE_PROVISIONED = "bool_carrier_volte_provisioned";
+
+ /**
+ * Flag specifying whether VoLTE TTY is supported.
+ */
+ public static final String BOOL_CARRIER_VOLTE_TTY_SUPPORTED
+ = "bool_carrier_volte_tty_supported";
+
+ /**
+ * Show APN Settings for some CDMA carriers.
+ */
+ public static final String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
+
+ /**
+ * If Voice Radio Technology is RIL_RADIO_TECHNOLOGY_LTE:14 or RIL_RADIO_TECHNOLOGY_UNKNOWN:0
+ * this is the value that should be used instead. A configuration value of
+ * RIL_RADIO_TECHNOLOGY_UNKNOWN:0 means there is no replacement value and that the default
+ * assumption for phone type (GSM) should be used.
+ */
+ public static final String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat";
+
+ /* The following 3 fields are related to carrier visual voicemail. */
+
+ /**
+ * The carrier number MO sms messages are sent to.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String STRING_VVM_DESTINATION_NUMBER = "string_vvm_destination_number";
+
+ /**
+ * The port through which the MO sms messages are sent through.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String SHORT_VVM_PORT_NUMBER = "string_vvm_port_number";
+
+ /**
+ * The type of visual voicemail protocol the carrier adheres to (see below).
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String STRING_VVM_TYPE = "string_vvm_type";
+
+ /* Visual voicemail protocols */
+
+ /**
+ * The OMTP protocol.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String VVM_TYPE_OMTP = "vvm_type_omtp";
+
+ private final static String TAG = "CarrierConfigManager";
+
+ /** The default value for every variable. */
+ private final static Bundle sDefaults;
+
+ static {
+ sDefaults = new Bundle();
+ sDefaults.putBoolean(BOOL_CARRIER_VOLTE_AVAILABLE, false);
+ sDefaults.putBoolean(BOOL_CARRIER_VOLTE_PROVISIONED, false);
+ sDefaults.putBoolean(BOOL_CARRIER_VOLTE_TTY_SUPPORTED, true);
+ sDefaults.putBoolean(BOOL_SHOW_APN_SETTING_CDMA, false);
+
+ sDefaults.putInt(INT_VOLTE_REPLACEMENT_RAT, 0);
+ }
+
+ /**
+ * Gets the configuration values for a particular subscription, which is associated with a
+ * specific SIM card. If an invalid subId is used, the returned config will contain default
+ * values.
+ *
+ * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}.
+ * @return A {@link Bundle} containing the config for the given subId, or default values for an
+ * invalid subId.
+ */
+ public Bundle getConfigForSubId(int subId) {
+ try {
+ return getICarrierConfigLoader().getConfigForSubId(subId);
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "Error getting config for subId " + Integer.toString(subId) + ": "
+ + ex.toString());
+ } catch (NullPointerException ex) {
+ Rlog.e(TAG, "Error getting config for subId " + Integer.toString(subId) + ": "
+ + ex.toString());
+ }
+ return null;
+ }
+
+ /**
+ * Gets the configuration values for the default subscription.
+ *
+ * @see #getConfigForSubId
+ */
+ public Bundle getConfig() {
+ return getConfigForSubId(SubscriptionManager.getDefaultSubId());
+ }
+
+ /**
+ * Calling this method triggers telephony services to fetch the current carrier configuration.
+ * <p>
+ * Normally this does not need to be called because the platform reloads config on its own. Call
+ * this method if your app wants to update config at an arbitrary moment.
+ * </p>
+ * <p>
+ * This method returns before the reload has completed, and
+ * {@link android.service.carrier.CarrierConfigService#onLoadConfig} will be called from an
+ * arbitrary thread.
+ * </p>
+ */
+ public void reloadCarrierConfigForSubId(int subId) {
+ try {
+ getICarrierConfigLoader().reloadCarrierConfigForSubId(subId);
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "Error reloading config for subId=" + subId + ": " + ex.toString());
+ } catch (NullPointerException ex) {
+ Rlog.e(TAG, "Error reloading config for subId=" + subId + ": " + ex.toString());
+ }
+ }
+
+ /**
+ * Request the carrier config loader to update the cofig for phoneId.
+ *
+ * Depending on simState, the config may be cleared or loaded from config app.
+ * This is only used by SubscriptionInfoUpdater.
+ *
+ * @hide
+ */
+ @SystemApi
+ public void updateConfigForPhoneId(int phoneId, String simState) {
+ try {
+ getICarrierConfigLoader().updateConfigForPhoneId(phoneId, simState);
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "Error updating config for phoneId=" + phoneId + ": " + ex.toString());
+ } catch (NullPointerException ex) {
+ Rlog.e(TAG, "Error updating config for phoneId=" + phoneId + ": " + ex.toString());
+ }
+ }
+
+ /**
+ * Returns a bundle with the default value for every supported configuration variable.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static Bundle getDefaultConfig() {
+ return sDefaults;
+ }
+
+ /** @hide */
+ private ICarrierConfigLoader getICarrierConfigLoader() {
+ return ICarrierConfigLoader.Stub
+ .asInterface(ServiceManager.getService(Context.CARRIER_CONFIG_SERVICE));
+ }
+}
diff --git a/telephony/java/com/android/ims/internal/IImsCallSession.aidl b/telephony/java/com/android/ims/internal/IImsCallSession.aidl
index 9b435dcdf924..b1f2d3287dbe 100644
--- a/telephony/java/com/android/ims/internal/IImsCallSession.aidl
+++ b/telephony/java/com/android/ims/internal/IImsCallSession.aidl
@@ -255,11 +255,4 @@ interface IImsCallSession {
* @return {@code True} if the session is multiparty.
*/
boolean isMultiparty();
-
- /**
- * Gets the call substate for this session.
- *
- * @return the call substate for this session.
- */
- int getCallSubstate();
}
diff --git a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl
new file mode 100644
index 000000000000..b5cdd9a250d1
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl
@@ -0,0 +1,31 @@
+/*
+ * 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.telephony;
+
+import android.os.Bundle;
+
+/**
+ * Interface used to interact with the CarrierConfigLoader
+ */
+interface ICarrierConfigLoader {
+
+ Bundle getConfigForSubId(int subId);
+
+ void reloadCarrierConfigForSubId(int subId);
+
+ void updateConfigForPhoneId(int phoneId, String simState);
+}
diff --git a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
index 818940d768dd..82012c1e2767 100644
--- a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
+++ b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
@@ -376,6 +376,10 @@ public class IWindowManagerImpl implements IWindowManager {
}
@Override
+ public void setForcedDisplayScalingMode(int displayId, int mode) {
+ }
+
+ @Override
public void setInTouchMode(boolean arg0) throws RemoteException {
// TODO Auto-generated method stub
}