Merge "Update NetworkScoreService to use SystemService" into pi-dev
diff --git a/api/system-current.txt b/api/system-current.txt
index 7e95ddc..76a71cd 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -317,6 +317,7 @@
public class BroadcastOptions {
method public static android.app.BroadcastOptions makeBasic();
+ method public void setDontSendToRestrictedApps(boolean);
method public void setTemporaryAppWhitelistDuration(long);
method public android.os.Bundle toBundle();
}
diff --git a/api/test-current.txt b/api/test-current.txt
index 4878690..23b6819 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -467,12 +467,49 @@
}
+package android.media {
+
+ public final class AudioFormat implements android.os.Parcelable {
+ method public static int channelCountFromInChannelMask(int);
+ method public static int channelCountFromOutChannelMask(int);
+ method public static int getBytesPerSample(int);
+ method public static boolean isEncodingLinearPcm(int);
+ }
+
+ public static final class VolumeShaper.Configuration.Builder {
+ method public android.media.VolumeShaper.Configuration.Builder setOptionFlags(int);
+ }
+
+}
+
package android.media.audiofx {
public class AudioEffect {
+ method public static int byteArrayToInt(byte[]);
+ method public static short byteArrayToShort(byte[]);
+ method public int getParameter(byte[], byte[]) throws java.lang.IllegalStateException;
+ method public int getParameter(int, byte[]) throws java.lang.IllegalStateException;
+ method public int getParameter(int, int[]) throws java.lang.IllegalStateException;
+ method public int getParameter(int, short[]) throws java.lang.IllegalStateException;
+ method public int getParameter(int[], short[]) throws java.lang.IllegalStateException;
+ method public static byte[] intToByteArray(int);
+ method public static boolean isEffectTypeAvailable(java.util.UUID);
+ method public static boolean isError(int);
+ method public int setParameter(byte[], byte[]) throws java.lang.IllegalStateException;
+ method public int setParameter(int, int) throws java.lang.IllegalStateException;
+ method public int setParameter(int, short) throws java.lang.IllegalStateException;
+ method public int setParameter(int, byte[]) throws java.lang.IllegalStateException;
+ method public int setParameter(int[], int[]) throws java.lang.IllegalStateException;
+ method public int setParameter(int[], byte[]) throws java.lang.IllegalStateException;
+ method public void setParameterListener(android.media.audiofx.AudioEffect.OnParameterChangeListener);
+ method public static byte[] shortToByteArray(short);
field public static final java.util.UUID EFFECT_TYPE_NULL;
}
+ public static abstract interface AudioEffect.OnParameterChangeListener {
+ method public abstract void onParameterChange(android.media.audiofx.AudioEffect, int, byte[], byte[]);
+ }
+
}
package android.net {
@@ -786,6 +823,10 @@
public class ServiceState implements android.os.Parcelable {
method public void setCdmaSystemAndNetworkId(int, int);
+ method public void setCellBandwidths(int[]);
+ method public void setChannelNumber(int);
+ method public void setRilDataRadioTechnology(int);
+ method public void setRilVoiceRadioTechnology(int);
}
public class TelephonyManager {
diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt
index 321baa8..bf17d70 100644
--- a/config/hiddenapi-light-greylist.txt
+++ b/config/hiddenapi-light-greylist.txt
@@ -2,8 +2,8 @@
Landroid/accounts/IAccountAuthenticatorResponse$Stub;-><init>()V
Landroid/accounts/IAccountManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/accounts/IAccountManager;
Landroid/accounts/IAccountManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
-Landroid/animation/LayoutTransition;->cancel()V
Landroid/animation/LayoutTransition;->cancel(I)V
+Landroid/animation/LayoutTransition;->cancel()V
Landroid/animation/ValueAnimator;->animateValue(F)V
Landroid/animation/ValueAnimator;->sDurationScale:F
Landroid/app/Activity;->getActivityOptions()Landroid/app/ActivityOptions;
@@ -661,6 +661,7 @@
Landroid/database/AbstractCursor;->mExtras:Landroid/os/Bundle;
Landroid/database/AbstractCursor;->mNotifyUri:Landroid/net/Uri;
Landroid/database/AbstractCursor;->mRowIdColumnIndex:I
+Landroid/database/AbstractWindowedCursor;->clearOrCreateWindow(Ljava/lang/String;)V
Landroid/database/CursorWindow;->mWindowPtr:J
Landroid/database/CursorWindow;->sCursorWindowSize:I
Landroid/database/CursorWindow;->sWindowToPidMap:Landroid/util/LongSparseArray;
@@ -1188,9 +1189,6 @@
Landroid/net/Proxy;->getProxy(Landroid/content/Context;Ljava/lang/String;)Ljava/net/Proxy;
Landroid/net/ProxyInfo;-><init>(Ljava/lang/String;ILjava/lang/String;)V
Landroid/net/SntpClient;-><init>()V
-Landroid/net/StaticIpConfiguration;->gateway:Ljava/net/InetAddress;
-Landroid/net/StaticIpConfiguration;->ipAddress:Landroid/net/LinkAddress;
-Landroid/net/StaticIpConfiguration;-><init>()V
Landroid/net/SSLCertificateSocketFactory;->castToOpenSSLSocket(Ljava/net/Socket;)Lcom/android/org/conscrypt/OpenSSLSocketImpl;
Landroid/net/SSLCertificateSocketFactory;->getAlpnSelectedProtocol(Ljava/net/Socket;)[B
Landroid/net/SSLCertificateSocketFactory;->getDelegate()Ljavax/net/ssl/SSLSocketFactory;
@@ -1215,6 +1213,9 @@
Landroid/net/SSLCertificateSocketFactory;->TAG:Ljava/lang/String;
Landroid/net/SSLCertificateSocketFactory;->verifyHostname(Ljava/net/Socket;Ljava/lang/String;)V
Landroid/net/SSLSessionCache;->mSessionCache:Lcom/android/org/conscrypt/SSLClientSessionCache;
+Landroid/net/StaticIpConfiguration;->gateway:Ljava/net/InetAddress;
+Landroid/net/StaticIpConfiguration;-><init>()V
+Landroid/net/StaticIpConfiguration;->ipAddress:Landroid/net/LinkAddress;
Landroid/net/TrafficStats;->getMobileIfaces()[Ljava/lang/String;
Landroid/net/TrafficStats;->getRxBytes(Ljava/lang/String;)J
Landroid/net/TrafficStats;->getStatsService()Landroid/net/INetworkStatsService;
@@ -3198,8 +3199,8 @@
Ljava/lang/Double;->value:D
Ljava/lang/Float;->value:F
Ljava/lang/Integer;->value:I
-Ljava/lang/Long;->value:J
Ljava/lang/invoke/MethodHandles$Lookup;-><init>(Ljava/lang/Class;I)V
+Ljava/lang/Long;->value:J
Ljava/lang/ref/FinalizerReference;->add(Ljava/lang/Object;)V
Ljava/lang/ref/FinalizerReference;->head:Ljava/lang/ref/FinalizerReference;
Ljava/lang/ref/FinalizerReference;->next:Ljava/lang/ref/FinalizerReference;
diff --git a/core/java/android/app/BroadcastOptions.java b/core/java/android/app/BroadcastOptions.java
index b6cff38..69c3632 100644
--- a/core/java/android/app/BroadcastOptions.java
+++ b/core/java/android/app/BroadcastOptions.java
@@ -32,6 +32,7 @@
private long mTemporaryAppWhitelistDuration;
private int mMinManifestReceiverApiLevel = 0;
private int mMaxManifestReceiverApiLevel = Build.VERSION_CODES.CUR_DEVELOPMENT;
+ private boolean mDontSendToRestrictedApps = false;
/**
* How long to temporarily put an app on the power whitelist when executing this broadcast
@@ -52,6 +53,12 @@
static final String KEY_MAX_MANIFEST_RECEIVER_API_LEVEL
= "android:broadcast.maxManifestReceiverApiLevel";
+ /**
+ * Corresponds to {@link #setMaxManifestReceiverApiLevel}.
+ */
+ static final String KEY_DONT_SEND_TO_RESTRICTED_APPS =
+ "android:broadcast.dontSendToRestrictedApps";
+
public static BroadcastOptions makeBasic() {
BroadcastOptions opts = new BroadcastOptions();
return opts;
@@ -66,6 +73,7 @@
mMinManifestReceiverApiLevel = opts.getInt(KEY_MIN_MANIFEST_RECEIVER_API_LEVEL, 0);
mMaxManifestReceiverApiLevel = opts.getInt(KEY_MAX_MANIFEST_RECEIVER_API_LEVEL,
Build.VERSION_CODES.CUR_DEVELOPMENT);
+ mDontSendToRestrictedApps = opts.getBoolean(KEY_DONT_SEND_TO_RESTRICTED_APPS, false);
}
/**
@@ -123,6 +131,23 @@
}
/**
+ * Sets whether pending intent can be sent for an application with background restrictions
+ * @param dontSendToRestrictedApps if true, pending intent will not be sent for an application
+ * with background restrictions. Default value is {@code false}
+ */
+ public void setDontSendToRestrictedApps(boolean dontSendToRestrictedApps) {
+ mDontSendToRestrictedApps = dontSendToRestrictedApps;
+ }
+
+ /**
+ * @hide
+ * @return #setDontSendToRestrictedApps
+ */
+ public boolean isDontSendToRestrictedApps() {
+ return mDontSendToRestrictedApps;
+ }
+
+ /**
* Returns the created options as a Bundle, which can be passed to
* {@link android.content.Context#sendBroadcast(android.content.Intent)
* Context.sendBroadcast(Intent)} and related methods.
@@ -141,6 +166,9 @@
if (mMaxManifestReceiverApiLevel != Build.VERSION_CODES.CUR_DEVELOPMENT) {
b.putInt(KEY_MAX_MANIFEST_RECEIVER_API_LEVEL, mMaxManifestReceiverApiLevel);
}
+ if (mDontSendToRestrictedApps) {
+ b.putBoolean(KEY_DONT_SEND_TO_RESTRICTED_APPS, true);
+ }
return b.isEmpty() ? null : b;
}
}
diff --git a/core/java/com/android/internal/app/ColorDisplayController.java b/core/java/com/android/internal/app/ColorDisplayController.java
index 278d31a..f1539ee 100644
--- a/core/java/com/android/internal/app/ColorDisplayController.java
+++ b/core/java/com/android/internal/app/ColorDisplayController.java
@@ -365,6 +365,10 @@
* Get the current color mode.
*/
public int getColorMode() {
+ if (getAccessibilityTransformActivated()) {
+ return COLOR_MODE_SATURATED;
+ }
+
final int colorMode = System.getIntForUser(mContext.getContentResolver(),
System.DISPLAY_COLOR_MODE, -1, mUserId);
if (colorMode < COLOR_MODE_NATURAL || colorMode > COLOR_MODE_SATURATED) {
@@ -416,6 +420,18 @@
R.integer.config_nightDisplayColorTemperatureDefault);
}
+ /**
+ * Returns true if any Accessibility color transforms are enabled.
+ */
+ public boolean getAccessibilityTransformActivated() {
+ final ContentResolver cr = mContext.getContentResolver();
+ return
+ Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
+ 0, mUserId) == 1
+ || Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
+ 0, mUserId) == 1;
+ }
+
private void onSettingChanged(@NonNull String setting) {
if (DEBUG) {
Slog.d(TAG, "onSettingChanged: " + setting);
@@ -441,6 +457,10 @@
case System.DISPLAY_COLOR_MODE:
mCallback.onDisplayColorModeChanged(getColorMode());
break;
+ case Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED:
+ case Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED:
+ mCallback.onAccessibilityTransformChanged(getAccessibilityTransformActivated());
+ break;
}
}
}
@@ -471,6 +491,12 @@
false /* notifyForDescendants */, mContentObserver, mUserId);
cr.registerContentObserver(System.getUriFor(System.DISPLAY_COLOR_MODE),
false /* notifyForDecendants */, mContentObserver, mUserId);
+ cr.registerContentObserver(
+ Secure.getUriFor(Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED),
+ false /* notifyForDecendants */, mContentObserver, mUserId);
+ cr.registerContentObserver(
+ Secure.getUriFor(Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED),
+ false /* notifyForDecendants */, mContentObserver, mUserId);
}
}
}
@@ -531,5 +557,12 @@
* @param displayColorMode the color mode
*/
default void onDisplayColorModeChanged(int displayColorMode) {}
+
+ /**
+ * Callback invoked when Accessibility color transforms change.
+ *
+ * @param state the state Accessibility color transforms (true of active)
+ */
+ default void onAccessibilityTransformChanged(boolean state) {}
}
}
diff --git a/core/java/com/android/internal/os/BatteryStatsHelper.java b/core/java/com/android/internal/os/BatteryStatsHelper.java
index 1e5bd18..b49aace 100644
--- a/core/java/com/android/internal/os/BatteryStatsHelper.java
+++ b/core/java/com/android/internal/os/BatteryStatsHelper.java
@@ -657,7 +657,7 @@
* {@link #removeHiddenBatterySippers(List)}.
*/
private void addAmbientDisplayUsage() {
- long ambientDisplayMs = mStats.getScreenDozeTime(mRawRealtimeUs, mStatsType);
+ long ambientDisplayMs = mStats.getScreenDozeTime(mRawRealtimeUs, mStatsType) / 1000;
double power = mPowerProfile.getAveragePower(PowerProfile.POWER_AMBIENT_DISPLAY)
* ambientDisplayMs / (60 * 60 * 1000);
if (power > 0) {
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 12e5dfe..8443a67 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -27,6 +27,7 @@
<!-- Do not translate. Defines the slots for the right-hand side icons. That is to say, the
icons in the status bar that are not notifications. -->
<string-array name="config_statusBarIcons">
+ <item><xliff:g id="id">@string/status_bar_alarm_clock</xliff:g></item>
<item><xliff:g id="id">@string/status_bar_rotate</xliff:g></item>
<item><xliff:g id="id">@string/status_bar_headset</xliff:g></item>
<item><xliff:g id="id">@string/status_bar_data_saver</xliff:g></item>
@@ -44,7 +45,6 @@
<item><xliff:g id="id">@string/status_bar_phone_evdo_signal</xliff:g></item>
<item><xliff:g id="id">@string/status_bar_phone_signal</xliff:g></item>
<item><xliff:g id="id">@string/status_bar_secure</xliff:g></item>
- <item><xliff:g id="id">@string/status_bar_alarm_clock</xliff:g></item>
<item><xliff:g id="id">@string/status_bar_bluetooth</xliff:g></item>
<item><xliff:g id="id">@string/status_bar_managed_profile</xliff:g></item>
<item><xliff:g id="id">@string/status_bar_cast</xliff:g></item>
diff --git a/media/java/android/media/AudioFormat.java b/media/java/android/media/AudioFormat.java
index f98480b..d0a2c98 100644
--- a/media/java/android/media/AudioFormat.java
+++ b/media/java/android/media/AudioFormat.java
@@ -18,6 +18,7 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;
@@ -437,6 +438,7 @@
* @param mask a combination of the CHANNEL_IN_* definitions, even CHANNEL_IN_DEFAULT
* @return number of channels for the mask
*/
+ @TestApi
public static int channelCountFromInChannelMask(int mask) {
return Integer.bitCount(mask);
}
@@ -446,6 +448,7 @@
* @param mask a combination of the CHANNEL_OUT_* definitions, but not CHANNEL_OUT_DEFAULT
* @return number of channels for the mask
*/
+ @TestApi
public static int channelCountFromOutChannelMask(int mask) {
return Integer.bitCount(mask);
}
@@ -492,6 +495,7 @@
// CHANNEL_IN_ALL is not yet defined; if added then it should match AUDIO_CHANNEL_IN_ALL
/** @hide */
+ @TestApi
public static int getBytesPerSample(int audioFormat)
{
switch (audioFormat) {
@@ -562,6 +566,7 @@
}
/** @hide */
+ @TestApi
public static boolean isEncodingLinearPcm(int audioFormat)
{
switch (audioFormat) {
diff --git a/media/java/android/media/VolumeShaper.java b/media/java/android/media/VolumeShaper.java
index 3068706..b654214 100644
--- a/media/java/android/media/VolumeShaper.java
+++ b/media/java/android/media/VolumeShaper.java
@@ -18,6 +18,7 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;
@@ -843,6 +844,7 @@
* @return the same {@code Builder} instance.
* @throws IllegalArgumentException if flag is not recognized.
*/
+ @TestApi
public @NonNull Builder setOptionFlags(@OptionFlag int optionFlags) {
if ((optionFlags & ~OPTION_FLAG_PUBLIC_ALL) != 0) {
throw new IllegalArgumentException("invalid bits in flag: " + optionFlags);
diff --git a/media/java/android/media/audiofx/AudioEffect.java b/media/java/android/media/audiofx/AudioEffect.java
index 1cb4d67..24c595f 100644
--- a/media/java/android/media/audiofx/AudioEffect.java
+++ b/media/java/android/media/audiofx/AudioEffect.java
@@ -494,6 +494,7 @@
* @return true if the device implements the specified effect type, false otherwise.
* @hide
*/
+ @TestApi
public static boolean isEffectTypeAvailable(UUID type) {
AudioEffect.Descriptor[] desc = AudioEffect.queryEffects();
if (desc == null) {
@@ -546,6 +547,7 @@
* @throws IllegalStateException
* @hide
*/
+ @TestApi
public int setParameter(byte[] param, byte[] value)
throws IllegalStateException {
checkState("setParameter()");
@@ -558,6 +560,7 @@
* @see #setParameter(byte[], byte[])
* @hide
*/
+ @TestApi
public int setParameter(int param, int value) throws IllegalStateException {
byte[] p = intToByteArray(param);
byte[] v = intToByteArray(value);
@@ -571,6 +574,7 @@
* @see #setParameter(byte[], byte[])
* @hide
*/
+ @TestApi
public int setParameter(int param, short value)
throws IllegalStateException {
byte[] p = intToByteArray(param);
@@ -585,6 +589,7 @@
* @see #setParameter(byte[], byte[])
* @hide
*/
+ @TestApi
public int setParameter(int param, byte[] value)
throws IllegalStateException {
byte[] p = intToByteArray(param);
@@ -598,6 +603,7 @@
* @see #setParameter(byte[], byte[])
* @hide
*/
+ @TestApi
public int setParameter(int[] param, int[] value)
throws IllegalStateException {
if (param.length > 2 || value.length > 2) {
@@ -649,6 +655,7 @@
* @see #setParameter(byte[], byte[])
* @hide
*/
+ @TestApi
public int setParameter(int[] param, byte[] value)
throws IllegalStateException {
if (param.length > 2) {
@@ -677,6 +684,7 @@
* @throws IllegalStateException
* @hide
*/
+ @TestApi
public int getParameter(byte[] param, byte[] value)
throws IllegalStateException {
checkState("getParameter()");
@@ -690,6 +698,7 @@
* @see #getParameter(byte[], byte[])
* @hide
*/
+ @TestApi
public int getParameter(int param, byte[] value)
throws IllegalStateException {
byte[] p = intToByteArray(param);
@@ -705,6 +714,7 @@
* In case of success, returns the number of meaningful integers in value array.
* @hide
*/
+ @TestApi
public int getParameter(int param, int[] value)
throws IllegalStateException {
if (value.length > 2) {
@@ -736,6 +746,7 @@
* In case of success, returns the number of meaningful short integers in value array.
* @hide
*/
+ @TestApi
public int getParameter(int param, short[] value)
throws IllegalStateException {
if (value.length > 2) {
@@ -801,6 +812,7 @@
* In case of success, returns the number of meaningful short integers in value array.
* @hide
*/
+ @TestApi
public int getParameter(int[] param, short[] value)
throws IllegalStateException {
if (param.length > 2 || value.length > 2) {
@@ -940,6 +952,7 @@
* @param listener
* @hide
*/
+ @TestApi
public void setParameterListener(OnParameterChangeListener listener) {
synchronized (mListenerLock) {
mParameterChangeListener = listener;
@@ -1001,6 +1014,7 @@
* when a parameter is changed in the effect engine by the controlling application.
* @hide
*/
+ @TestApi
public interface OnParameterChangeListener {
/**
* Called on the listener to notify it that a parameter value has changed.
@@ -1293,6 +1307,7 @@
/**
* @hide
*/
+ @TestApi
public static boolean isError(int status) {
return (status < 0);
}
@@ -1300,6 +1315,7 @@
/**
* @hide
*/
+ @TestApi
public static int byteArrayToInt(byte[] valueBuf) {
return byteArrayToInt(valueBuf, 0);
@@ -1318,6 +1334,7 @@
/**
* @hide
*/
+ @TestApi
public static byte[] intToByteArray(int value) {
ByteBuffer converter = ByteBuffer.allocate(4);
converter.order(ByteOrder.nativeOrder());
@@ -1328,6 +1345,7 @@
/**
* @hide
*/
+ @TestApi
public static short byteArrayToShort(byte[] valueBuf) {
return byteArrayToShort(valueBuf, 0);
}
@@ -1345,6 +1363,7 @@
/**
* @hide
*/
+ @TestApi
public static byte[] shortToByteArray(short value) {
ByteBuffer converter = ByteBuffer.allocate(2);
converter.order(ByteOrder.nativeOrder());
diff --git a/packages/SettingsLib/src/com/android/settingslib/fuelgauge/PowerWhitelistBackend.java b/packages/SettingsLib/src/com/android/settingslib/fuelgauge/PowerWhitelistBackend.java
index 7081678..06e2ee1 100644
--- a/packages/SettingsLib/src/com/android/settingslib/fuelgauge/PowerWhitelistBackend.java
+++ b/packages/SettingsLib/src/com/android/settingslib/fuelgauge/PowerWhitelistBackend.java
@@ -16,6 +16,7 @@
package com.android.settingslib.fuelgauge;
+import android.content.pm.PackageManager;
import android.os.IDeviceIdleController;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -24,6 +25,8 @@
import android.util.ArraySet;
import android.util.Log;
+import com.android.internal.util.ArrayUtils;
+
/**
* Handles getting/changing the whitelist for the exceptions to battery saving features.
*/
@@ -68,6 +71,19 @@
return mSysWhitelistedAppsExceptIdle.contains(pkg);
}
+ public boolean isSysWhitelistedExceptIdle(String[] pkgs) {
+ if (ArrayUtils.isEmpty(pkgs)) {
+ return false;
+ }
+ for (String pkg : pkgs) {
+ if (isSysWhitelistedExceptIdle(pkg)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
public void addApp(String pkg) {
try {
mDeviceIdleService.addPowerSaveWhitelistApp(pkg);
diff --git a/packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java b/packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java
index 8b3da39..de29030 100644
--- a/packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java
+++ b/packages/SettingsLib/src/com/android/settingslib/utils/PowerUtil.java
@@ -144,7 +144,8 @@
FIFTEEN_MINUTES_MILLIS);
// convert the time to a properly formatted string.
- DateFormat fmt = DateFormat.getTimeInstance(DateFormat.SHORT);
+ String skeleton = android.text.format.DateFormat.getTimeFormatString(context);
+ DateFormat fmt = DateFormat.getInstanceForSkeleton(skeleton);
Date date = Date.from(Instant.ofEpochMilli(roundedTimeOfDayMs));
CharSequence timeString = fmt.format(date);
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/fuelgauge/PowerWhitelistBackendTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/fuelgauge/PowerWhitelistBackendTest.java
index 5a123af..f591781 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/fuelgauge/PowerWhitelistBackendTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/fuelgauge/PowerWhitelistBackendTest.java
@@ -92,7 +92,7 @@
}
@Test
- public void testIsSystemWhitelistedExceptIdle() throws Exception {
+ public void testIsSystemWhitelistedExceptIdle_onePackage() throws Exception {
doReturn(new String[]{PACKAGE_TWO}).when(
mDeviceIdleService).getSystemPowerWhitelistExceptIdle();
mPowerWhitelistBackend.refreshList();
@@ -100,4 +100,17 @@
assertThat(mPowerWhitelistBackend.isSysWhitelistedExceptIdle(PACKAGE_ONE)).isFalse();
assertThat(mPowerWhitelistBackend.isSysWhitelistedExceptIdle(PACKAGE_TWO)).isTrue();
}
+
+ @Test
+ public void testIsSystemWhitelistedExceptIdle_packageArray() throws Exception {
+ doReturn(new String[]{PACKAGE_TWO}).when(
+ mDeviceIdleService).getSystemPowerWhitelistExceptIdle();
+ mPowerWhitelistBackend.refreshList();
+
+ final String[] idlePackages = {PACKAGE_ONE, PACKAGE_TWO};
+ final String[] normalPackages = {PACKAGE_ONE};
+
+ assertThat(mPowerWhitelistBackend.isSysWhitelistedExceptIdle(normalPackages)).isFalse();
+ assertThat(mPowerWhitelistBackend.isSysWhitelistedExceptIdle(idlePackages)).isTrue();
+ }
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java
index 05247ba..dfd48cc 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/utils/PowerUtilTest.java
@@ -42,8 +42,8 @@
public static final long THIRTY_HOURS_MILLIS = Duration.ofHours(30).toMillis();
public static final String NORMAL_CASE_EXPECTED_PREFIX = "Should last until about";
public static final String ENHANCED_SUFFIX = " based on your usage";
- // matches a time (ex: '1:15 PM', '2 AM')
- public static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* (AM)|(PM)";
+ // matches a time (ex: '1:15 PM', '2 AM', '23:00')
+ public static final String TIME_OF_DAY_REGEX = " (\\d)+:?(\\d)* ((AM)*)|((PM)*)";
// matches a percentage with parenthesis (ex: '(10%)')
public static final String PERCENTAGE_REGEX = " \\(\\d?\\d%\\)";
diff --git a/packages/SystemUI/res/layout/quick_settings_header_info.xml b/packages/SystemUI/res/layout/quick_settings_header_info.xml
index 5229f9b..54baa4a 100644
--- a/packages/SystemUI/res/layout/quick_settings_header_info.xml
+++ b/packages/SystemUI/res/layout/quick_settings_header_info.xml
@@ -41,13 +41,14 @@
android:visibility="invisible">
<ImageView
- android:id="@+id/ringer_mode_icon"
+ android:id="@+id/next_alarm_icon"
android:layout_width="@dimen/qs_header_alarm_icon_size"
android:layout_height="@dimen/qs_header_alarm_icon_size"
+ android:src="@drawable/stat_sys_alarm"
android:tint="?android:attr/textColorPrimary" />
<TextView
- android:id="@+id/ringer_mode_text"
+ android:id="@+id/next_alarm_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/qs_header_alarm_text_margin_start"
@@ -63,14 +64,13 @@
android:backgroundTint="?android:attr/textColorPrimary" />
<ImageView
- android:id="@+id/next_alarm_icon"
+ android:id="@+id/ringer_mode_icon"
android:layout_width="@dimen/qs_header_alarm_icon_size"
android:layout_height="@dimen/qs_header_alarm_icon_size"
- android:src="@drawable/stat_sys_alarm"
android:tint="?android:attr/textColorPrimary" />
<TextView
- android:id="@+id/next_alarm_text"
+ android:id="@+id/ringer_mode_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/qs_header_alarm_text_margin_start"
diff --git a/packages/SystemUI/res/values/attrs_car.xml b/packages/SystemUI/res/values/attrs_car.xml
index 5e4bd79..335ae44 100644
--- a/packages/SystemUI/res/values/attrs_car.xml
+++ b/packages/SystemUI/res/values/attrs_car.xml
@@ -19,6 +19,8 @@
<declare-styleable name="CarFacetButton">
<!-- icon to be rendered (drawable) -->
<attr name="icon" format="reference"/>
+ <!-- icon to be rendered when in selected state -->
+ <attr name="selectedIcon" format="reference"/>
<!-- intent to start when button is click -->
<attr name="intent" format="string"/>
<!-- intent to start when a long press has happened -->
@@ -45,6 +47,12 @@
<attr name="longIntent" format="string"/>
<!-- start the intent as a broad cast instead of an activity if true-->
<attr name="broadcast" format="boolean"/>
+ <!-- Alpha value to used when in selected state. Defaults 1f -->
+ <attr name="selectedAlpha" format="float" />
+ <!-- Alpha value to used when in un-selected state. Defaults 0.7f -->
+ <attr name="unselectedAlpha" format="float" />
+ <!-- icon to be rendered when in selected state -->
+ <attr name="selectedIcon" format="reference"/>
</declare-styleable>
<!-- Custom attributes to configure hvac values -->
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java
index 5f3e2e3..7285db6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java
@@ -42,6 +42,11 @@
/** App packages that are allowed to be used with this widget */
private String[] mFacetPackages;
private int mIconResourceId;
+ /**
+ * If defined in the xml this will be the icon that's rendered when the button is marked as
+ * selected
+ */
+ private int mSelectedIconResourceId;
private boolean mUseMoreIcon = true;
private float mSelectedAlpha = 1f;
private float mUnselectedAlpha = 1f;
@@ -112,10 +117,9 @@
mIcon.setClickable(false);
mIcon.setAlpha(mUnselectedAlpha);
mIconResourceId = styledAttributes.getResourceId(R.styleable.CarFacetButton_icon, 0);
- if (mIconResourceId == 0) {
- throw new RuntimeException("specified icon resource was not found and is required");
- }
mIcon.setImageResource(mIconResourceId);
+ mSelectedIconResourceId = styledAttributes.getResourceId(
+ R.styleable.CarFacetButton_selectedIcon, mIconResourceId);
mMoreIcon = findViewById(R.id.car_nav_button_more_icon);
mMoreIcon.setClickable(false);
@@ -161,22 +165,10 @@
*/
public void setSelected(boolean selected, boolean showMoreIcon) {
mSelected = selected;
- if (selected) {
- if (mUseMoreIcon) {
- mMoreIcon.setVisibility(showMoreIcon ? VISIBLE : GONE);
- }
- mIcon.setAlpha(mSelectedAlpha);
- } else {
- mMoreIcon.setVisibility(GONE);
- mIcon.setAlpha(mUnselectedAlpha);
- }
- }
-
- public void setIcon(Drawable d) {
- if (d != null) {
- mIcon.setImageDrawable(d);
- } else {
- mIcon.setImageResource(mIconResourceId);
+ mIcon.setAlpha(mSelected ? mSelectedAlpha : mUnselectedAlpha);
+ mIcon.setImageResource(mSelected ? mSelectedIconResourceId : mIconResourceId);
+ if (mUseMoreIcon) {
+ mMoreIcon.setVisibility(showMoreIcon ? VISIBLE : GONE);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java
index e73b173..b2cef16 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarView.java
@@ -25,7 +25,9 @@
import android.widget.TextView;
import com.android.keyguard.AlphaOptimizedImageButton;
+import com.android.systemui.Dependency;
import com.android.systemui.R;
+import com.android.systemui.statusbar.phone.StatusBarIconController;
/**
* A custom navigation bar for the automotive use case.
@@ -52,6 +54,17 @@
if (mNotificationsButton != null) {
mNotificationsButton.setOnClickListener(this::onNotificationsClick);
}
+ View mStatusIcons = findViewById(R.id.statusIcons);
+ if (mStatusIcons != null) {
+ // Attach the controllers for Status icons such as wifi and bluetooth if the standard
+ // container is in the view.
+ StatusBarIconController.DarkIconManager mDarkIconManager =
+ new StatusBarIconController.DarkIconManager(
+ mStatusIcons.findViewById(R.id.statusIcons));
+ mDarkIconManager.setShouldLog(true);
+ Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager);
+ }
+
}
void setStatusBar(CarStatusBar carStatusBar) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java
index 0cdaec1..e248db4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationButton.java
@@ -4,6 +4,7 @@
import android.content.Intent;
import android.content.res.TypedArray;
import android.util.AttributeSet;
+import android.util.Log;
import android.widget.ImageView;
import com.android.systemui.R;
@@ -17,23 +18,34 @@
*/
public class CarNavigationButton extends com.android.keyguard.AlphaOptimizedImageButton {
- private static final float SELECTED_ALPHA = 1;
- private static final float UNSELECTED_ALPHA = 0.7f;
-
+ private static final String TAG = "CarNavigationButton";
private Context mContext;
- private String mIntent = null;
- private String mLongIntent = null;
- private boolean mBroadcastIntent = false;
+ private String mIntent;
+ private String mLongIntent;
+ private boolean mBroadcastIntent;
private boolean mSelected = false;
+ private float mSelectedAlpha;
+ private float mUnselectedAlpha;
+ private int mSelectedIconResourceId;
+ private int mIconResourceId;
public CarNavigationButton(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
- TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CarNavigationButton);
+ TypedArray typedArray = context.obtainStyledAttributes(
+ attrs, R.styleable.CarNavigationButton);
mIntent = typedArray.getString(R.styleable.CarNavigationButton_intent);
mLongIntent = typedArray.getString(R.styleable.CarNavigationButton_longIntent);
mBroadcastIntent = typedArray.getBoolean(R.styleable.CarNavigationButton_broadcast, false);
+ mSelectedAlpha = typedArray.getFloat(
+ R.styleable.CarNavigationButton_selectedAlpha, mSelectedAlpha);
+ mUnselectedAlpha = typedArray.getFloat(
+ R.styleable.CarNavigationButton_unselectedAlpha, mUnselectedAlpha);
+ mIconResourceId = typedArray.getResourceId(
+ com.android.internal.R.styleable.ImageView_src, 0);
+ mSelectedIconResourceId = typedArray.getResourceId(
+ R.styleable.CarNavigationButton_selectedIcon, mIconResourceId);
}
@@ -45,17 +57,20 @@
public void onFinishInflate() {
super.onFinishInflate();
setScaleType(ImageView.ScaleType.CENTER);
- setAlpha(UNSELECTED_ALPHA);
+ setAlpha(mUnselectedAlpha);
try {
if (mIntent != null) {
final Intent intent = Intent.parseUri(mIntent, Intent.URI_INTENT_SCHEME);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
setOnClickListener(v -> {
- if (mBroadcastIntent) {
- mContext.sendBroadcast(intent);
- return;
+ try {
+ if (mBroadcastIntent) {
+ mContext.sendBroadcast(intent);
+ return;
+ }
+ mContext.startActivity(intent);
+ } catch (Exception e) {
+ Log.e(TAG, "Failed to launch intent", e);
}
- mContext.startActivity(intent);
});
}
} catch (URISyntaxException e) {
@@ -65,9 +80,13 @@
try {
if (mLongIntent != null) {
final Intent intent = Intent.parseUri(mLongIntent, Intent.URI_INTENT_SCHEME);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
setOnLongClickListener(v -> {
- mContext.startActivity(intent);
+ try {
+ mContext.startActivity(intent);
+ } catch (Exception e) {
+ Log.e(TAG, "Failed to launch intent", e);
+ }
+ // consume event either way
return true;
});
}
@@ -82,6 +101,7 @@
public void setSelected(boolean selected) {
super.setSelected(selected);
mSelected = selected;
- setAlpha(mSelected ? SELECTED_ALPHA : UNSELECTED_ALPHA);
+ setAlpha(mSelected ? mSelectedAlpha : mUnselectedAlpha);
+ setImageResource(mSelected ? mSelectedIconResourceId : mIconResourceId);
}
}
diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto
index 934ad88..e05416e 100644
--- a/proto/src/wifi.proto
+++ b/proto/src/wifi.proto
@@ -1271,9 +1271,16 @@
// Start time of session in milliseconds.
optional int64 start_time_millis = 1;
- // The number of networks the lock was initialized with at start.
+ // The number of networks the lock was provided with at start.
optional int32 locked_networks_at_start = 2;
+ // The number of networks in the lock at the time of the initialize event. Only valid if
+ // initialize_event is recorded.
+ optional int32 locked_networks_at_initialize = 6;
+
+ // Event for fully initializing the WakeupLock (i.e. WakeupLock is "locked").
+ optional Event initialize_event = 7;
+
// Event for unlocking the WakeupLock. Does not occur if lock was initialized with 0 networks.
optional Event unlock_event = 3;
@@ -1289,4 +1296,10 @@
// Session information for every Wifi Wake session (up to a maximum of 10).
repeated Session sessions = 2;
+
+ // Number of ignored calls to start (due to WakeupController already being active).
+ optional int32 num_ignored_starts = 3;
+
+ // Number of Wifi Wake sessions that have recorded wakeup events.
+ optional int32 num_wakeups = 4;
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 5e71be5..75bad46 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -12959,9 +12959,13 @@
} catch (RemoteException exc) {
// Ignore.
}
+ return isBackgroundRestrictedNoCheck(callingUid, packageName);
+ }
+
+ boolean isBackgroundRestrictedNoCheck(final int uid, final String packageName) {
final int mode = mAppOpsService.checkOperation(AppOpsManager.OP_RUN_ANY_IN_BACKGROUND,
- callingUid, packageName);
- return (mode != AppOpsManager.MODE_ALLOWED);
+ uid, packageName);
+ return mode != AppOpsManager.MODE_ALLOWED;
}
@Override
@@ -21056,6 +21060,7 @@
}
}
+ final String action = intent.getAction();
BroadcastOptions brOptions = null;
if (bOptions != null) {
brOptions = new BroadcastOptions(bOptions);
@@ -21076,11 +21081,16 @@
throw new SecurityException(msg);
}
}
+ if (brOptions.isDontSendToRestrictedApps()
+ && isBackgroundRestrictedNoCheck(callingUid, callerPackage)) {
+ Slog.i(TAG, "Not sending broadcast " + action + " - app " + callerPackage
+ + " has background restrictions");
+ return ActivityManager.START_CANCELED;
+ }
}
// Verify that protected broadcasts are only being sent by system code,
// and that system code is only sending protected broadcasts.
- final String action = intent.getAction();
final boolean isProtectedBroadcast;
try {
isProtectedBroadcast = AppGlobals.getPackageManager().isProtectedBroadcast(action);
diff --git a/services/core/java/com/android/server/display/ColorDisplayService.java b/services/core/java/com/android/server/display/ColorDisplayService.java
index b3d309d..37035c3 100644
--- a/services/core/java/com/android/server/display/ColorDisplayService.java
+++ b/services/core/java/com/android/server/display/ColorDisplayService.java
@@ -300,6 +300,11 @@
dtm.setColorMode(mode, mIsActivated ? mMatrixNight : MATRIX_IDENTITY);
}
+ @Override
+ public void onAccessibilityTransformChanged(boolean state) {
+ onDisplayColorModeChanged(mController.getColorMode());
+ }
+
/**
* Set coefficients based on native mode. Use DisplayTransformManager#isNativeModeEnabled while
* setting is stable; when setting is changing, pass native mode selection directly.
diff --git a/services/tests/servicestests/src/com/android/server/ColorDisplayServiceTest.java b/services/tests/servicestests/src/com/android/server/ColorDisplayServiceTest.java
index 46b364c..43701e9 100644
--- a/services/tests/servicestests/src/com/android/server/ColorDisplayServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/ColorDisplayServiceTest.java
@@ -25,6 +25,7 @@
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Secure;
+import android.provider.Settings.System;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.test.mock.MockContentResolver;
@@ -895,6 +896,52 @@
assertActivated(true /* activated */);
}
+ @Test
+ public void accessibility_colorInversion_transformActivated() {
+ setAccessibilityColorInversion(true);
+ setColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+
+ startService();
+ assertAccessibilityTransformActivated(true /* activated */ );
+ assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED);
+ }
+
+ @Test
+ public void accessibility_colorCorrection_transformActivated() {
+ setAccessibilityColorCorrection(true);
+ setColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+
+ startService();
+ assertAccessibilityTransformActivated(true /* activated */ );
+ assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED);
+ }
+
+ @Test
+ public void accessibility_all_transformActivated() {
+ setAccessibilityColorCorrection(true);
+ setAccessibilityColorInversion(true);
+ setColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+
+ startService();
+ assertAccessibilityTransformActivated(true /* activated */ );
+ assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED);
+ }
+
+ @Test
+ public void accessibility_none_transformActivated() {
+ setAccessibilityColorCorrection(false);
+ setAccessibilityColorInversion(false);
+ setColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+
+ startService();
+ assertAccessibilityTransformActivated(false /* activated */ );
+ assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ assertActiveColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ }
+
/**
* Configures Night display to use a custom schedule.
*
@@ -935,6 +982,35 @@
}
/**
+ * Configures the Accessibility color correction setting state.
+ *
+ * @param state {@code true} if color inversion should be activated
+ */
+ private void setAccessibilityColorCorrection(boolean state) {
+ Secure.putIntForUser(mContext.getContentResolver(),
+ Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, state ? 1 : 0, mUserId);
+ }
+
+ /**
+ * Configures the Accessibility color inversion setting state.
+ *
+ * @param state {@code true} if color inversion should be activated
+ */
+ private void setAccessibilityColorInversion(boolean state) {
+ Secure.putIntForUser(mContext.getContentResolver(),
+ Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, state ? 1 : 0, mUserId);
+ }
+
+ /**
+ * Configures color mode via ColorDisplayController.
+ *
+ * @param mode the color mode to set
+ */
+ private void setColorMode(int mode) {
+ mColorDisplayController.setColorMode(mode);
+ }
+
+ /**
* Convenience method to start {@link #mColorDisplayService}.
*/
private void startService() {
@@ -962,6 +1038,41 @@
}
/**
+ * Convenience method for asserting that Accessibility color transform is detected.
+ *
+ * @param state {@code true} if any Accessibility transform should be activated
+ */
+ private void assertAccessibilityTransformActivated(boolean state) {
+ assertWithMessage("Unexpected Accessibility color transform state")
+ .that(mColorDisplayController.getAccessibilityTransformActivated())
+ .isEqualTo(state);
+ }
+
+ /**
+ * Convenience method for asserting that the active color mode matches expectation.
+ *
+ * @param mode the expected active color mode.
+ */
+ private void assertActiveColorMode(int mode) {
+ assertWithMessage("Unexpected color mode setting")
+ .that(mColorDisplayController.getColorMode())
+ .isEqualTo(mode);
+ }
+
+ /**
+ * Convenience method for asserting that the user chosen color mode matches expectation.
+ *
+ * @param mode the expected color mode setting.
+ */
+ private void assertUserColorMode(int mode) {
+ final int actualMode = System.getIntForUser(mContext.getContentResolver(),
+ System.DISPLAY_COLOR_MODE, -1, mUserId);
+ assertWithMessage("Unexpected color mode setting")
+ .that(actualMode)
+ .isEqualTo(mode);
+ }
+
+ /**
* Convenience for making a {@link LocalTime} instance with an offset relative to now.
*
* @param offsetMinutes the offset relative to now (in minutes)
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index e971d08..fa7988d 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -977,11 +977,13 @@
}
/** @hide */
+ @TestApi
public void setCellBandwidths(int[] bandwidths) {
mCellBandwidths = bandwidths;
}
/** @hide */
+ @TestApi
public void setChannelNumber(int channelNumber) {
mChannelNumber = channelNumber;
}
@@ -1172,6 +1174,7 @@
}
/** @hide */
+ @TestApi
public void setRilVoiceRadioTechnology(int rt) {
if (rt == RIL_RADIO_TECHNOLOGY_LTE_CA) {
rt = RIL_RADIO_TECHNOLOGY_LTE;
@@ -1181,6 +1184,7 @@
}
/** @hide */
+ @TestApi
public void setRilDataRadioTechnology(int rt) {
if (rt == RIL_RADIO_TECHNOLOGY_LTE_CA) {
rt = RIL_RADIO_TECHNOLOGY_LTE;
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index b77b1ad..1a79a76 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -28,10 +28,12 @@
import android.net.wifi.WifiInfo;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.SystemClock;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.BackupUtils;
import android.util.Log;
+import android.util.TimeUtils;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
@@ -1620,8 +1622,9 @@
}
if (mNetworkSelectionStatus.getConnectChoice() != null) {
sbuf.append(" connect choice: ").append(mNetworkSelectionStatus.getConnectChoice());
- sbuf.append(" connect choice set time: ").append(mNetworkSelectionStatus
- .getConnectChoiceTimestamp());
+ sbuf.append(" connect choice set time: ")
+ .append(TimeUtils.logTimeOfDay(
+ mNetworkSelectionStatus.getConnectChoiceTimestamp()));
}
sbuf.append(" hasEverConnected: ")
.append(mNetworkSelectionStatus.getHasEverConnected()).append("\n");
@@ -1724,7 +1727,7 @@
sbuf.append(" networkSelectionBSSID="
+ mNetworkSelectionStatus.getNetworkSelectionBSSID());
}
- long now_ms = System.currentTimeMillis();
+ long now_ms = SystemClock.elapsedRealtime();
if (mNetworkSelectionStatus.getDisableTime() != NetworkSelectionStatus
.INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP) {
sbuf.append('\n');
@@ -1746,12 +1749,8 @@
if (this.lastConnected != 0) {
sbuf.append('\n');
- long diff = now_ms - this.lastConnected;
- if (diff <= 0) {
- sbuf.append("lastConnected since <incorrect>");
- } else {
- sbuf.append("lastConnected: ").append(Long.toString(diff / 1000)).append("sec ");
- }
+ sbuf.append("lastConnected: ").append(TimeUtils.logTimeOfDay(this.lastConnected));
+ sbuf.append(" ");
}
if (this.lastConnectionFailure != 0) {
sbuf.append('\n');