Merge "Import translations. DO NOT MERGE" into nyc-mr1-dev
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 4acb729..1b9e2aa 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -546,6 +546,20 @@
*/
public abstract long getTimeAtCpuSpeed(int cluster, int step, int which);
+ /**
+ * Returns the number of times this UID woke up the Application Processor to
+ * process a mobile radio packet.
+ * @param which one of STATS_SINCE_CHARGED, STATS_SINCE_UNPLUGGED, or STATS_CURRENT.
+ */
+ public abstract long getMobileRadioApWakeupCount(int which);
+
+ /**
+ * Returns the number of times this UID woke up the Application Processor to
+ * process a WiFi packet.
+ * @param which one of STATS_SINCE_CHARGED, STATS_SINCE_UNPLUGGED, or STATS_CURRENT.
+ */
+ public abstract long getWifiRadioApWakeupCount(int which);
+
public static abstract class Sensor {
/*
* FIXME: it's not correct to use this magic value because it
@@ -1285,9 +1299,12 @@
public static final int EVENT_TEMP_WHITELIST = 0x0011;
// Event for the screen waking up.
public static final int EVENT_SCREEN_WAKE_UP = 0x0012;
+ // Event for the UID that woke up the application processor.
+ // Used for wakeups coming from WiFi, modem, etc.
+ public static final int EVENT_WAKEUP_AP = 0x0013;
// Number of event types.
- public static final int EVENT_COUNT = 0x0013;
+ public static final int EVENT_COUNT = 0x0014;
// Mask to extract out only the type part of the event.
public static final int EVENT_TYPE_MASK = ~(EVENT_FLAG_START|EVENT_FLAG_FINISH);
@@ -1979,13 +1996,13 @@
public static final String[] HISTORY_EVENT_NAMES = new String[] {
"null", "proc", "fg", "top", "sync", "wake_lock_in", "job", "user", "userfg", "conn",
"active", "pkginst", "pkgunin", "alarm", "stats", "inactive", "active", "tmpwhitelist",
- "screenwake",
+ "screenwake", "wakeupap"
};
public static final String[] HISTORY_EVENT_CHECKIN_NAMES = new String[] {
"Enl", "Epr", "Efg", "Etp", "Esy", "Ewl", "Ejb", "Eur", "Euf", "Ecn",
"Eac", "Epi", "Epu", "Eal", "Est", "Eai", "Eaa", "Etw",
- "Esw",
+ "Esw", "Ewa"
};
/**
@@ -3105,20 +3122,22 @@
final long mobilePacketsTx = u.getNetworkActivityPackets(NETWORK_MOBILE_TX_DATA, which);
final long mobileActiveTime = u.getMobileRadioActiveTime(which);
final int mobileActiveCount = u.getMobileRadioActiveCount(which);
+ final long mobileWakeup = u.getMobileRadioApWakeupCount(which);
final long wifiPacketsRx = u.getNetworkActivityPackets(NETWORK_WIFI_RX_DATA, which);
final long wifiPacketsTx = u.getNetworkActivityPackets(NETWORK_WIFI_TX_DATA, which);
+ final long wifiWakeup = u.getWifiRadioApWakeupCount(which);
final long btBytesRx = u.getNetworkActivityBytes(NETWORK_BT_RX_DATA, which);
final long btBytesTx = u.getNetworkActivityBytes(NETWORK_BT_TX_DATA, which);
if (mobileBytesRx > 0 || mobileBytesTx > 0 || wifiBytesRx > 0 || wifiBytesTx > 0
|| mobilePacketsRx > 0 || mobilePacketsTx > 0 || wifiPacketsRx > 0
|| wifiPacketsTx > 0 || mobileActiveTime > 0 || mobileActiveCount > 0
- || btBytesRx > 0 || btBytesTx > 0) {
+ || btBytesRx > 0 || btBytesTx > 0 || mobileWakeup > 0 || wifiWakeup > 0) {
dumpLine(pw, uid, category, NETWORK_DATA, mobileBytesRx, mobileBytesTx,
wifiBytesRx, wifiBytesTx,
mobilePacketsRx, mobilePacketsTx,
wifiPacketsRx, wifiPacketsTx,
mobileActiveTime, mobileActiveCount,
- btBytesRx, btBytesTx);
+ btBytesRx, btBytesTx, mobileWakeup, wifiWakeup);
}
// Dump modem controller data, per UID.
@@ -4125,6 +4144,9 @@
final int wifiScanCount = u.getWifiScanCount(which);
final long uidWifiRunningTime = u.getWifiRunningTime(rawRealtime, which);
+ final long mobileWakeup = u.getMobileRadioApWakeupCount(which);
+ final long wifiWakeup = u.getWifiRadioApWakeupCount(which);
+
if (mobileRxBytes > 0 || mobileTxBytes > 0
|| mobileRxPackets > 0 || mobileTxPackets > 0) {
pw.print(prefix); pw.print(" Mobile network: ");
@@ -4150,6 +4172,14 @@
pw.println(sb.toString());
}
+ if (mobileWakeup > 0) {
+ sb.setLength(0);
+ sb.append(prefix);
+ sb.append(" Mobile radio AP wakeups: ");
+ sb.append(mobileWakeup);
+ pw.println(sb.toString());
+ }
+
printControllerActivityIfInteresting(pw, sb, prefix + " ", "Modem",
u.getModemControllerActivity(), which);
@@ -4181,6 +4211,14 @@
pw.println(sb.toString());
}
+ if (wifiWakeup > 0) {
+ sb.setLength(0);
+ sb.append(prefix);
+ sb.append(" WiFi AP wakeups: ");
+ sb.append(wifiWakeup);
+ pw.println(sb.toString());
+ }
+
printControllerActivityIfInteresting(pw, sb, prefix + " ", "WiFi",
u.getWifiControllerActivity(), which);
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 3eb2ac3..7242043 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6173,44 +6173,6 @@
public static final String NIGHT_DISPLAY_CUSTOM_END_TIME = "night_display_custom_end_time";
/**
- * Behavior of twilight on the device.
- * One of {@link #TWILIGHT_MODE_LOCKED_OFF}, {@link #TWILIGHT_MODE_LOCKED_ON}
- * or {@link #TWILIGHT_MODE_AUTO}.
- * @hide
- */
- public static final String TWILIGHT_MODE = "twilight_mode";
-
- /**
- * Twilight mode always off.
- * @hide
- */
- public static final int TWILIGHT_MODE_LOCKED_OFF = 0;
-
- /**
- * Twilight mode always on.
- * @hide
- */
- public static final int TWILIGHT_MODE_LOCKED_ON = 1;
-
- /**
- * Twilight mode auto.
- * @hide
- */
- public static final int TWILIGHT_MODE_AUTO = 2;
-
- /**
- * Twilight mode auto, temporarily overriden to on.
- * @hide
- */
- public static final int TWILIGHT_MODE_AUTO_OVERRIDE_OFF = 3;
-
- /**
- * Twilight mode auto, temporarily overriden to off.
- * @hide
- */
- public static final int TWILIGHT_MODE_AUTO_OVERRIDE_ON = 4;
-
- /**
* Whether brightness should automatically adjust based on twilight state.
* @hide
*/
diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl
index 216a4f1..ca69746 100644
--- a/core/java/com/android/internal/app/IBatteryStats.aidl
+++ b/core/java/com/android/internal/app/IBatteryStats.aidl
@@ -118,7 +118,7 @@
void noteWifiBatchedScanStoppedFromSource(in WorkSource ws);
void noteWifiMulticastEnabledFromSource(in WorkSource ws);
void noteWifiMulticastDisabledFromSource(in WorkSource ws);
- void noteWifiRadioPowerState(int powerState, long timestampNs);
+ void noteWifiRadioPowerState(int powerState, long timestampNs, int uid);
void noteNetworkInterfaceType(String iface, int type);
void noteNetworkStatsEnabled();
void noteDeviceIdleMode(int mode, String activeReason, int activeUid);
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index a1df8c1..11c1de1 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -108,7 +108,7 @@
private static final int MAGIC = 0xBA757475; // 'BATSTATS'
// Current on-disk Parcel version
- private static final int VERSION = 147 + (USE_OLD_HISTORY ? 1000 : 0);
+ private static final int VERSION = 148 + (USE_OLD_HISTORY ? 1000 : 0);
// Maximum number of items we will record in the history.
private static final int MAX_HISTORY_ITEMS = 2000;
@@ -3554,6 +3554,14 @@
mNumConnectivityChange++;
}
+ private void noteMobileRadioApWakeupLocked(final long elapsedRealtimeMillis,
+ final long uptimeMillis, int uid) {
+ uid = mapUid(uid);
+ addHistoryEventLocked(elapsedRealtimeMillis, uptimeMillis, HistoryItem.EVENT_WAKEUP_AP, "",
+ uid);
+ getUidStatsLocked(uid).noteMobileRadioApWakeupLocked();
+ }
+
public void noteMobileRadioPowerState(int powerState, long timestampNs, int uid) {
final long elapsedRealtime = mClocks.elapsedRealtime();
final long uptime = mClocks.uptimeMillis();
@@ -3563,6 +3571,10 @@
powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_MEDIUM
|| powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH;
if (active) {
+ if (uid > 0) {
+ noteMobileRadioApWakeupLocked(elapsedRealtime, uptime, uid);
+ }
+
mMobileRadioActiveStartTime = realElapsedRealtimeMs = timestampNs / (1000 * 1000);
mHistoryCur.states |= HistoryItem.STATE_MOBILE_RADIO_ACTIVE_FLAG;
} else {
@@ -4239,7 +4251,15 @@
}
}
- public void noteWifiRadioPowerState(int powerState, long timestampNs) {
+ private void noteWifiRadioApWakeupLocked(final long elapsedRealtimeMillis,
+ final long uptimeMillis, int uid) {
+ uid = mapUid(uid);
+ addHistoryEventLocked(elapsedRealtimeMillis, uptimeMillis, HistoryItem.EVENT_WAKEUP_AP, "",
+ uid);
+ getUidStatsLocked(uid).noteWifiRadioApWakeupLocked();
+ }
+
+ public void noteWifiRadioPowerState(int powerState, long timestampNs, int uid) {
final long elapsedRealtime = mClocks.elapsedRealtime();
final long uptime = mClocks.uptimeMillis();
if (mWifiRadioPowerState != powerState) {
@@ -4247,6 +4267,9 @@
powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_MEDIUM
|| powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH;
if (active) {
+ if (uid > 0) {
+ noteWifiRadioApWakeupLocked(elapsedRealtime, uptime, uid);
+ }
mHistoryCur.states |= HistoryItem.STATE_WIFI_RADIO_ACTIVE_FLAG;
} else {
mHistoryCur.states &= ~HistoryItem.STATE_WIFI_RADIO_ACTIVE_FLAG;
@@ -4874,6 +4897,33 @@
return mUidStats;
}
+ private static void detachTimerIfNotNull(BatteryStatsImpl.Timer timer) {
+ if (timer != null) {
+ timer.detach();
+ }
+ }
+
+ private static boolean resetTimerIfNotNull(BatteryStatsImpl.Timer timer,
+ boolean detachIfReset) {
+ if (timer != null) {
+ return timer.reset(detachIfReset);
+ }
+ return true;
+ }
+
+ private static void detachLongCounterIfNotNull(LongSamplingCounter counter) {
+ if (counter != null) {
+ counter.detach();
+ }
+ }
+
+ private static void resetLongCounterIfNotNull(LongSamplingCounter counter,
+ boolean detachIfReset) {
+ if (counter != null) {
+ counter.reset(detachIfReset);
+ }
+ }
+
/**
* The statistics associated with a particular uid.
*/
@@ -4921,6 +4971,16 @@
LongSamplingCounter mMobileRadioActiveCount;
/**
+ * How many times this UID woke up the Application Processor due to a Mobile radio packet.
+ */
+ private LongSamplingCounter mMobileRadioApWakeupCount;
+
+ /**
+ * How many times this UID woke up the Application Processor due to a Wifi packet.
+ */
+ private LongSamplingCounter mWifiRadioApWakeupCount;
+
+ /**
* The amount of time this uid has kept the WiFi controller in idle, tx, and rx mode.
* Can be null if the UID has had no such activity.
*/
@@ -5629,6 +5689,36 @@
return 0;
}
+ public void noteMobileRadioApWakeupLocked() {
+ if (mMobileRadioApWakeupCount == null) {
+ mMobileRadioApWakeupCount = new LongSamplingCounter(mBsi.mOnBatteryTimeBase);
+ }
+ mMobileRadioApWakeupCount.addCountLocked(1);
+ }
+
+ @Override
+ public long getMobileRadioApWakeupCount(int which) {
+ if (mMobileRadioApWakeupCount != null) {
+ return mMobileRadioApWakeupCount.getCountLocked(which);
+ }
+ return 0;
+ }
+
+ public void noteWifiRadioApWakeupLocked() {
+ if (mWifiRadioApWakeupCount == null) {
+ mWifiRadioApWakeupCount = new LongSamplingCounter(mBsi.mOnBatteryTimeBase);
+ }
+ mWifiRadioApWakeupCount.addCountLocked(1);
+ }
+
+ @Override
+ public long getWifiRadioApWakeupCount(int which) {
+ if (mWifiRadioApWakeupCount != null) {
+ return mWifiRadioApWakeupCount.getCountLocked(which);
+ }
+ return 0;
+ }
+
void initNetworkActivityLocked() {
mNetworkByteActivityCounters = new LongSamplingCounter[NUM_NETWORK_ACTIVITY_TYPES];
mNetworkPacketActivityCounters = new LongSamplingCounter[NUM_NETWORK_ACTIVITY_TYPES];
@@ -5671,24 +5761,14 @@
active |= !mWifiMulticastTimer.reset(false);
active |= mWifiMulticastEnabled;
}
- if (mAudioTurnedOnTimer != null) {
- active |= !mAudioTurnedOnTimer.reset(false);
- }
- if (mVideoTurnedOnTimer != null) {
- active |= !mVideoTurnedOnTimer.reset(false);
- }
- if (mFlashlightTurnedOnTimer != null) {
- active |= !mFlashlightTurnedOnTimer.reset(false);
- }
- if (mCameraTurnedOnTimer != null) {
- active |= !mCameraTurnedOnTimer.reset(false);
- }
- if (mForegroundActivityTimer != null) {
- active |= !mForegroundActivityTimer.reset(false);
- }
- if (mBluetoothScanTimer != null) {
- active |= !mBluetoothScanTimer.reset(false);
- }
+
+ active |= !resetTimerIfNotNull(mAudioTurnedOnTimer, false);
+ active |= !resetTimerIfNotNull(mVideoTurnedOnTimer, false);
+ active |= !resetTimerIfNotNull(mFlashlightTurnedOnTimer, false);
+ active |= !resetTimerIfNotNull(mCameraTurnedOnTimer, false);
+ active |= !resetTimerIfNotNull(mForegroundActivityTimer, false);
+ active |= !resetTimerIfNotNull(mBluetoothScanTimer, false);
+
if (mProcessStateTimer != null) {
for (int i = 0; i < NUM_PROCESS_STATE; i++) {
if (mProcessStateTimer[i] != null) {
@@ -5749,6 +5829,9 @@
}
}
+ resetLongCounterIfNotNull(mMobileRadioApWakeupCount, false);
+ resetLongCounterIfNotNull(mWifiRadioApWakeupCount, false);
+
final ArrayMap<String, Wakelock> wakeStats = mWakelockStats.getMap();
for (int iw=wakeStats.size()-1; iw>=0; iw--) {
Wakelock wl = wakeStats.valueAt(iw);
@@ -5908,6 +5991,9 @@
}
}
}
+
+ detachLongCounterIfNotNull(mMobileRadioApWakeupCount);
+ detachLongCounterIfNotNull(mWifiRadioApWakeupCount);
}
return !active;
@@ -6114,6 +6200,20 @@
} else {
out.writeInt(0);
}
+
+ if (mMobileRadioApWakeupCount != null) {
+ out.writeInt(1);
+ mMobileRadioApWakeupCount.writeToParcel(out);
+ } else {
+ out.writeInt(0);
+ }
+
+ if (mWifiRadioApWakeupCount != null) {
+ out.writeInt(1);
+ mWifiRadioApWakeupCount.writeToParcel(out);
+ } else {
+ out.writeInt(0);
+ }
}
void readFromParcelLocked(TimeBase timeBase, TimeBase screenOffTimeBase, Parcel in) {
@@ -6338,6 +6438,18 @@
} else {
mCpuClusterSpeed = null;
}
+
+ if (in.readInt() != 0) {
+ mMobileRadioApWakeupCount = new LongSamplingCounter(mBsi.mOnBatteryTimeBase, in);
+ } else {
+ mMobileRadioApWakeupCount = null;
+ }
+
+ if (in.readInt() != 0) {
+ mWifiRadioApWakeupCount = new LongSamplingCounter(mBsi.mOnBatteryTimeBase, in);
+ } else {
+ mWifiRadioApWakeupCount = null;
+ }
}
/**
@@ -10348,6 +10460,20 @@
u.mCpuClusterSpeed = null;
}
+ if (in.readInt() != 0) {
+ u.mMobileRadioApWakeupCount = new LongSamplingCounter(mOnBatteryTimeBase);
+ u.mMobileRadioApWakeupCount.readSummaryFromParcelLocked(in);
+ } else {
+ u.mMobileRadioApWakeupCount = null;
+ }
+
+ if (in.readInt() != 0) {
+ u.mWifiRadioApWakeupCount = new LongSamplingCounter(mOnBatteryTimeBase);
+ u.mWifiRadioApWakeupCount.readSummaryFromParcelLocked(in);
+ } else {
+ u.mWifiRadioApWakeupCount = null;
+ }
+
int NW = in.readInt();
if (NW > 100) {
throw new ParcelFormatException("File corrupt: too many wake locks " + NW);
@@ -10708,6 +10834,20 @@
out.writeInt(0);
}
+ if (u.mMobileRadioApWakeupCount != null) {
+ out.writeInt(1);
+ u.mMobileRadioApWakeupCount.writeSummaryFromParcelLocked(out);
+ } else {
+ out.writeInt(0);
+ }
+
+ if (u.mWifiRadioApWakeupCount != null) {
+ out.writeInt(1);
+ u.mWifiRadioApWakeupCount.writeSummaryFromParcelLocked(out);
+ } else {
+ out.writeInt(0);
+ }
+
final ArrayMap<String, Uid.Wakelock> wakeStats = u.mWakelockStats.getMap();
int NW = wakeStats.size();
out.writeInt(NW);
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 0059d4d..d3792ad 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -371,7 +371,7 @@
return false;
}
} catch (RemoteException re) {
- return true;
+ return false;
}
}
@@ -464,7 +464,7 @@
return false;
}
} catch (RemoteException re) {
- return true;
+ return false;
}
}
diff --git a/core/jni/android_hardware_camera2_CameraMetadata.cpp b/core/jni/android_hardware_camera2_CameraMetadata.cpp
index f37fd78..48f6b49 100644
--- a/core/jni/android_hardware_camera2_CameraMetadata.cpp
+++ b/core/jni/android_hardware_camera2_CameraMetadata.cpp
@@ -787,109 +787,16 @@
// exception thrown by ScopedUtfChars
return 0;
}
- size_t keyLength = strlen(key);
-
ALOGV("%s (key = '%s')", __FUNCTION__, key);
- sp<VendorTagDescriptor> vTags = VendorTagDescriptor::getGlobalVendorTagDescriptor();
-
- SortedVector<String8> vendorSections;
- size_t vendorSectionCount = 0;
-
- if (vTags != NULL) {
- vendorSections = vTags->getAllSectionNames();
- vendorSectionCount = vendorSections.size();
- }
-
- // First, find the section by the longest string match
- const char *section = NULL;
- size_t sectionIndex = 0;
- size_t sectionLength = 0;
- size_t totalSectionCount = ANDROID_SECTION_COUNT + vendorSectionCount;
- for (size_t i = 0; i < totalSectionCount; ++i) {
-
- const char *str = (i < ANDROID_SECTION_COUNT) ? camera_metadata_section_names[i] :
- vendorSections[i - ANDROID_SECTION_COUNT].string();
- if (kIsDebug) {
- ALOGV("%s: Trying to match against section '%s'", __FUNCTION__, str);
- }
- if (strstr(key, str) == key) { // key begins with the section name
- size_t strLength = strlen(str);
-
- if (kIsDebug) {
- ALOGV("%s: Key begins with section name", __FUNCTION__);
- }
-
- // section name is the longest we've found so far
- if (section == NULL || sectionLength < strLength) {
- section = str;
- sectionIndex = i;
- sectionLength = strLength;
-
- if (kIsDebug) {
- ALOGV("%s: Found new best section (%s)", __FUNCTION__, section);
- }
- }
- }
- }
-
- // TODO: Make above get_camera_metadata_section_from_name ?
-
- if (section == NULL) {
- jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
- "Could not find section name for key '%s')", key);
- return 0;
- } else {
- ALOGV("%s: Found matched section '%s' (%zu)",
- __FUNCTION__, section, sectionIndex);
- }
-
- // Get the tag name component of the key
- const char *keyTagName = key + sectionLength + 1; // x.y.z -> z
- if (sectionLength + 1 >= keyLength) {
- jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
- "Key length too short for key '%s')", key);
- return 0;
- }
-
- // Match rest of name against the tag names in that section only
uint32_t tag = 0;
- if (sectionIndex < ANDROID_SECTION_COUNT) {
- // Match built-in tags (typically android.*)
- uint32_t tagBegin, tagEnd; // [tagBegin, tagEnd)
- tagBegin = camera_metadata_section_bounds[sectionIndex][0];
- tagEnd = camera_metadata_section_bounds[sectionIndex][1];
-
- for (tag = tagBegin; tag < tagEnd; ++tag) {
- const char *tagName = get_camera_metadata_tag_name(tag);
-
- if (strcmp(keyTagName, tagName) == 0) {
- ALOGV("%s: Found matched tag '%s' (%d)",
- __FUNCTION__, tagName, tag);
- break;
- }
- }
-
- if (tag == tagEnd) {
- jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
- "Could not find tag name for key '%s')", key);
- return 0;
- }
- } else if (vTags != NULL) {
- // Match vendor tags (typically com.*)
- const String8 sectionName(section);
- const String8 tagName(keyTagName);
-
- status_t res = OK;
- if ((res = vTags->lookupTag(tagName, sectionName, &tag)) != OK) {
- jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
- "%s: No vendor tag matches key '%s'", __FUNCTION__, key);
- return 0;
- }
+ sp<VendorTagDescriptor> vTags =
+ VendorTagDescriptor::getGlobalVendorTagDescriptor();
+ status_t res = CameraMetadata::getTagFromName(key, vTags.get(), &tag);
+ if (res != OK) {
+ jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
+ "Could not find tag for key '%s')", key);
}
-
- // TODO: Make above get_camera_metadata_tag_from_name ?
-
return tag;
}
diff --git a/docs/html-intl/intl/es/preview/download.jd b/docs/html-intl/intl/es/preview/download.jd
index 4662d5b..6fa9a6a 100644
--- a/docs/html-intl/intl/es/preview/download.jd
+++ b/docs/html-intl/intl/es/preview/download.jd
@@ -370,13 +370,6 @@
</td>
</tr>
- <tr id="xperia">
- <td>Sony Xperia Z3 <br> (D6603 and D6653)</td>
- <td>Descarga: <a class="external-link" href="http://support.sonymobile.com/xperiaz3/tools/xperia-companion/">Xperia Companion</a><br>
- Para más información, visita la sección <a class="external-link" href="https://developer.sony.com/develop/smartphones-and-tablets/android-n-developer-preview/">Prueba la Android N Developer Preview en Xperia Z3</a>.
- </td>
- </tr>
-
</table>
<h3 id="revertDevice">Desinstalar la Preview de un dispositivo</h3>
diff --git a/docs/html-intl/intl/in/preview/download.jd b/docs/html-intl/intl/in/preview/download.jd
index abf911d..e6714bb 100644
--- a/docs/html-intl/intl/in/preview/download.jd
+++ b/docs/html-intl/intl/in/preview/download.jd
@@ -370,13 +370,6 @@
</td>
</tr>
- <tr id="xperia">
- <td>Sony Xperia Z3 <br> (D6603 dan D6653)</td>
- <td>Unduh: <a class="external-link" href="http://support.sonymobile.com/xperiaz3/tools/xperia-companion/">Xperia Companion</a><br>
- Untuk informasi selengkapnya, lihat<a class="external-link" href="https://developer.sony.com/develop/smartphones-and-tablets/android-n-developer-preview/">Coba Android N Developer Preview untuk Xperia Z3</a>.
- </td>
- </tr>
-
</table>
<h3 id="revertDevice">Mencopot pemasangan Pratinjau dari perangkat</h3>
diff --git a/docs/html-intl/intl/ja/preview/download.jd b/docs/html-intl/intl/ja/preview/download.jd
index 705a90b..52f7ae4 100644
--- a/docs/html-intl/intl/ja/preview/download.jd
+++ b/docs/html-intl/intl/ja/preview/download.jd
@@ -370,13 +370,6 @@
</td>
</tr>
- <tr id="xperia">
- <td>Sony Xperia Z3 <br> (D6603 および D6653)</td>
- <td>ダウンロード:<a class="external-link" href="http://support.sonymobile.com/xperiaz3/tools/xperia-companion/">Xperia Companion</a><br>
- 詳細については、<a class="external-link" href="https://developer.sony.com/develop/smartphones-and-tablets/android-n-developer-preview/">Xperia Z3 に Android N Developer Preview を試す</a>を参照してください。
- </td>
- </tr>
-
</table>
<h3 id="revertDevice">プレビュー版を端末からアンインストールする</h3>
diff --git a/docs/html-intl/intl/ko/preview/download.jd b/docs/html-intl/intl/ko/preview/download.jd
index 88c45cd..45d5bd8 100644
--- a/docs/html-intl/intl/ko/preview/download.jd
+++ b/docs/html-intl/intl/ko/preview/download.jd
@@ -370,13 +370,6 @@
</td>
</tr>
- <tr id="xperia">
- <td>Sony Xperia Z3 <br> (D6603 및 D6653)</td>
- <td>다운로드: <a class="external-link" href="http://support.sonymobile.com/xperiaz3/tools/xperia-companion/">Xperia Companion</a><br>
- 자세한 내용은 <a class="external-link" href="https://developer.sony.com/develop/smartphones-and-tablets/android-n-developer-preview/">Xperia Z3용 Android N Developer Preview 체험</a>을 참조하세요.
- </td>
- </tr>
-
</table>
<h3 id="revertDevice">기기에서 Preview 제거</h3>
diff --git a/docs/html-intl/intl/pt-br/preview/download.jd b/docs/html-intl/intl/pt-br/preview/download.jd
index 111c183..4477142 100644
--- a/docs/html-intl/intl/pt-br/preview/download.jd
+++ b/docs/html-intl/intl/pt-br/preview/download.jd
@@ -370,13 +370,6 @@
</td>
</tr>
- <tr id="xperia">
- <td>Sony Xperia Z3 <br> (D6603 e D6653)</td>
- <td>Download: <a class="external-link" href="http://support.sonymobile.com/xperiaz3/tools/xperia-companion/">Xperia Companion</a><br>
- Para obter mais informações, consulte <a class="external-link" href="https://developer.sony.com/develop/smartphones-and-tablets/android-n-developer-preview/">Experimente o Android N Developer Preview para Xperia Z3</a>.
- </td>
- </tr>
-
</table>
<h3 id="revertDevice">Desinstalar o Preview de um dispositivo</h3>
diff --git a/docs/html-intl/intl/zh-cn/preview/download.jd b/docs/html-intl/intl/zh-cn/preview/download.jd
index 06bf2bf..2d3b883 100644
--- a/docs/html-intl/intl/zh-cn/preview/download.jd
+++ b/docs/html-intl/intl/zh-cn/preview/download.jd
@@ -370,13 +370,6 @@
</td>
</tr>
- <tr id="xperia">
- <td>Sony Xperia Z3 <br> (D6603 和 D6653)</td>
- <td>下载:<a class="external-link" href="http://support.sonymobile.com/xperiaz3/tools/xperia-companion/">Xperia Companion</a><br>
- 如需了解详细信息,请参阅<a class="external-link" href="https://developer.sony.com/develop/smartphones-and-tablets/android-n-developer-preview/">为 Xperia Z3 尝试 Android N Developer Preview</a>。
- </td>
- </tr>
-
</table>
<h3 id="revertDevice">从设备卸载 Preview</h3>
diff --git a/docs/html/google/play/billing/billing_admin.jd b/docs/html/google/play/billing/billing_admin.jd
index 05f3ad5..292cfcc 100644
--- a/docs/html/google/play/billing/billing_admin.jd
+++ b/docs/html/google/play/billing/billing_admin.jd
@@ -748,10 +748,9 @@
intent.</p>
<p class="note">
- <strong>Note:</strong> When a user completes a test purchase, the
- <code>orderId</code> field remains blank. To track test transactions, use
- the <code>purchaseToken</code> field instead. For more information about
- working with test purchases, see <a
+ <strong>Note:</strong> Test purchases don't have an <code>orderId</code>
+ field. To track test transactions, you use the <code>purchaseToken</code>
+ field instead. For more information about working with test purchases, see <a
href="{@docRoot}google/play/billing/billing_testing.html">Testing In-app
Billing</a>.
</p>
@@ -766,14 +765,14 @@
<p>For transactions dated 5 December 2012 or later, Google payments assigns a
Merchant Order Number (rather than a Google Order Number) and reports the Merchant
-Order Number as the value of <code>orderID</code>. Here's an
+Order Number as the value of <code>orderId</code>. Here's an
example:</p>
<pre>"orderId" : "GPA.1234-5678-9012-34567"</pre>
<p>For transactions dated previous to 5 December 2012, Google checkout assigned
a Google Order Number and reported that number as the value of
-<code>orderID</code>. Here's an example of an <code>orderID</code> holding a
+<code>orderId</code>. Here's an example of an <code>orderId</code> holding a
Google Order Number:</p>
<pre>"orderId" : "556515565155651"</pre>
diff --git a/docs/html/google/play/billing/billing_testing.jd b/docs/html/google/play/billing/billing_testing.jd
index 755f3ff..44b7ad3 100644
--- a/docs/html/google/play/billing/billing_testing.jd
+++ b/docs/html/google/play/billing/billing_testing.jd
@@ -81,8 +81,8 @@
<p>
Once authorized for testing access, those users can make purchases without
- being charged. The <code>orderId</code> field for test purchases remains
- blank, ensuring that there are no actual charges to user accounts.
+ being charged. Test purchases don't have an <code>orderId</code> field, which
+ ensures that there are no actual charges to user accounts.
</p>
<p class="note">
@@ -127,11 +127,11 @@
purchase dialog.</p>
<p class="note">
- <strong>Note:</strong> For test purchases, leave the {@code orderId} field
- blank. You can use the {@code purchaseToken} field to identify test purchases.
+ <strong>Note:</strong> Test purchases don't have an <code>orderId</code>
+ field. To track test purchases, you use the <code>purchaseToken</code> field
+ instead.
</p>
-
<h4 id="tp-account">Test purchases and developer account</h4>
<p>Authorized license test accounts are associated with your developer account
in Google Play, rather than with a specific APK or package name. Identifying an
diff --git a/docs/html/guide/topics/graphics/prop-animation.jd b/docs/html/guide/topics/graphics/prop-animation.jd
index 693799c..2be2b09 100755
--- a/docs/html/guide/topics/graphics/prop-animation.jd
+++ b/docs/html/guide/topics/graphics/prop-animation.jd
@@ -594,7 +594,7 @@
for just the {@link android.animation.Animator.AnimatorListener#onAnimationEnd onAnimationEnd()}
callback:</p>
<pre>
-ValueAnimatorAnimator fadeAnim = ObjectAnimator.ofFloat(newBall, "alpha", 1f, 0f);
+ValueAnimator fadeAnim = ObjectAnimator.ofFloat(newBall, "alpha", 1f, 0f);
fadeAnim.setDuration(250);
fadeAnim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animation) {
diff --git a/docs/html/guide/topics/manifest/uses-feature-element.jd b/docs/html/guide/topics/manifest/uses-feature-element.jd
index 5d163c0..0670348 100755
--- a/docs/html/guide/topics/manifest/uses-feature-element.jd
+++ b/docs/html/guide/topics/manifest/uses-feature-element.jd
@@ -33,7 +33,7 @@
<p style="color:#669999;padding-top:1em;">Google Play Filtering</p>
<p style="padding-top:1em;">Google Play uses the <code><uses-feature></code>
elements declared in your app manifest to filter your app from devices
- that do not meet it's hardware and software feature requirements. </p>
+ that do not meet its hardware and software feature requirements. </p>
<p style="margin-top:1em;">By specifying the features that your application requires,
you enable Google Play to present your application only to users whose
@@ -150,23 +150,21 @@
<dd>
Boolean value that indicates whether the application requires the feature
specified in <code>android:name</code>.
- </dd>
-</dl>
-<ul>
-<li>When you declare <code>android:required="true"</code> for a feature,
-you are specifying that the application <em>cannot function, or is not
-designed to function</em>, when the specified feature is not present on the
-device. </li>
+ <ul>
+ <li>When you declare <code>android:required="true"</code> for a feature,
+ you are specifying that the application <em>cannot function, or is not
+ designed to function</em>, when the specified feature is not present on the
+ device. </li>
-<li>When you declare <code>android:required="false"</code> for a feature, it
-means that the application <em>prefers to use the feature</em> if present on
-the device, but that it <em>is designed to function without the specified
-feature</em>, if necessary. </li>
+ <li>When you declare <code>android:required="false"</code> for a feature, it
+ means that the application <em>prefers to use the feature</em> if present on
+ the device, but that it <em>is designed to function without the specified
+ feature</em>, if necessary. </li>
-</ul>
+ </ul>
-<p>The default value for <code>android:required</code> if not declared is
-<code>"true"</code>.</p>
+ <p>The default value for <code>android:required</code> if not declared is
+ <code>"true"</code>.</p>
</dd>
<dt><a name="glEsVersion"></a><code>android:glEsVersion</code></dt>
diff --git a/docs/html/jd_extras_en.js b/docs/html/jd_extras_en.js
index 434f211..15485c4 100644
--- a/docs/html/jd_extras_en.js
+++ b/docs/html/jd_extras_en.js
@@ -2887,6 +2887,19 @@
"lang": "en",
"group": "",
"tags": [],
+ "url": "https://www.udacity.com/courses/ud876-3",
+ "timestamp": null,
+ "image": "distribute/images/advertising.jpg",
+ "title": "Learn how to show ads in your Android app",
+ "summary": "Take this online course to learn how to use AdMob to display ads in your Android app.",
+ "keywords": ["marketing", "analytics"],
+ "type": "distribute",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [],
"url": "https://developers.google.com/mobile-ads-sdk/download",
"timestamp": null,
"image": "distribute/images/advertising.jpg",
diff --git a/docs/html/preview/download.jd b/docs/html/preview/download.jd
index a60cbfaa..e4db890 100644
--- a/docs/html/preview/download.jd
+++ b/docs/html/preview/download.jd
@@ -386,15 +386,6 @@
</td>
</tr>
- <tr id="xperia">
- <td>Sony Xperia Z3 <br> (D6603 and D6653)</td>
- <td>Download: <a class="external-link"
- href="http://support.sonymobile.com/xperiaz3/tools/xperia-companion/">Xperia Companion</a><br>
- For more information, see <a class="external-link"
- href="https://developer.sony.com/develop/smartphones-and-tablets/android-n-developer-preview/">Try Android N Developer Preview for Xperia Z3</a>.
- </td>
- </tr>
-
</table>
<h3 id="revertDevice">Uninstalling the Preview from a device</h3>
diff --git a/docs/html/preview/support.jd b/docs/html/preview/support.jd
index ed40914..0d0d9db 100644
--- a/docs/html/preview/support.jd
+++ b/docs/html/preview/support.jd
@@ -135,13 +135,6 @@
</li>
</ul>
-<h4>Camera</h4>
-<ul>
- <li>Apps may encounter Intermittent issues recording and playing back
- video at 240fps.
- </li>
-</ul>
-
<h4>Do Not Disturb</h4>
<ul>
<li>Do Not Disturb mode may be set at device reboot. To work around
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 5003c6a..bfcb0e5 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -234,6 +234,7 @@
}
// All signs point to a stuffed swap chain
+ ATRACE_NAME("swap chain stuffed");
return true;
}
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index 2efefb3..f1789ea 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -142,7 +142,7 @@
<activity
android:name=".BugreportWarningActivity"
- android:theme="@android:style/Theme.Material.Light.Dialog.Alert"
+ android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert"
android:finishOnCloseSystemDialogs="true"
android:excludeFromRecents="true"
android:exported="false" />
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 71904fa..bd485dd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -225,6 +225,8 @@
}
KeyguardUpdateMonitorCallback mUpdateMonitor = new KeyguardUpdateMonitorCallback() {
+ public int mLastSuccessiveErrorMessage = -1;
+
@Override
public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) {
boolean isChargingOrFull = status.status == BatteryManager.BATTERY_STATUS_CHARGING
@@ -252,6 +254,9 @@
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_FP_MSG),
TRANSIENT_FP_ERROR_TIMEOUT);
}
+ // Help messages indicate that there was actually a try since the last error, so those
+ // are not two successive error messages anymore.
+ mLastSuccessiveErrorMessage = -1;
}
@Override
@@ -263,15 +268,22 @@
}
int errorColor = mContext.getResources().getColor(R.color.system_warning_color, null);
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
- mStatusBarKeyguardViewManager.showBouncerMessage(errString, errorColor);
+ // When swiping up right after receiving a fingerprint error, the bouncer calls
+ // authenticate leading to the same message being shown again on the bouncer.
+ // We want to avoid this, as it may confuse the user when the message is too
+ // generic.
+ if (mLastSuccessiveErrorMessage != msgId) {
+ mStatusBarKeyguardViewManager.showBouncerMessage(errString, errorColor);
+ }
} else if (updateMonitor.isDeviceInteractive()) {
- showTransientIndication(errString, errorColor);
- // We want to keep this message around in case the screen was off
- mHandler.removeMessages(MSG_HIDE_TRANSIENT);
- hideTransientIndicationDelayed(5000);
- } else {
- mMessageToShowOnScreenOn = errString;
+ showTransientIndication(errString, errorColor);
+ // We want to keep this message around in case the screen was off
+ mHandler.removeMessages(MSG_HIDE_TRANSIENT);
+ hideTransientIndicationDelayed(5000);
+ } else {
+ mMessageToShowOnScreenOn = errString;
}
+ mLastSuccessiveErrorMessage = msgId;
}
@Override
@@ -293,6 +305,18 @@
mMessageToShowOnScreenOn = null;
}
}
+
+ @Override
+ public void onFingerprintAuthenticated(int userId) {
+ super.onFingerprintAuthenticated(userId);
+ mLastSuccessiveErrorMessage = -1;
+ }
+
+ @Override
+ public void onFingerprintAuthFailed() {
+ super.onFingerprintAuthFailed();
+ mLastSuccessiveErrorMessage = -1;
+ }
};
BroadcastReceiver mReceiver = new BroadcastReceiver() {
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index 0cce2a2..33c2ea2 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -1243,6 +1243,10 @@
private VerifyCredentialResponse doVerifyPattern(String pattern, CredentialHash storedHash,
boolean hasChallenge, long challenge, int userId,
ICheckCredentialProgressCallback progressCallback) throws RemoteException {
+
+ if (TextUtils.isEmpty(pattern)) {
+ throw new IllegalArgumentException("Pattern can't be null or empty");
+ }
boolean shouldReEnrollBaseZero = storedHash != null && storedHash.isBaseZeroPattern;
String patternToVerify;
@@ -1340,6 +1344,9 @@
private VerifyCredentialResponse doVerifyPassword(String password, CredentialHash storedHash,
boolean hasChallenge, long challenge, int userId,
ICheckCredentialProgressCallback progressCallback) throws RemoteException {
+ if (TextUtils.isEmpty(password)) {
+ throw new IllegalArgumentException("Password can't be null or empty");
+ }
return verifyCredential(userId, storedHash, password, hasChallenge, challenge,
new CredentialUtil() {
@Override
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index be9d836..418ba9f6 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -494,7 +494,7 @@
if (mLastPowerStateFromWifi != powerState) {
mLastPowerStateFromWifi = powerState;
try {
- getBatteryStats().noteWifiRadioPowerState(powerState, tsNanos);
+ getBatteryStats().noteWifiRadioPowerState(powerState, tsNanos, uid);
} catch (RemoteException e) {
}
}
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 577cada..9108acf 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -1553,9 +1553,15 @@
}
}
}
-
- logRecord(accounts, DebugDbHelper.ACTION_CALLED_ACCOUNT_REMOVE, TABLE_ACCOUNTS);
-
+ SQLiteDatabase db = accounts.openHelper.getReadableDatabase();
+ final long accountId = getAccountIdLocked(db, account);
+ logRecord(
+ db,
+ DebugDbHelper.ACTION_CALLED_ACCOUNT_REMOVE,
+ TABLE_ACCOUNTS,
+ accountId,
+ accounts,
+ callingUid);
try {
new RemoveAccountSession(accounts, response, account, expectActivityLaunch).bind();
} finally {
@@ -1587,7 +1593,15 @@
throw new SecurityException(msg);
}
UserAccounts accounts = getUserAccountsForCaller();
- logRecord(accounts, DebugDbHelper.ACTION_CALLED_ACCOUNT_REMOVE, TABLE_ACCOUNTS);
+ SQLiteDatabase db = accounts.openHelper.getReadableDatabase();
+ final long accountId = getAccountIdLocked(db, account);
+ logRecord(
+ db,
+ DebugDbHelper.ACTION_CALLED_ACCOUNT_REMOVE,
+ TABLE_ACCOUNTS,
+ accountId,
+ accounts,
+ callingUid);
long identityToken = clearCallingIdentity();
try {
return removeAccountInternal(accounts, account, callingUid);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 8716811..67ff085 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -20265,10 +20265,12 @@
if (mUseFifoUiScheduling) {
// Reset UI pipeline to SCHED_OTHER
Process.setThreadScheduler(app.pid, Process.SCHED_OTHER, 0);
- Process.setThreadScheduler(app.renderThreadTid,
- Process.SCHED_OTHER, 0);
Process.setThreadPriority(app.pid, app.savedPriority);
- Process.setThreadPriority(app.renderThreadTid, -4);
+ if (app.renderThreadTid != 0) {
+ Process.setThreadScheduler(app.renderThreadTid,
+ Process.SCHED_OTHER, 0);
+ Process.setThreadPriority(app.renderThreadTid, -4);
+ }
}
}
} catch (Exception e) {
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index def6828..7fe29b0 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -710,7 +710,7 @@
}
@Override
- public void noteWifiRadioPowerState(int powerState, long tsNanos) {
+ public void noteWifiRadioPowerState(int powerState, long tsNanos, int uid) {
enforceCallingPermission();
// There was a change in WiFi power state.
@@ -723,7 +723,7 @@
mHandler.scheduleSync("wifi-data: " + type,
BatteryStatsImpl.ExternalStatsSync.UPDATE_WIFI);
}
- mStats.noteWifiRadioPowerState(powerState, tsNanos);
+ mStats.noteWifiRadioPowerState(powerState, tsNanos, uid);
}
}
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 4de09bd..9c22be7 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -352,9 +352,15 @@
final UserInfo info = getUserInfo(userId);
if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)) {
// Suppress double notifications for managed profiles that
- // were unlocked automatically (no challenge token required)
- // as part of their parent user being unlocked.
- final boolean quiet = info.isManagedProfile() && !uss.tokenProvided;
+ // were unlocked automatically as part of their parent user
+ // being unlocked.
+ final boolean quiet;
+ if (info.isManagedProfile()) {
+ quiet = !uss.tokenProvided
+ || !mLockPatternUtils.isSeparateProfileChallengeEnabled(userId);
+ } else {
+ quiet = false;
+ }
new PreBootBroadcaster(mService, userId, null, quiet) {
@Override
public void onFinished() {
diff --git a/services/core/java/com/android/server/twilight/TwilightService.java b/services/core/java/com/android/server/twilight/TwilightService.java
index 89e5e58..ee7a4a0 100644
--- a/services/core/java/com/android/server/twilight/TwilightService.java
+++ b/services/core/java/com/android/server/twilight/TwilightService.java
@@ -16,18 +16,12 @@
package com.android.server.twilight;
-import com.android.server.SystemService;
-import com.android.server.TwilightCalculator;
-
-import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.database.ContentObserver;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
@@ -36,64 +30,52 @@
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.provider.Settings.Secure;
import android.text.format.DateUtils;
import android.text.format.Time;
import android.util.Slog;
+import com.android.internal.annotations.GuardedBy;
+import com.android.server.SystemService;
+import com.android.server.TwilightCalculator;
+
import java.util.ArrayList;
import java.util.Iterator;
-
-import libcore.util.Objects;
+import java.util.List;
+import java.util.Objects;
/**
* Figures out whether it's twilight time based on the user's location.
- *
+ * <p>
* Used by the UI mode manager and other components to adjust night mode
* effects based on sunrise and sunset.
*/
public final class TwilightService extends SystemService {
- static final String TAG = "TwilightService";
- static final boolean DEBUG = false;
- static final String ACTION_UPDATE_TWILIGHT_STATE =
+
+ private static final String TAG = "TwilightService";
+ private static final boolean DEBUG = false;
+
+ private static final String ACTION_UPDATE_TWILIGHT_STATE =
"com.android.server.action.UPDATE_TWILIGHT_STATE";
- // The amount of time after or before sunrise over which to start adjusting
- // twilight affected things. We want the change to happen gradually so that
- // it is below the threshold of perceptibility and so that the adjustment has
- // maximum effect well after dusk.
+ /**
+ * The amount of time after or before sunrise over which to start adjusting twilight affected
+ * things. We want the change to happen gradually so that it is below the threshold of
+ * perceptibility and so that the adjustment has and so that the adjustment has
+ * maximum effect well after dusk.
+ */
private static final long TWILIGHT_ADJUSTMENT_TIME = DateUtils.HOUR_IN_MILLIS * 2;
- // Broadcast when twilight changes.
- public static final String ACTION_TWILIGHT_CHANGED = "android.intent.action.TWILIGHT_CHANGED";
+ private final Object mLock = new Object();
- public static final String EXTRA_IS_NIGHT = "isNight";
- public static final String EXTRA_AMOUNT = "amount";
+ @GuardedBy("mLock")
+ private final List<TwilightListenerRecord> mListeners = new ArrayList<>();
- // Amount of time the TwilightService will stay locked in an override state before switching
- // back to auto.
- private static final long RESET_TIME = DateUtils.HOUR_IN_MILLIS * 2;
- private static final String EXTRA_RESET_USER = "user";
+ private AlarmManager mAlarmManager;
+ private LocationManager mLocationManager;
+ private LocationHandler mLocationHandler;
- private static final String ACTION_RESET_TWILIGHT_AUTO =
- "com.android.server.action.RESET_TWILIGHT_AUTO";
-
- final Object mLock = new Object();
-
- AlarmManager mAlarmManager;
- LocationManager mLocationManager;
- LocationHandler mLocationHandler;
-
- final ArrayList<TwilightListenerRecord> mListeners =
- new ArrayList<TwilightListenerRecord>();
-
- TwilightState mTwilightState;
-
- private int mCurrentUser;
- private boolean mLocked;
- private boolean mBootCompleted;
+ @GuardedBy("mLock")
+ private TwilightState mTwilightState;
public TwilightService(Context context) {
super(context);
@@ -105,13 +87,11 @@
mLocationManager = (LocationManager) getContext().getSystemService(
Context.LOCATION_SERVICE);
mLocationHandler = new LocationHandler();
- mCurrentUser = ActivityManager.getCurrentUser();
IntentFilter filter = new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
filter.addAction(Intent.ACTION_TIME_CHANGED);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
filter.addAction(Intent.ACTION_USER_SWITCHED);
- filter.addAction(ACTION_UPDATE_TWILIGHT_STATE);
getContext().registerReceiver(mReceiver, filter);
publishLocalService(TwilightManager.class, mService);
@@ -120,81 +100,29 @@
@Override
public void onBootPhase(int phase) {
if (phase == PHASE_BOOT_COMPLETED) {
- getContext().getContentResolver().registerContentObserver(
- Secure.getUriFor(Secure.TWILIGHT_MODE), false, mContentObserver, mCurrentUser);
- mContentObserver.onChange(true);
- mBootCompleted = true;
- sendBroadcast();
- }
- }
-
- private void reregisterSettingObserver() {
- final ContentResolver contentResolver = getContext().getContentResolver();
- contentResolver.unregisterContentObserver(mContentObserver);
- contentResolver.registerContentObserver(Secure.getUriFor(Secure.TWILIGHT_MODE), false,
- mContentObserver, mCurrentUser);
- mContentObserver.onChange(true);
- }
-
- private void setLockedState(TwilightState state) {
- synchronized (mLock) {
- // Make sure we aren't locked so we can set the state.
- mLocked = false;
- setTwilightState(state);
- // Make sure we leave the state locked, so it cant be changed.
- mLocked = true;
- // TODO: Don't bother updating state when locked.
+ // Initialize the current twilight state.
+ mLocationHandler.requestTwilightUpdate();
}
}
private void setTwilightState(TwilightState state) {
synchronized (mLock) {
- if (mLocked) {
- // State has been locked by secure setting, shouldn't be changed.
- return;
- }
- if (!Objects.equal(mTwilightState, state)) {
+ if (!Objects.equals(mTwilightState, state)) {
if (DEBUG) {
Slog.d(TAG, "Twilight state changed: " + state);
}
mTwilightState = state;
- final int listenerLen = mListeners.size();
- for (int i = 0; i < listenerLen; i++) {
- mListeners.get(i).postUpdate();
+ for (TwilightListenerRecord mListener : mListeners) {
+ mListener.postUpdate();
}
}
}
- sendBroadcast();
- }
-
- private void sendBroadcast() {
- synchronized (mLock) {
- if (mTwilightState == null) {
- return;
- }
- if (mBootCompleted) {
- Intent intent = new Intent(ACTION_TWILIGHT_CHANGED);
- intent.putExtra(EXTRA_IS_NIGHT, mTwilightState.isNight());
- intent.putExtra(EXTRA_AMOUNT, mTwilightState.getAmount());
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
- getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
- }
- }
- }
-
- private void scheduleReset() {
- long resetTime = System.currentTimeMillis() + RESET_TIME;
- Intent resetIntent = new Intent(ACTION_RESET_TWILIGHT_AUTO);
- resetIntent.putExtra(EXTRA_RESET_USER, mCurrentUser);
- PendingIntent pendingIntent = PendingIntent.getBroadcast(
- getContext(), 0, resetIntent, 0);
- mAlarmManager.cancel(pendingIntent);
- mAlarmManager.setExact(AlarmManager.RTC, resetTime, pendingIntent);
}
private static class TwilightListenerRecord implements Runnable {
+
private final TwilightListener mListener;
private final Handler mHandler;
@@ -211,15 +139,9 @@
public void run() {
mListener.onTwilightStateChanged();
}
-
}
private final TwilightManager mService = new TwilightManager() {
- /**
- * Gets the current twilight state.
- *
- * @return The current twilight state, or null if no information is available.
- */
@Override
public TwilightState getCurrentState() {
synchronized (mLock) {
@@ -227,11 +149,6 @@
}
}
- /**
- * Listens for twilight time.
- *
- * @param listener The listener.
- */
@Override
public void registerListener(TwilightListener listener, Handler handler) {
synchronized (mLock) {
@@ -286,6 +203,7 @@
}
private final class LocationHandler extends Handler {
+
private static final int MSG_ENABLE_LOCATION_UPDATES = 1;
private static final int MSG_GET_NEW_LOCATION_UPDATE = 2;
private static final int MSG_PROCESS_NEW_LOCATION = 3;
@@ -301,13 +219,14 @@
private static final double FACTOR_GMT_OFFSET_LONGITUDE =
1000.0 * 360.0 / DateUtils.DAY_IN_MILLIS;
+ private final TwilightCalculator mTwilightCalculator = new TwilightCalculator();
+
private boolean mPassiveListenerEnabled;
private boolean mNetworkListenerEnabled;
private boolean mDidFirstInit;
private long mLastNetworkRegisterTime = -MIN_LOCATION_UPDATE_MS;
private long mLastUpdateInterval;
private Location mLocation;
- private final TwilightCalculator mTwilightCalculator = new TwilightCalculator();
public void processNewLocation(Location location) {
Message msg = obtainMessage(MSG_PROCESS_NEW_LOCATION, location);
@@ -334,14 +253,14 @@
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_PROCESS_NEW_LOCATION: {
- final Location location = (Location)msg.obj;
+ final Location location = (Location) msg.obj;
final boolean hasMoved = hasMoved(mLocation, location);
final boolean hasBetterAccuracy = mLocation == null
|| location.getAccuracy() < mLocation.getAccuracy();
if (DEBUG) {
Slog.d(TAG, "Processing new location: " + location
- + ", hasMoved=" + hasMoved
- + ", hasBetterAccuracy=" + hasBetterAccuracy);
+ + ", hasMoved=" + hasMoved
+ + ", hasBetterAccuracy=" + hasBetterAccuracy);
}
if (hasMoved || hasBetterAccuracy) {
setLocation(location);
@@ -373,8 +292,8 @@
// distance.
boolean networkLocationEnabled;
try {
- networkLocationEnabled =
- mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
+ networkLocationEnabled = mLocationManager.isProviderEnabled(
+ LocationManager.NETWORK_PROVIDER);
} catch (Exception e) {
// we may get IllegalArgumentException if network location provider
// does not exist or is not yet installed.
@@ -398,8 +317,8 @@
// and network).
boolean passiveLocationEnabled;
try {
- passiveLocationEnabled =
- mLocationManager.isProviderEnabled(LocationManager.PASSIVE_PROVIDER);
+ passiveLocationEnabled = mLocationManager.isProviderEnabled(
+ LocationManager.PASSIVE_PROVIDER);
} catch (Exception e) {
// we may get IllegalArgumentException if passive location provider
// does not exist or is not yet installed.
@@ -409,7 +328,7 @@
if (!mPassiveListenerEnabled && passiveLocationEnabled) {
mPassiveListenerEnabled = true;
mLocationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER,
- 0, LOCATION_UPDATE_DISTANCE_METER , mLocationListener);
+ 0, LOCATION_UPDATE_DISTANCE_METER, mLocationListener);
}
if (!(mNetworkListenerEnabled && mPassiveListenerEnabled)) {
@@ -444,14 +363,14 @@
// pick the most recent location
if (location == null || (lastKnownLocation != null &&
location.getElapsedRealtimeNanos() <
- lastKnownLocation.getElapsedRealtimeNanos())) {
+ lastKnownLocation.getElapsedRealtimeNanos())) {
location = lastKnownLocation;
}
}
// In the case there is no location available (e.g. GPS fix or network location
- // is not available yet), the longitude of the location is estimated using the timezone,
- // latitude and accuracy are set to get a good average.
+ // is not available yet), the longitude of the location is estimated using the
+ // timezone, latitude and accuracy are set to get a good average.
if (location == null) {
Time currentTime = new Time();
currentTime.set(System.currentTimeMillis());
@@ -543,58 +462,22 @@
Slog.d(TAG, "Next update in " + (nextUpdate - now) + " ms");
}
- Intent updateIntent = new Intent(ACTION_UPDATE_TWILIGHT_STATE);
- PendingIntent pendingIntent = PendingIntent.getBroadcast(
- getContext(), 0, updateIntent, 0);
+ final PendingIntent pendingIntent = PendingIntent.getBroadcast(
+ getContext(), 0, new Intent(ACTION_UPDATE_TWILIGHT_STATE), 0);
mAlarmManager.cancel(pendingIntent);
mAlarmManager.setExact(AlarmManager.RTC, nextUpdate, pendingIntent);
}
}
- private final ContentObserver mContentObserver = new ContentObserver(new Handler()) {
- @Override
- public void onChange(boolean selfChange) {
- super.onChange(selfChange);
- int value = Secure.getIntForUser(getContext().getContentResolver(),
- Secure.TWILIGHT_MODE, Secure.TWILIGHT_MODE_AUTO, mCurrentUser);
- if (value == Secure.TWILIGHT_MODE_LOCKED_OFF) {
- setLockedState(new TwilightState(false, 0));
- } else if (value == Secure.TWILIGHT_MODE_LOCKED_ON) {
- setLockedState(new TwilightState(true, 1));
- } else if (value == Secure.TWILIGHT_MODE_AUTO_OVERRIDE_OFF) {
- setLockedState(new TwilightState(false, 0));
- scheduleReset();
- } else if (value == Secure.TWILIGHT_MODE_AUTO_OVERRIDE_ON) {
- setLockedState(new TwilightState(true, 1));
- scheduleReset();
- } else {
- mLocked = false;
- mLocationHandler.requestTwilightUpdate();
- }
- }
- };
-
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- if (Intent.ACTION_USER_SWITCHED.equals(intent.getAction())) {
- mCurrentUser = ActivityManager.getCurrentUser();
- reregisterSettingObserver();
- return;
- }
if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(intent.getAction())
&& !intent.getBooleanExtra("state", false)) {
// Airplane mode is now off!
mLocationHandler.requestLocationUpdate();
return;
}
-
- if (ACTION_RESET_TWILIGHT_AUTO.equals(intent.getAction())) {
- int user = intent.getIntExtra(EXTRA_RESET_USER, 0);
- Settings.Secure.putIntForUser(getContext().getContentResolver(),
- Secure.TWILIGHT_MODE, Secure.TWILIGHT_MODE_AUTO, user);
- return;
- }
// Time zone has changed or alarm expired.
mLocationHandler.requestTwilightUpdate();
}
@@ -602,32 +485,40 @@
// A LocationListener to initialize the network location provider. The location updates
// are handled through the passive location provider.
- private final LocationListener mEmptyLocationListener = new LocationListener() {
+ private final LocationListener mEmptyLocationListener = new LocationListener() {
+ @Override
public void onLocationChanged(Location location) {
}
- public void onProviderDisabled(String provider) {
+ @Override
+ public void onStatusChanged(String provider, int status, Bundle extras) {
}
+ @Override
public void onProviderEnabled(String provider) {
}
- public void onStatusChanged(String provider, int status, Bundle extras) {
+ @Override
+ public void onProviderDisabled(String provider) {
}
};
private final LocationListener mLocationListener = new LocationListener() {
+ @Override
public void onLocationChanged(Location location) {
mLocationHandler.processNewLocation(location);
}
- public void onProviderDisabled(String provider) {
+ @Override
+ public void onStatusChanged(String provider, int status, Bundle extras) {
}
+ @Override
public void onProviderEnabled(String provider) {
}
- public void onStatusChanged(String provider, int status, Bundle extras) {
+ @Override
+ public void onProviderDisabled(String provider) {
}
};
}
diff --git a/services/core/java/com/android/server/twilight/TwilightState.java b/services/core/java/com/android/server/twilight/TwilightState.java
index 81abc13..dec053b 100644
--- a/services/core/java/com/android/server/twilight/TwilightState.java
+++ b/services/core/java/com/android/server/twilight/TwilightState.java
@@ -24,6 +24,7 @@
* This object is immutable.
*/
public class TwilightState {
+
private final boolean mIsNight;
private final float mAmount;
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 9939c18..aea16c7 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -808,13 +808,13 @@
assert(outPatch->paddingTop == inPatch->paddingTop);
assert(outPatch->paddingBottom == inPatch->paddingBottom);
for (int i = 0; i < outPatch->numXDivs; i++) {
- assert(outPatch->xDivs[i] == inPatch->xDivs[i]);
+ assert(outPatch->getXDivs()[i] == inPatch->getXDivs()[i]);
}
for (int i = 0; i < outPatch->numYDivs; i++) {
- assert(outPatch->yDivs[i] == inPatch->yDivs[i]);
+ assert(outPatch->getYDivs()[i] == inPatch->getYDivs()[i]);
}
for (int i = 0; i < outPatch->numColors; i++) {
- assert(outPatch->colors[i] == inPatch->colors[i]);
+ assert(outPatch->getColors()[i] == inPatch->getColors()[i]);
}
free(newData);
}
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index e640733..a7878d1 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -326,13 +326,18 @@
}
String8 resPath = it.getPath();
resPath.convertToResPath();
- table->addEntry(SourcePos(it.getPath(), 0), String16(assets->getPackage()),
+ status_t result = table->addEntry(SourcePos(it.getPath(), 0),
+ String16(assets->getPackage()),
type16,
baseName,
String16(resPath),
NULL,
&it.getParams());
- assets->addResource(it.getLeafName(), resPath, it.getFile(), type8);
+ if (result != NO_ERROR) {
+ hasErrors = true;
+ } else {
+ assets->addResource(it.getLeafName(), resPath, it.getFile(), type8);
+ }
}
return hasErrors ? STATUST(UNKNOWN_ERROR) : NO_ERROR;
@@ -1370,6 +1375,10 @@
}
}
+ if (hasErrors) {
+ return UNKNOWN_ERROR;
+ }
+
// --------------------------------------------------------------------
// Assignment of resource IDs and initial generation of resource table.
// --------------------------------------------------------------------
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 6a4b637..6d80a69 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -4521,6 +4521,7 @@
const ConfigDescription& sourceConfig,
const int sdkVersionToGenerate) {
assert(sdkVersionToGenerate > sourceConfig.sdkVersion);
+ assert(configList != NULL);
const DefaultKeyedVector<ConfigDescription, sp<ResourceTable::Entry>>& entries
= configList->getEntries();
ssize_t idx = entries.indexOfKey(sourceConfig);