merge in ics-factoryrom-release history after reset to ics-factoryrom
diff --git a/api/14.txt b/api/14.txt
index 45bb882..9f2a6df 100644
--- a/api/14.txt
+++ b/api/14.txt
@@ -759,6 +759,7 @@
field public static final int prompt = 16843131; // 0x101017b
field public static final int propertyName = 16843489; // 0x10102e1
field public static final int protectionLevel = 16842761; // 0x1010009
+ field public static final int publicKey = 16843686; // 0x10103a6
field public static final int queryActionMsg = 16843227; // 0x10101db
field public static final int queryAfterZeroResults = 16843394; // 0x1010282
field public static final int queryHint = 16843608; // 0x1010358
@@ -4566,6 +4567,7 @@
field public static final java.lang.String EXTRA_PREVIOUS_STATE = "android.bluetooth.profile.extra.PREVIOUS_STATE";
field public static final java.lang.String EXTRA_STATE = "android.bluetooth.profile.extra.STATE";
field public static final int HEADSET = 1; // 0x1
+ field public static final int HEALTH = 3; // 0x3
field public static final int STATE_CONNECTED = 2; // 0x2
field public static final int STATE_CONNECTING = 1; // 0x1
field public static final int STATE_DISCONNECTED = 0; // 0x0
@@ -5454,6 +5456,7 @@
field public static final java.lang.String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH";
field public static final java.lang.String ACTION_PACKAGE_FULLY_REMOVED = "android.intent.action.PACKAGE_FULLY_REMOVED";
field public static final deprecated java.lang.String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL";
+ field public static final java.lang.String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION";
field public static final java.lang.String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED";
field public static final java.lang.String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED";
field public static final java.lang.String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED";
@@ -6207,11 +6210,13 @@
method public abstract void setApplicationEnabledSetting(java.lang.String, int, int);
method public abstract void setComponentEnabledSetting(android.content.ComponentName, int, int);
method public abstract void setInstallerPackageName(java.lang.String, java.lang.String);
+ method public abstract void verifyPendingInstall(int, int);
field public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; // 0x0
field public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; // 0x2
field public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; // 0x3
field public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; // 0x1
field public static final int DONT_KILL_APP = 1; // 0x1
+ field public static final java.lang.String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
field public static final java.lang.String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera";
@@ -6273,6 +6278,8 @@
field public static final int SIGNATURE_NO_MATCH = -3; // 0xfffffffd
field public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; // 0xfffffffe
field public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; // 0xfffffffc
+ field public static final int VERIFICATION_ALLOW = 1; // 0x1
+ field public static final int VERIFICATION_REJECT = -1; // 0xffffffff
}
public static class PackageManager.NameNotFoundException extends android.util.AndroidException {
@@ -19834,6 +19841,7 @@
method public void setApplicationEnabledSetting(java.lang.String, int, int);
method public void setComponentEnabledSetting(android.content.ComponentName, int, int);
method public void setInstallerPackageName(java.lang.String, java.lang.String);
+ method public void verifyPendingInstall(int, int);
}
public class MockResources extends android.content.res.Resources {
diff --git a/api/current.txt b/api/current.txt
index 45bb882..9f2a6df 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -759,6 +759,7 @@
field public static final int prompt = 16843131; // 0x101017b
field public static final int propertyName = 16843489; // 0x10102e1
field public static final int protectionLevel = 16842761; // 0x1010009
+ field public static final int publicKey = 16843686; // 0x10103a6
field public static final int queryActionMsg = 16843227; // 0x10101db
field public static final int queryAfterZeroResults = 16843394; // 0x1010282
field public static final int queryHint = 16843608; // 0x1010358
@@ -4566,6 +4567,7 @@
field public static final java.lang.String EXTRA_PREVIOUS_STATE = "android.bluetooth.profile.extra.PREVIOUS_STATE";
field public static final java.lang.String EXTRA_STATE = "android.bluetooth.profile.extra.STATE";
field public static final int HEADSET = 1; // 0x1
+ field public static final int HEALTH = 3; // 0x3
field public static final int STATE_CONNECTED = 2; // 0x2
field public static final int STATE_CONNECTING = 1; // 0x1
field public static final int STATE_DISCONNECTED = 0; // 0x0
@@ -5454,6 +5456,7 @@
field public static final java.lang.String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH";
field public static final java.lang.String ACTION_PACKAGE_FULLY_REMOVED = "android.intent.action.PACKAGE_FULLY_REMOVED";
field public static final deprecated java.lang.String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL";
+ field public static final java.lang.String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION";
field public static final java.lang.String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED";
field public static final java.lang.String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED";
field public static final java.lang.String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED";
@@ -6207,11 +6210,13 @@
method public abstract void setApplicationEnabledSetting(java.lang.String, int, int);
method public abstract void setComponentEnabledSetting(android.content.ComponentName, int, int);
method public abstract void setInstallerPackageName(java.lang.String, java.lang.String);
+ method public abstract void verifyPendingInstall(int, int);
field public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; // 0x0
field public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; // 0x2
field public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; // 0x3
field public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; // 0x1
field public static final int DONT_KILL_APP = 1; // 0x1
+ field public static final java.lang.String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
field public static final java.lang.String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera";
@@ -6273,6 +6278,8 @@
field public static final int SIGNATURE_NO_MATCH = -3; // 0xfffffffd
field public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; // 0xfffffffe
field public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; // 0xfffffffc
+ field public static final int VERIFICATION_ALLOW = 1; // 0x1
+ field public static final int VERIFICATION_REJECT = -1; // 0xffffffff
}
public static class PackageManager.NameNotFoundException extends android.util.AndroidException {
@@ -19834,6 +19841,7 @@
method public void setApplicationEnabledSetting(java.lang.String, int, int);
method public void setComponentEnabledSetting(android.content.ComponentName, int, int);
method public void setInstallerPackageName(java.lang.String, java.lang.String);
+ method public void verifyPendingInstall(int, int);
}
public class MockResources extends android.content.res.Resources {
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index bd42e34..8ed7481 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -954,9 +954,9 @@
}
@Override
- public void verifyPendingInstall(int id, boolean verified, String failureMessage) {
+ public void verifyPendingInstall(int id, int response) {
try {
- mPM.verifyPendingInstall(id, verified, failureMessage);
+ mPM.verifyPendingInstall(id, response);
} catch (RemoteException e) {
// Should never happen!
}
diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java
index 58b3868..f7ccfbd 100644
--- a/core/java/android/bluetooth/BluetoothProfile.java
+++ b/core/java/android/bluetooth/BluetoothProfile.java
@@ -66,7 +66,6 @@
/**
* Health Profile
- * @hide
*/
public static final int HEALTH = 3;
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index c7698bf..72cf26a 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1535,8 +1535,6 @@
* <p class="note">
* This is a protected intent that can only be sent by the system.
* </p>
- *
- * @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION";
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 5e6e768..a3bcc28 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -359,7 +359,7 @@
int flags, in String installerPackageName, in Uri verificationURI,
in ManifestDigest manifestDigest);
- void verifyPendingInstall(int id, boolean verified, in String message);
+ void verifyPendingInstall(int id, int verificationCode);
VerifierDeviceIdentity getVerifierDeviceIdentity();
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index dcb6776..ef7e233 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -725,7 +725,22 @@
public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
/**
+ * Used as the {@code verificationCode} argument for
+ * {@link PackageManager#verifyPendingInstall} to indicate that the calling
+ * package verifier allows the installation to proceed.
+ */
+ public static final int VERIFICATION_ALLOW = 1;
+
+ /**
+ * Used as the {@code verificationCode} argument for
+ * {@link PackageManager#verifyPendingInstall} to indicate the calling
+ * package verifier does not vote to allow the installation to proceed.
+ */
+ public static final int VERIFICATION_REJECT = -1;
+
+ /**
* Range of IDs allocated for a user.
+ *
* @hide
*/
public static final int PER_USER_RANGE = 100000;
@@ -1045,9 +1060,7 @@
/**
* Extra field name for the ID of a package pending verification. Passed to
* a package verifier and is used to call back to
- * {@link PackageManager#verifyPendingInstall(int, boolean)}
- *
- * @hide
+ * {@link PackageManager#verifyPendingInstall(int, int)}
*/
public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
@@ -2156,16 +2169,17 @@
/**
* Allows a package listening to the
* {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
- * broadcast} to respond to the package manager.
+ * broadcast} to respond to the package manager. The response must include
+ * the {@code verificationCode} which is one of
+ * {@link PackageManager#VERIFICATION_ALLOW} or
+ * {@link PackageManager#VERIFICATION_REJECT}.
*
* @param id pending package identifier as passed via the
* {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra
- * @param verified whether the package was verified as valid
- * @param failureMessage if verification was false, this is the error
- * message that may be shown to the user
- * @hide
+ * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
+ * or {@link PackageManager#VERIFICATION_REJECT}.
*/
- public abstract void verifyPendingInstall(int id, boolean verified, String failureMessage);
+ public abstract void verifyPendingInstall(int id, int verificationCode);
/**
* Change the installer associated with a given package. There are limitations
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index bcf6239..62bb965 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -56,7 +56,7 @@
public class MobileDataStateTracker implements NetworkStateTracker {
private static final String TAG = "MobileDataStateTracker";
- private static final boolean DBG = true;
+ private static final boolean DBG = false;
private static final boolean VDBG = false;
private Phone.DataState mMobileDataState;
diff --git a/core/java/android/net/ProxyProperties.java b/core/java/android/net/ProxyProperties.java
index 44dbec1..cd799da 100644
--- a/core/java/android/net/ProxyProperties.java
+++ b/core/java/android/net/ProxyProperties.java
@@ -137,6 +137,8 @@
if (mExclusionList != null) {
sb.append(" xl=").append(mExclusionList);
}
+ } else {
+ sb.append("[ProxyProperties.mHost == null]");
}
return sb.toString();
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index bc5994e..bc05078 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1882,6 +1882,11 @@
/**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
+ *
+ * NOTE: Settings are backed up and restored in the order they appear
+ * in this array. If you have one setting depending on another,
+ * make sure that they are ordered appropriately.
+ *
* @hide
*/
public static final String[] SETTINGS_TO_BACKUP = {
@@ -4048,6 +4053,12 @@
public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
/**
+ * This are the settings to be backed up.
+ *
+ * NOTE: Settings are backed up and restored in the order they appear
+ * in this array. If you have one setting depending on another,
+ * make sure that they are ordered appropriately.
+ *
* @hide
*/
public static final String[] SETTINGS_TO_BACKUP = {
@@ -4056,11 +4067,11 @@
PARENTAL_CONTROL_ENABLED,
PARENTAL_CONTROL_REDIRECT_URL,
USB_MASS_STORAGE_ENABLED,
- ACCESSIBILITY_ENABLED,
ACCESSIBILITY_SCRIPT_INJECTION,
BACKUP_AUTO_RESTORE,
ENABLED_ACCESSIBILITY_SERVICES,
TOUCH_EXPLORATION_ENABLED,
+ ACCESSIBILITY_ENABLED,
TTS_USE_DEFAULTS,
TTS_DEFAULT_RATE,
TTS_DEFAULT_PITCH,
diff --git a/core/java/com/android/internal/widget/TransportControlView.java b/core/java/com/android/internal/widget/TransportControlView.java
index 1c7ad617..1042a59 100644
--- a/core/java/com/android/internal/widget/TransportControlView.java
+++ b/core/java/com/android/internal/widget/TransportControlView.java
@@ -35,6 +35,7 @@
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
+import android.os.SystemClock;
import android.text.Spannable;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
@@ -59,6 +60,7 @@
private static final int MSG_SET_ARTWORK = 103;
private static final int MSG_SET_GENERATION_ID = 104;
private static final int MAXDIM = 512;
+ private static final int DISPLAY_TIMEOUT_MS = 5000; // 5s
protected static final boolean DEBUG = true;
protected static final String TAG = "TransportControlView";
@@ -142,7 +144,7 @@
mLocalHandler = new WeakReference<Handler>(handler);
}
- public void setPlaybackState(int generationId, int state) {
+ public void setPlaybackState(int generationId, int state, long stateChangeTimeMs) {
Handler handler = mLocalHandler.get();
if (handler != null) {
handler.obtainMessage(MSG_UPDATE_STATE, generationId, state).sendToTarget();
@@ -401,4 +403,33 @@
return false;
}
+ private boolean wasPlayingRecently(int state, long stateChangeTimeMs) {
+ switch (state) {
+ case RemoteControlClient.PLAYSTATE_PLAYING:
+ case RemoteControlClient.PLAYSTATE_FAST_FORWARDING:
+ case RemoteControlClient.PLAYSTATE_REWINDING:
+ case RemoteControlClient.PLAYSTATE_SKIPPING_FORWARDS:
+ case RemoteControlClient.PLAYSTATE_SKIPPING_BACKWARDS:
+ case RemoteControlClient.PLAYSTATE_BUFFERING:
+ // actively playing or about to play
+ return true;
+ case RemoteControlClient.PLAYSTATE_NONE:
+ return false;
+ case RemoteControlClient.PLAYSTATE_STOPPED:
+ case RemoteControlClient.PLAYSTATE_PAUSED:
+ case RemoteControlClient.PLAYSTATE_ERROR:
+ // we have stopped playing, check how long ago
+ if (DEBUG) {
+ if ((SystemClock.elapsedRealtime() - stateChangeTimeMs) < DISPLAY_TIMEOUT_MS) {
+ Log.v(TAG, "wasPlayingRecently: time < TIMEOUT was playing recently");
+ } else {
+ Log.v(TAG, "wasPlayingRecently: time > TIMEOUT");
+ }
+ }
+ return ((SystemClock.elapsedRealtime() - stateChangeTimeMs) < DISPLAY_TIMEOUT_MS);
+ default:
+ Log.e(TAG, "Unknown playback state " + state + " in wasPlayingRecently()");
+ return false;
+ }
+ }
}
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 847afa0..11531fc 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -1561,8 +1561,21 @@
<enum name="xhdpi" value="320" />
</attr>
</declare-styleable>
-
-
+
+ <!-- The attribute that holds a Base64-encoded public key. -->
+ <attr name="publicKey" format="string" />
+
+ <!-- Attributes relating to a package verifier -->
+ <declare-styleable name="AndroidManifestPackageVerifier" parent="AndroidManifest">
+ <!-- Specifies the Java-style package name that defines this
+ package verifier. -->
+ <attr name="name" />
+
+ <!-- The Base64 encoded public key of the package verifier's
+ signature. -->
+ <attr name="publicKey" />
+ </declare-styleable>
+
<!-- Declaration of an {@link android.content.Intent} object in XML. May
also include zero or more {@link #IntentCategory <category> and
{@link #Extra <extra>} tags. -->
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 1e5358e..8fea35f 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -400,9 +400,9 @@
<!-- Diable lockscreen rotation by default -->
<bool name="config_enableLockScreenRotation">false</bool>
- <!-- Diable puk unlockscreen by default.
+ <!-- Enable puk unlockscreen by default.
If unlock screen is disabled, the puk should be unlocked through Emergency Dialer -->
- <bool name="config_enable_puk_unlock_screen">false</bool>
+ <bool name="config_enable_puk_unlock_screen">true</bool>
<!-- Control the behavior when the user long presses the home button.
0 - Nothing
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 848fb8b..97d5afe 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1768,6 +1768,7 @@
<public type="attr" name="listPreferredItemPaddingLeft" id="0x010103a3" />
<public type="attr" name="listPreferredItemPaddingRight" id="0x010103a4" />
<public type="attr" name="requiresFadingEdge" id="0x010103a5" />
+ <public type="attr" name="publicKey" id="0x010103a6" />
<public type="style" name="TextAppearance.SuggestionHighlight" id="0x01030118" />
<public type="style" name="Theme.Holo.Light.DarkActionBar" id="0x01030119" />
diff --git a/data/fonts/AndroidClock.ttf b/data/fonts/AndroidClock.ttf
index 7ebc963..3fa6d88 100644
--- a/data/fonts/AndroidClock.ttf
+++ b/data/fonts/AndroidClock.ttf
Binary files differ
diff --git a/data/fonts/AndroidClock_Highlight.ttf b/data/fonts/AndroidClock_Highlight.ttf
index 7ebc963..3fa6d88 100644
--- a/data/fonts/AndroidClock_Highlight.ttf
+++ b/data/fonts/AndroidClock_Highlight.ttf
Binary files differ
diff --git a/data/fonts/AndroidClock_Solid.ttf b/data/fonts/AndroidClock_Solid.ttf
index 7ebc963..3fa6d88 100644
--- a/data/fonts/AndroidClock_Solid.ttf
+++ b/data/fonts/AndroidClock_Solid.ttf
Binary files differ
diff --git a/media/java/android/media/IRemoteControlDisplay.aidl b/media/java/android/media/IRemoteControlDisplay.aidl
index e15b07c..204de3c 100644
--- a/media/java/android/media/IRemoteControlDisplay.aidl
+++ b/media/java/android/media/IRemoteControlDisplay.aidl
@@ -40,7 +40,7 @@
void setCurrentClientId(int clientGeneration, in PendingIntent clientMediaIntent,
boolean clearing);
- void setPlaybackState(int generationId, int state);
+ void setPlaybackState(int generationId, int state, long stateChangeTimeMs);
void setTransportControlFlags(int generationId, int transportControlFlags);
diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java
index 5dea87f..198ae4c 100644
--- a/media/java/android/media/RemoteControlClient.java
+++ b/media/java/android/media/RemoteControlClient.java
@@ -29,6 +29,7 @@
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
+import android.os.SystemClock;
import android.util.Log;
import java.lang.IllegalArgumentException;
@@ -494,11 +495,15 @@
*/
public void setPlaybackState(int state) {
synchronized(mCacheLock) {
- // store locally
- mPlaybackState = state;
+ if (mPlaybackState != state) {
+ // store locally
+ mPlaybackState = state;
+ // keep track of when the state change occurred
+ mPlaybackStateChangeTimeMs = SystemClock.elapsedRealtime();
- // send to remote control display if conditions are met
- sendPlaybackState_syncCacheLock();
+ // send to remote control display if conditions are met
+ sendPlaybackState_syncCacheLock();
+ }
}
}
@@ -534,6 +539,11 @@
*/
private int mPlaybackState = PLAYSTATE_NONE;
/**
+ * Time of last play state change
+ * Access synchronized on mCacheLock
+ */
+ private long mPlaybackStateChangeTimeMs = 0;
+ /**
* Cache for the artwork bitmap.
* Access synchronized on mCacheLock
* Artwork and metadata are not kept in one Bundle because the bitmap sometimes needs to be
@@ -716,7 +726,8 @@
private void sendPlaybackState_syncCacheLock() {
if ((mCurrentClientGenId == mInternalClientGenId) && (mRcDisplay != null)) {
try {
- mRcDisplay.setPlaybackState(mInternalClientGenId, mPlaybackState);
+ mRcDisplay.setPlaybackState(mInternalClientGenId, mPlaybackState,
+ mPlaybackStateChangeTimeMs);
} catch (RemoteException e) {
Log.e(TAG, "Error in setPlaybackState(), dead display "+e);
detachFromDisplay_syncCacheLock();
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index 4f39e69..b851ab7 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -16,6 +16,21 @@
package com.android.providers.settings;
+import android.app.backup.BackupAgentHelper;
+import android.app.backup.BackupDataInput;
+import android.app.backup.BackupDataOutput;
+import android.app.backup.FullBackupDataOutput;
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+import android.net.wifi.WifiManager;
+import android.os.FileUtils;
+import android.os.ParcelFileDescriptor;
+import android.os.Process;
+import android.provider.Settings;
+import android.util.Log;
+
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -27,28 +42,13 @@
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
-import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
import java.util.zip.CRC32;
-import android.app.backup.BackupDataInput;
-import android.app.backup.BackupDataOutput;
-import android.app.backup.BackupAgentHelper;
-import android.app.backup.FullBackupDataOutput;
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
-import android.net.Uri;
-import android.net.wifi.WifiManager;
-import android.os.FileUtils;
-import android.os.ParcelFileDescriptor;
-import android.os.Process;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.Log;
-
/**
* Performs backup and restore of the System and Secure settings.
* List of settings that are backed up are stored in the Settings.java file
@@ -79,8 +79,7 @@
// Versioning of the 'full backup' format
private static final int FULL_BACKUP_VERSION = 1;
- private static String[] sortedSystemKeys = null;
- private static String[] sortedSecureKeys = null;
+ private static final int INTEGER_BYTE_COUNT = Integer.SIZE / Byte.SIZE;
private static final byte[] EMPTY_DATA = new byte[0];
@@ -112,6 +111,7 @@
private WifiManager mWfm;
private static String mWifiConfigFile;
+ @Override
public void onCreate() {
if (DEBUG_BACKUP) Log.d(TAG, "onCreate() invoked");
@@ -348,26 +348,17 @@
}
private byte[] getSystemSettings() {
- Cursor sortedCursor = getContentResolver().query(Settings.System.CONTENT_URI, PROJECTION,
- null, null, Settings.NameValueTable.NAME);
- // Copy and sort the array
- if (sortedSystemKeys == null) {
- sortedSystemKeys = copyAndSort(Settings.System.SETTINGS_TO_BACKUP);
- }
- byte[] result = extractRelevantValues(sortedCursor, sortedSystemKeys);
- sortedCursor.close();
+ Cursor cursor = getContentResolver().query(Settings.System.CONTENT_URI, PROJECTION, null,
+ null, null);
+ byte[] result = extractRelevantValues(cursor, Settings.System.SETTINGS_TO_BACKUP);
+ cursor.close();
return result;
}
private byte[] getSecureSettings() {
- Cursor sortedCursor = getContentResolver().query(Settings.Secure.CONTENT_URI, PROJECTION,
- null, null, Settings.NameValueTable.NAME);
- // Copy and sort the array
- if (sortedSecureKeys == null) {
- sortedSecureKeys = copyAndSort(Settings.Secure.SETTINGS_TO_BACKUP);
- }
- byte[] result = extractRelevantValues(sortedCursor, sortedSecureKeys);
- sortedCursor.close();
+ Cursor cursor = getContentResolver().query(Settings.Secure.CONTENT_URI, PROJECTION, null,
+ null, null);
+ byte[] result = extractRelevantValues(cursor, Settings.Secure.SETTINGS_TO_BACKUP);
return result;
}
@@ -383,119 +374,132 @@
}
private void restoreSettings(byte[] settings, int bytes, Uri contentUri) {
- if (DEBUG) Log.i(TAG, "restoreSettings: " + contentUri);
+ if (DEBUG) {
+ Log.i(TAG, "restoreSettings: " + contentUri);
+ }
+
+ // Figure out the white list.
String[] whitelist = null;
if (contentUri.equals(Settings.Secure.CONTENT_URI)) {
whitelist = Settings.Secure.SETTINGS_TO_BACKUP;
} else if (contentUri.equals(Settings.System.CONTENT_URI)) {
whitelist = Settings.System.SETTINGS_TO_BACKUP;
+ } else {
+ throw new IllegalArgumentException("Unknown URI: " + contentUri);
}
- ContentValues cv = new ContentValues(2);
+ // Restore only the white list data.
int pos = 0;
- while (pos < bytes) {
- int length = readInt(settings, pos);
- pos += 4;
- String settingName = length > 0? new String(settings, pos, length) : null;
- pos += length;
- length = readInt(settings, pos);
- pos += 4;
- String settingValue = length > 0? new String(settings, pos, length) : null;
- pos += length;
- if (!TextUtils.isEmpty(settingName) && !TextUtils.isEmpty(settingValue)) {
- //Log.i(TAG, "Restore " + settingName + " = " + settingValue);
+ Map<String, String> cachedEntries = new HashMap<String, String>();
+ ContentValues contentValues = new ContentValues(2);
+ SettingsHelper settingsHelper = mSettingsHelper;
- // Only restore settings in our list of known-acceptable data
- if (invalidSavedSetting(whitelist, settingName)) {
- continue;
- }
+ final int whiteListSize = whitelist.length;
+ for (int i = 0; i < whiteListSize; i++) {
+ String key = whitelist[i];
+ String value = cachedEntries.remove(key);
- if (mSettingsHelper.restoreValue(settingName, settingValue)) {
- cv.clear();
- cv.put(Settings.NameValueTable.NAME, settingName);
- cv.put(Settings.NameValueTable.VALUE, settingValue);
- getContentResolver().insert(contentUri, cv);
+ // If the value not cached, let us look it up.
+ if (value == null) {
+ while (pos < bytes) {
+ int length = readInt(settings, pos);
+ pos += INTEGER_BYTE_COUNT;
+ String dataKey = length > 0 ? new String(settings, pos, length) : null;
+ pos += length;
+ length = readInt(settings, pos);
+ pos += INTEGER_BYTE_COUNT;
+ String dataValue = length > 0 ? new String(settings, pos, length) : null;
+ pos += length;
+ if (key.equals(dataKey)) {
+ value = dataValue;
+ break;
+ }
+ cachedEntries.put(dataKey, dataValue);
}
}
- }
- }
- // Returns 'true' if the given setting is one that we refuse to restore
- private boolean invalidSavedSetting(String[] knownNames, String candidate) {
- // no filter? allow everything
- if (knownNames == null) {
- return false;
- }
+ if (value == null) {
+ continue;
+ }
- // whitelisted setting? allow it
- for (String name : knownNames) {
- if (name.equals(candidate)) {
- return false;
+ if (settingsHelper.restoreValue(key, value)) {
+ contentValues.clear();
+ contentValues.put(Settings.NameValueTable.NAME, key);
+ contentValues.put(Settings.NameValueTable.VALUE, value);
+ getContentResolver().insert(contentUri, contentValues);
+ }
+
+ if (DEBUG) {
+ Log.d(TAG, "Restored setting: " + key + "=" + value);
}
}
-
- // refuse everything else
- if (DEBUG) Log.v(TAG, "Ignoring restore datum: " + candidate);
- return true;
- }
-
- private String[] copyAndSort(String[] keys) {
- String[] sortedKeys = new String[keys.length];
- System.arraycopy(keys, 0, sortedKeys, 0, keys.length);
- Arrays.sort(sortedKeys);
- return sortedKeys;
}
/**
- * Given a cursor sorted by key name and a set of keys sorted by name,
- * extract the required keys and values and write them to a byte array.
- * @param sortedCursor
- * @param sortedKeys
- * @return
+ * Given a cursor and a set of keys, extract the required keys and
+ * values and write them to a byte array.
+ *
+ * @param cursor A cursor with settings data.
+ * @param settings The settings to extract.
+ * @return The byte array of extracted values.
*/
- byte[] extractRelevantValues(Cursor sortedCursor, String[] sortedKeys) {
- byte[][] values = new byte[sortedKeys.length * 2][]; // keys and values
- if (!sortedCursor.moveToFirst()) {
+ private byte[] extractRelevantValues(Cursor cursor, String[] settings) {
+ final int settingsCount = settings.length;
+ byte[][] values = new byte[settingsCount * 2][]; // keys and values
+ if (!cursor.moveToFirst()) {
Log.e(TAG, "Couldn't read from the cursor");
return new byte[0];
}
- int keyIndex = 0;
+
+ // Obtain the relevant data in a temporary array.
int totalSize = 0;
- while (!sortedCursor.isAfterLast()) {
- String name = sortedCursor.getString(COLUMN_NAME);
- while (sortedKeys[keyIndex].compareTo(name.toString()) < 0) {
- keyIndex++;
- if (keyIndex == sortedKeys.length) break;
- }
- if (keyIndex < sortedKeys.length && name.equals(sortedKeys[keyIndex])) {
- String value = sortedCursor.getString(COLUMN_VALUE);
- byte[] nameBytes = name.toString().getBytes();
- totalSize += 4 + nameBytes.length;
- values[keyIndex * 2] = nameBytes;
- byte[] valueBytes;
- if (TextUtils.isEmpty(value)) {
- valueBytes = null;
- totalSize += 4;
- } else {
- valueBytes = value.toString().getBytes();
- totalSize += 4 + valueBytes.length;
- //Log.i(TAG, "Backing up " + name + " = " + value);
+ int backedUpSettingIndex = 0;
+ Map<String, String> cachedEntries = new HashMap<String, String>();
+ for (int i = 0; i < settingsCount; i++) {
+ String key = settings[i];
+ String value = cachedEntries.remove(key);
+
+ // If the value not cached, let us look it up.
+ if (value == null) {
+ while (!cursor.isAfterLast()) {
+ String cursorKey = cursor.getString(COLUMN_NAME);
+ String cursorValue = cursor.getString(COLUMN_VALUE);
+ cursor.moveToNext();
+ if (key.equals(cursorKey)) {
+ value = cursorValue;
+ break;
+ }
+ cachedEntries.put(cursorKey, cursorValue);
}
- values[keyIndex * 2 + 1] = valueBytes;
- keyIndex++;
}
- if (keyIndex == sortedKeys.length || !sortedCursor.moveToNext()) {
- break;
+
+ if (value == null) {
+ continue;
+ }
+
+ // Write the key and value in the intermediary array.
+ byte[] keyBytes = key.getBytes();
+ totalSize += INTEGER_BYTE_COUNT + keyBytes.length;
+ values[backedUpSettingIndex * 2] = keyBytes;
+
+ byte[] valueBytes = value.getBytes();
+ totalSize += INTEGER_BYTE_COUNT + valueBytes.length;
+ values[backedUpSettingIndex * 2 + 1] = valueBytes;
+
+ backedUpSettingIndex++;
+
+ if (DEBUG) {
+ Log.d(TAG, "Backed up setting: " + key + "=" + value);
}
}
+ // Aggregate the result.
byte[] result = new byte[totalSize];
int pos = 0;
- for (int i = 0; i < sortedKeys.length * 2; i++) {
- if (values[i] != null) {
- pos = writeInt(result, pos, values[i].length);
- pos = writeBytes(result, pos, values[i]);
- }
+ final int keyValuePairCount = backedUpSettingIndex * 2;
+ for (int i = 0; i < keyValuePairCount; i++) {
+ pos = writeInt(result, pos, values[i].length);
+ pos = writeBytes(result, pos, values[i]);
}
return result;
}
@@ -647,14 +651,14 @@
* @param out byte array
* @param pos current pos in array
* @param value integer to write
- * @return the index after adding the size of an int (4)
+ * @return the index after adding the size of an int (4) in bytes.
*/
private int writeInt(byte[] out, int pos, int value) {
out[pos + 0] = (byte) ((value >> 24) & 0xFF);
out[pos + 1] = (byte) ((value >> 16) & 0xFF);
out[pos + 2] = (byte) ((value >> 8) & 0xFF);
out[pos + 3] = (byte) ((value >> 0) & 0xFF);
- return pos + 4;
+ return pos + INTEGER_BYTE_COUNT;
}
private int writeBytes(byte[] out, int pos, byte[] value) {
diff --git a/packages/SystemUI/res/drawable-hdpi/battery_low_battery.png b/packages/SystemUI/res/drawable-hdpi/battery_low_battery.png
index caa8795..5107bd1 100644
--- a/packages/SystemUI/res/drawable-hdpi/battery_low_battery.png
+++ b/packages/SystemUI/res/drawable-hdpi/battery_low_battery.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_sync.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_sync.png
new file mode 100644
index 0000000..ba2d78a
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_sync.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_sync_error.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_sync_error.png
new file mode 100644
index 0000000..1102846
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_sync_error.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/battery_low_battery.png b/packages/SystemUI/res/drawable-mdpi/battery_low_battery.png
index 3de53d8..ecc909a 100644
--- a/packages/SystemUI/res/drawable-mdpi/battery_low_battery.png
+++ b/packages/SystemUI/res/drawable-mdpi/battery_low_battery.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_sync.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_sync.png
new file mode 100644
index 0000000..6649031
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_sync.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_sync_error.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_sync_error.png
new file mode 100644
index 0000000..1b57936
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_sync_error.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/battery_low_battery.png b/packages/SystemUI/res/drawable-xhdpi/battery_low_battery.png
index 9b02609..f3c0fca 100644
--- a/packages/SystemUI/res/drawable-xhdpi/battery_low_battery.png
+++ b/packages/SystemUI/res/drawable-xhdpi/battery_low_battery.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_sync.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_sync.png
new file mode 100644
index 0000000..fb691fc
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/stat_sys_sync.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_sync_error.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_sync_error.png
new file mode 100644
index 0000000..0c7ba35
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/stat_sys_sync_error.png
Binary files differ
diff --git a/packages/SystemUI/res/layout/battery_low.xml b/packages/SystemUI/res/layout/battery_low.xml
index 3b62fb0..3061743 100644
--- a/packages/SystemUI/res/layout/battery_low.xml
+++ b/packages/SystemUI/res/layout/battery_low.xml
@@ -22,13 +22,13 @@
android:id="@+id/padding"
android:orientation="vertical"
android:gravity="center"
+ android:padding="16dp"
>
<TextView android:id="@+id/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textSize="18dp"
- android:paddingLeft="19dp"
+ android:textSize="18sp"
android:textColor="#ffffffff"
android:gravity="left"
android:text="@string/battery_low_subtitle"
@@ -37,19 +37,16 @@
<TextView android:id="@+id/level_percent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textSize="18dp"
+ android:textSize="18sp"
android:textColor="#ffffffff"
android:gravity="left"
- android:paddingBottom="10px"
- android:paddingLeft="19dp"
+ android:paddingBottom="16dp"
/>
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingBottom="15px"
android:src="@drawable/battery_low_battery"
- android:paddingTop="10px"
/>
</LinearLayout>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index ee270f9..05e171c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -165,10 +165,8 @@
mService.setIconVisibility("alarm_clock", false);
// Sync state
- mService.setIcon("sync_active", com.android.internal.R.drawable.stat_notify_sync_anim0,
- 0, null);
- mService.setIcon("sync_failing", com.android.internal.R.drawable.stat_notify_sync_error,
- 0, null);
+ mService.setIcon("sync_active", R.drawable.stat_sys_sync, 0, null);
+ mService.setIcon("sync_failing", R.drawable.stat_sys_sync_error, 0, null);
mService.setIconVisibility("sync_active", false);
mService.setIconVisibility("sync_failing", false);
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 958f555..2a23709 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -484,6 +484,9 @@
public void registerInfoCallback(InfoCallback callback) {
if (!mInfoCallbacks.contains(callback)) {
mInfoCallbacks.add(callback);
+ // notify the register the current state right away
+ // TODO: need call other callback methods
+ callback.onRefreshCarrierInfo(mTelephonyPlmn, mTelephonySpn);
} else {
if (DEBUG) Log.e(TAG, "Object tried to add another INFO callback",
new Exception("Whoops"));
@@ -497,6 +500,10 @@
public void registerSimStateCallback(SimStateCallback callback) {
if (!mSimStateCallbacks.contains(callback)) {
mSimStateCallbacks.add(callback);
+ // notify the register the current sim state right away,
+ // otherwise the register won't receive any state until
+ // sim state gets changed again.
+ callback.onSimStateChanged(mSimState);
} else {
if (DEBUG) Log.e(TAG, "Object tried to add another SIM callback",
new Exception("Whoops"));
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 1d311d6..e2a1149 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -531,7 +531,8 @@
mShowLockBeforeUnlock = resources.getBoolean(R.bool.config_enableLockBeforeUnlockScreen);
mConfiguration = newConfig;
if (DEBUG_CONFIGURATION) Log.v(TAG, "**** re-creating lock screen since config changed");
- updateScreen(mMode, true /* force */);
+ removeCallbacks(mRecreateRunnable);
+ post(mRecreateRunnable);
}
@Override
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index e0a2adc..23fab72 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -97,7 +97,7 @@
public class ConnectivityService extends IConnectivityManager.Stub {
private static final boolean DBG = true;
- private static final boolean VDBG = true;
+ private static final boolean VDBG = false;
private static final String TAG = "ConnectivityService";
private static final boolean LOGD_RULES = false;
@@ -867,7 +867,7 @@
// javadoc from interface
public int startUsingNetworkFeature(int networkType, String feature,
IBinder binder) {
- if (DBG) {
+ if (VDBG) {
log("startUsingNetworkFeature for net " + networkType + ": " + feature);
}
enforceChangePermission();
@@ -933,17 +933,19 @@
if (ni.isConnected() == true) {
// add the pid-specific dns
handleDnsConfigurationChange(usedNetworkType);
- if (DBG) log("special network already active");
+ if (VDBG) log("special network already active");
return Phone.APN_ALREADY_ACTIVE;
}
- if (DBG) log("special network already connecting");
+ if (VDBG) log("special network already connecting");
return Phone.APN_REQUEST_STARTED;
}
// check if the radio in play can make another contact
// assume if cannot for now
- if (DBG) log("reconnecting to special network");
+ if (DBG) {
+ log("startUsingNetworkFeature reconnecting to " + networkType + ": " + feature);
+ }
network.reconnect();
return Phone.APN_REQUEST_STARTED;
} else {
@@ -985,7 +987,7 @@
return stopUsingNetworkFeature(u, true);
} else {
// none found!
- if (VDBG) log("ignoring stopUsingNetworkFeature - not a live request");
+ if (VDBG) log("stopUsingNetworkFeature - not a live request, ignoring");
return 1;
}
}
@@ -999,12 +1001,15 @@
NetworkStateTracker tracker = null;
boolean callTeardown = false; // used to carry our decision outside of sync block
- if (DBG) {
- log("stopUsingNetworkFeature for net " + networkType +
- ": " + feature);
+ if (VDBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature);
}
if (!ConnectivityManager.isNetworkTypeValid(networkType)) {
+ if (DBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
+ ", net is invalid");
+ }
return -1;
}
@@ -1013,7 +1018,10 @@
synchronized(this) {
// check if this process still has an outstanding start request
if (!mFeatureUsers.contains(u)) {
- if (DBG) log("ignoring - this process has no outstanding requests");
+ if (VDBG) {
+ log("stopUsingNetworkFeature: this process has no outstanding requests" +
+ ", ignoring");
+ }
return 1;
}
u.unlinkDeathRecipient();
@@ -1028,7 +1036,7 @@
if (ignoreDups == false) {
for (FeatureUser x : mFeatureUsers) {
if (x.isSameUser(u)) {
- if (DBG) log("ignoring stopUsingNetworkFeature as dup is found");
+ if (VDBG) log("stopUsingNetworkFeature: dup is found, ignoring");
return 1;
}
}
@@ -1039,7 +1047,10 @@
tracker = mNetTrackers[usedNetworkType];
if (tracker == null) {
- if (DBG) log("ignoring - no known tracker for net type " + usedNetworkType);
+ if (DBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
+ " no known tracker for used net type " + usedNetworkType);
+ }
return -1;
}
if (usedNetworkType != networkType) {
@@ -1047,17 +1058,25 @@
mNetRequestersPids[usedNetworkType].remove(currentPid);
reassessPidDns(pid, true);
if (mNetRequestersPids[usedNetworkType].size() != 0) {
- if (DBG) log("not tearing down special network - " +
- "others still using it");
+ if (VDBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
+ " others still using it");
+ }
return 1;
}
callTeardown = true;
} else {
- if (DBG) log("not a known feature - dropping");
+ if (DBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
+ " not a known feature - dropping");
+ }
}
}
- if (DBG) log("Doing network teardown");
+
if (callTeardown) {
+ if (DBG) {
+ log("stopUsingNetworkFeature: teardown net " + networkType + ": " + feature);
+ }
tracker.teardown();
return 1;
} else {
@@ -1592,7 +1611,7 @@
mInitialBroadcast = new Intent(intent);
}
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
- if (DBG) {
+ if (VDBG) {
log("sendStickyBroadcast: action=" + intent.getAction());
}
@@ -1604,7 +1623,7 @@
if (delayMs <= 0) {
sendStickyBroadcast(intent);
} else {
- if (DBG) {
+ if (VDBG) {
log("sendStickyBroadcastDelayed: delayMs=" + delayMs + ", action="
+ intent.getAction());
}
@@ -1779,12 +1798,12 @@
}
}
if (resetDns) {
- if (DBG) log("resetting DNS cache for " + iface);
+ if (VDBG) log("resetting DNS cache for " + iface);
try {
mNetd.flushInterfaceDnsCache(iface);
} catch (Exception e) {
// never crash - catch them all
- loge("Exception resetting dns cache: " + e);
+ if (DBG) loge("Exception resetting dns cache: " + e);
}
}
}
@@ -1840,12 +1859,12 @@
// remove the default route unless somebody else has asked for it
String ifaceName = newLp.getInterfaceName();
if (TextUtils.isEmpty(ifaceName) == false && mAddedRoutes.contains(r) == false) {
- if (DBG) log("Removing " + r + " for interface " + ifaceName);
+ if (VDBG) log("Removing " + r + " for interface " + ifaceName);
try {
mNetd.removeRoute(ifaceName, r);
} catch (Exception e) {
// never crash - catch them all
- loge("Exception trying to remove a route: " + e);
+ if (VDBG) loge("Exception trying to remove a route: " + e);
}
}
}
@@ -2059,7 +2078,7 @@
mNetd.setDnsServersForInterface(iface, NetworkUtils.makeStrings(dnses));
mNetd.setDefaultInterfaceForDns(iface);
} catch (Exception e) {
- loge("exception setting default dns interface: " + e);
+ if (VDBG) loge("exception setting default dns interface: " + e);
}
}
if (!domains.equals(SystemProperties.get("net.dns.search"))) {
@@ -2089,7 +2108,7 @@
mNetd.setDnsServersForInterface(p.getInterfaceName(),
NetworkUtils.makeStrings(dnses));
} catch (Exception e) {
- loge("exception setting dns servers: " + e);
+ if (VDBG) loge("exception setting dns servers: " + e);
}
// set per-pid dns for attached secondary nets
List pids = mNetRequestersPids[netType];
@@ -2194,9 +2213,12 @@
int type = info.getType();
NetworkInfo.State state = info.getState();
- if (DBG) log("ConnectivityChange for " +
+ if (VDBG || (state == NetworkInfo.State.CONNECTED) ||
+ (state == NetworkInfo.State.DISCONNECTED)) {
+ log("ConnectivityChange for " +
info.getTypeName() + ": " +
state + "/" + info.getDetailedState());
+ }
// Connectivity state changed:
// [31-13] Reserved for future use
@@ -2458,23 +2480,24 @@
}
private void handleInetConditionChange(int netType, int condition) {
- if (DBG) {
- log("Inet connectivity change, net=" +
- netType + ", condition=" + condition +
- ",mActiveDefaultNetwork=" + mActiveDefaultNetwork);
- }
if (mActiveDefaultNetwork == -1) {
- if (DBG) log("no active default network - aborting");
+ if (DBG) log("handleInetConditionChange: no active default network - ignore");
return;
}
if (mActiveDefaultNetwork != netType) {
- if (DBG) log("given net not default - aborting");
+ if (DBG) log("handleInetConditionChange: net=" + netType +
+ " != default=" + mActiveDefaultNetwork + " - ignore");
return;
}
+ if (VDBG) {
+ log("handleInetConditionChange: net=" +
+ netType + ", condition=" + condition +
+ ",mActiveDefaultNetwork=" + mActiveDefaultNetwork);
+ }
mDefaultInetCondition = condition;
int delay;
if (mInetConditionChangeInFlight == false) {
- if (VDBG) log("starting a change hold");
+ if (VDBG) log("handleInetConditionChange: starting a change hold");
// setup a new hold to debounce this
if (mDefaultInetCondition > 50) {
delay = Settings.Secure.getInt(mContext.getContentResolver(),
@@ -2487,26 +2510,25 @@
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END,
mActiveDefaultNetwork, mDefaultConnectionSequence), delay);
} else {
- // we've set the new condition, when this hold ends that will get
- // picked up
- if (VDBG) log("currently in hold - not setting new end evt");
+ // we've set the new condition, when this hold ends that will get picked up
+ if (VDBG) log("handleInetConditionChange: currently in hold - not setting new end evt");
}
}
private void handleInetConditionHoldEnd(int netType, int sequence) {
- if (VDBG) {
- log("Inet hold end, net=" + netType +
- ", condition =" + mDefaultInetCondition +
- ", published condition =" + mDefaultInetConditionPublished);
+ if (DBG) {
+ log("handleInetConditionHoldEnd: net=" + netType +
+ ", condition=" + mDefaultInetCondition +
+ ", published condition=" + mDefaultInetConditionPublished);
}
mInetConditionChangeInFlight = false;
if (mActiveDefaultNetwork == -1) {
- if (DBG) log("no active default network - aborting");
+ if (DBG) log("handleInetConditionHoldEnd: no active default network - ignoring");
return;
}
if (mDefaultConnectionSequence != sequence) {
- if (DBG) log("event hold for obsolete network - aborting");
+ if (DBG) log("handleInetConditionHoldEnd: event hold for obsolete network - ignoring");
return;
}
// TODO: Figure out why this optimization sometimes causes a
@@ -2518,7 +2540,7 @@
//}
NetworkInfo networkInfo = mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
if (networkInfo.isConnected() == false) {
- if (DBG) log("default network not connected - aborting");
+ if (DBG) log("handleInetConditionHoldEnd: default network not connected - ignoring");
return;
}
mDefaultInetConditionPublished = mDefaultInetCondition;
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 0cffb15..6fcf399 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -560,8 +560,10 @@
+ e);
}
- for (String line : rsp) {
- Log.v(TAG, "add route response is " + line);
+ if (DBG) {
+ for (String line : rsp) {
+ Log.v(TAG, "add route response is " + line);
+ }
}
}
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index bc256ed..8c8e725 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -53,6 +53,7 @@
*/
class TelephonyRegistry extends ITelephonyRegistry.Stub {
private static final String TAG = "TelephonyRegistry";
+ private static final boolean DBG = false;
private static class Record {
String pkgForDebug;
@@ -387,9 +388,11 @@
if (!checkNotifyPermission("notifyDataConnection()" )) {
return;
}
- Slog.i(TAG, "notifyDataConnection: state=" + state + " isDataConnectivityPossible="
+ if (DBG) {
+ Slog.i(TAG, "notifyDataConnection: state=" + state + " isDataConnectivityPossible="
+ isDataConnectivityPossible + " reason='" + reason
+ "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType);
+ }
synchronized (mRecords) {
boolean modified = false;
if (state == TelephonyManager.DATA_CONNECTED) {
@@ -421,8 +424,10 @@
modified = true;
}
if (modified) {
- Slog.d(TAG, "onDataConnectionStateChanged(" + mDataConnectionState
+ if (DBG) {
+ Slog.d(TAG, "onDataConnectionStateChanged(" + mDataConnectionState
+ ", " + mDataConnectionNetworkType + ")");
+ }
for (Record r : mRecords) {
if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
try {
@@ -639,7 +644,7 @@
}
String msg = "Modify Phone State Permission Denial: " + method + " from pid="
+ Binder.getCallingPid() + ", uid=" + Binder.getCallingUid();
- Slog.w(TAG, msg);
+ if (DBG) Slog.w(TAG, msg);
return false;
}
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index 5286824..10f6d2c 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -71,7 +71,8 @@
private Context mContext;
private final static String TAG = "Tethering";
- private final static boolean DEBUG = true;
+ private final static boolean DBG = true;
+ private final static boolean VDBG = false;
// TODO - remove both of these - should be part of interface inspection/selection stuff
private String[] mTetherableUsbRegexs;
@@ -178,7 +179,7 @@
}
public void interfaceStatusChanged(String iface, boolean up) {
- if (DEBUG) Log.d(TAG, "interfaceStatusChanged " + iface + ", " + up);
+ if (VDBG) Log.d(TAG, "interfaceStatusChanged " + iface + ", " + up);
boolean found = false;
boolean usb = false;
if (isWifi(iface)) {
@@ -203,7 +204,7 @@
if (isUsb(iface)) {
// ignore usb0 down after enabling RNDIS
// we will handle disconnect in interfaceRemoved instead
- Log.d(TAG, "ignoring interface down for " + iface);
+ if (VDBG) Log.d(TAG, "ignoring interface down for " + iface);
} else if (sm != null) {
sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
mIfaces.remove(iface);
@@ -213,7 +214,7 @@
}
public void interfaceLinkStateChanged(String iface, boolean up) {
- if (DEBUG) Log.d(TAG, "interfaceLinkStateChanged " + iface + ", " + up);
+ if (VDBG) Log.d(TAG, "interfaceLinkStateChanged " + iface + ", " + up);
interfaceStatusChanged(iface, up);
}
@@ -239,7 +240,7 @@
}
public void interfaceAdded(String iface) {
- if (DEBUG) Log.d(TAG, "interfaceAdded " + iface);
+ if (VDBG) Log.d(TAG, "interfaceAdded " + iface);
boolean found = false;
boolean usb = false;
if (isWifi(iface)) {
@@ -253,29 +254,29 @@
found = true;
}
if (found == false) {
- if (DEBUG) Log.d(TAG, iface + " is not a tetherable iface, ignoring");
+ if (VDBG) Log.d(TAG, iface + " is not a tetherable iface, ignoring");
return;
}
synchronized (mIfaces) {
TetherInterfaceSM sm = mIfaces.get(iface);
if (sm != null) {
- if (DEBUG) Log.d(TAG, "active iface (" + iface + ") reported as added, ignoring");
+ if (VDBG) Log.d(TAG, "active iface (" + iface + ") reported as added, ignoring");
return;
}
sm = new TetherInterfaceSM(iface, mLooper, usb);
mIfaces.put(iface, sm);
sm.start();
}
- if (DEBUG) Log.d(TAG, "interfaceAdded :" + iface);
+ if (VDBG) Log.d(TAG, "interfaceAdded :" + iface);
}
public void interfaceRemoved(String iface) {
- if (DEBUG) Log.d(TAG, "interfaceRemoved " + iface);
+ if (VDBG) Log.d(TAG, "interfaceRemoved " + iface);
synchronized (mIfaces) {
TetherInterfaceSM sm = mIfaces.get(iface);
if (sm == null) {
- if (DEBUG) {
+ if (VDBG) {
Log.e(TAG, "attempting to remove unknown iface (" + iface + "), ignoring");
}
return;
@@ -288,7 +289,7 @@
public void limitReached(String limitName, String iface) {}
public int tether(String iface) {
- Log.d(TAG, "Tethering " + iface);
+ if (DBG) Log.d(TAG, "Tethering " + iface);
TetherInterfaceSM sm = null;
synchronized (mIfaces) {
sm = mIfaces.get(iface);
@@ -306,7 +307,7 @@
}
public int untether(String iface) {
- Log.d(TAG, "Untethering " + iface);
+ if (DBG) Log.d(TAG, "Untethering " + iface);
TetherInterfaceSM sm = null;
synchronized (mIfaces) {
sm = mIfaces.get(iface);
@@ -383,7 +384,7 @@
broadcast.putStringArrayListExtra(ConnectivityManager.EXTRA_ERRORED_TETHER,
erroredList);
mContext.sendStickyBroadcast(broadcast);
- if (DEBUG) {
+ if (VDBG) {
Log.d(TAG, "sendTetherStateChangedBroadcast " + availableList.size() + ", " +
activeList.size() + ", " + erroredList.size());
}
@@ -468,14 +469,14 @@
mUsbTetherRequested = false;
}
} else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
- if (DEBUG) Log.d(TAG, "Tethering got CONNECTIVITY_ACTION");
+ if (VDBG) Log.d(TAG, "Tethering got CONNECTIVITY_ACTION");
mTetherMasterSM.sendMessage(TetherMasterSM.CMD_UPSTREAM_CHANGED);
}
}
}
private void tetherUsb(boolean enable) {
- if (DEBUG) Log.d(TAG, "tetherUsb " + enable);
+ if (VDBG) Log.d(TAG, "tetherUsb " + enable);
String[] ifaces = new String[0];
try {
@@ -497,7 +498,7 @@
// configured when we start tethering and unconfig'd on error or conclusion
private boolean configureUsbIface(boolean enabled) {
- if (DEBUG) Log.d(TAG, "configureUsbIface(" + enabled + ")");
+ if (VDBG) Log.d(TAG, "configureUsbIface(" + enabled + ")");
// toggle the USB interfaces
String[] ifaces = new String[0];
@@ -547,7 +548,7 @@
}
public int setUsbTethering(boolean enable) {
- if (DEBUG) Log.d(TAG, "setUsbTethering(" + enable + ")");
+ if (VDBG) Log.d(TAG, "setUsbTethering(" + enable + ")");
UsbManager usbManager = (UsbManager)mContext.getSystemService(Context.USB_SERVICE);
synchronized (this) {
@@ -808,7 +809,7 @@
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "InitialState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "InitialState.processMessage what=" + message.what);
boolean retValue = true;
switch (message.what) {
case CMD_TETHER_REQUESTED:
@@ -849,7 +850,7 @@
}
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "StartingState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "StartingState.processMessage what=" + message.what);
boolean retValue = true;
switch (message.what) {
// maybe a parent class?
@@ -897,14 +898,14 @@
transitionTo(mInitialState);
return;
}
- if (DEBUG) Log.d(TAG, "Tethered " + mIfaceName);
+ if (DBG) Log.d(TAG, "Tethered " + mIfaceName);
setAvailable(false);
setTethered(true);
sendTetherStateChangedBroadcast();
}
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "TetheredState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "TetheredState.processMessage what=" + message.what);
boolean retValue = true;
boolean error = false;
switch (message.what) {
@@ -944,14 +945,14 @@
} else if (message.what == CMD_INTERFACE_DOWN) {
transitionTo(mUnavailableState);
}
- if (DEBUG) Log.d(TAG, "Untethered " + mIfaceName);
+ if (DBG) Log.d(TAG, "Untethered " + mIfaceName);
break;
case CMD_TETHER_CONNECTION_CHANGED:
String newUpstreamIfaceName = (String)(message.obj);
if ((mMyUpstreamIfaceName == null && newUpstreamIfaceName == null) ||
(mMyUpstreamIfaceName != null &&
mMyUpstreamIfaceName.equals(newUpstreamIfaceName))) {
- if (DEBUG) Log.d(TAG, "Connection changed noop - dropping");
+ if (VDBG) Log.d(TAG, "Connection changed noop - dropping");
break;
}
if (mMyUpstreamIfaceName != null) {
@@ -1018,7 +1019,7 @@
ConnectivityManager.TETHER_ERROR_MASTER_ERROR);
break;
}
- if (DEBUG) Log.d(TAG, "Tether lost upstream connection " + mIfaceName);
+ if (VDBG) Log.d(TAG, "Tether lost upstream connection " + mIfaceName);
sendTetherStateChangedBroadcast();
if (mUsb) {
if (!Tethering.this.configureUsbIface(false)) {
@@ -1248,7 +1249,7 @@
}
}
- if (DEBUG) {
+ if (VDBG) {
Log.d(TAG, "chooseUpstreamType(" + tryCell + "), preferredApn ="
+ mPreferredUpstreamMobileApn + ", got type=" + upType);
}
@@ -1280,7 +1281,7 @@
}
protected void notifyTetheredOfNewUpstreamIface(String ifaceName) {
- if (DEBUG) Log.d(TAG, "notifying tethered with iface =" + ifaceName);
+ if (VDBG) Log.d(TAG, "notifying tethered with iface =" + ifaceName);
mUpstreamIfaceName = ifaceName;
for (Object o : mNotifyList) {
TetherInterfaceSM sm = (TetherInterfaceSM)o;
@@ -1296,19 +1297,19 @@
}
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "MasterInitialState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "MasterInitialState.processMessage what=" + message.what);
boolean retValue = true;
switch (message.what) {
case CMD_TETHER_MODE_REQUESTED:
checkDunRequired();
TetherInterfaceSM who = (TetherInterfaceSM)message.obj;
- if (DEBUG) Log.d(TAG, "Tether Mode requested by " + who.toString());
+ if (VDBG) Log.d(TAG, "Tether Mode requested by " + who.toString());
mNotifyList.add(who);
transitionTo(mTetherModeAliveState);
break;
case CMD_TETHER_MODE_UNREQUESTED:
who = (TetherInterfaceSM)message.obj;
- if (DEBUG) Log.d(TAG, "Tether Mode unrequested by " + who.toString());
+ if (VDBG) Log.d(TAG, "Tether Mode unrequested by " + who.toString());
int index = mNotifyList.indexOf(who);
if (index != -1) {
mNotifyList.remove(who);
@@ -1339,7 +1340,7 @@
}
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "TetherModeAliveState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "TetherModeAliveState.processMessage what=" + message.what);
boolean retValue = true;
switch (message.what) {
case CMD_TETHER_MODE_REQUESTED:
@@ -1368,7 +1369,7 @@
// make sure we're still using a requested connection - may have found
// wifi or something since then.
if (mCurrentConnectionSequence == message.arg1) {
- if (DEBUG) {
+ if (VDBG) {
Log.d(TAG, "renewing mobile connection - requeuing for another " +
CELL_CONNECTION_RENEW_MS + "ms");
}
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 9ebdd52..105e603 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -4849,15 +4849,14 @@
}
@Override
- public void verifyPendingInstall(int id, boolean verified, String message)
+ public void verifyPendingInstall(int id, int verificationCode)
throws RemoteException {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.PACKAGE_VERIFICATION_AGENT, null);
final Message msg = mHandler.obtainMessage(PACKAGE_VERIFIED);
msg.arg1 = id;
- msg.arg2 = verified ? 1 : 0;
- msg.obj = message;
+ msg.arg2 = verificationCode;
mHandler.sendMessage(msg);
}
diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java
index f2fb36f..3525abe 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -546,11 +546,8 @@
throw new UnsupportedOperationException();
}
- /**
- * @hide
- */
@Override
- public void verifyPendingInstall(int id, boolean verified, String failureMessage) {
+ public void verifyPendingInstall(int id, int verificationCode) {
throw new UnsupportedOperationException();
}