summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.xml195
-rw-r--r--core/java/android/app/ActivityThread.java29
-rw-r--r--core/java/android/app/ApplicationContext.java1
-rw-r--r--core/java/android/app/BackupAgent.java5
-rw-r--r--core/java/android/app/WallpaperManager.java43
-rw-r--r--core/java/android/backup/AbsoluteFileBackupHelper.java4
-rw-r--r--core/java/android/backup/FileBackupHelper.java4
-rw-r--r--core/java/android/backup/SharedPreferencesBackupHelper.java5
-rw-r--r--core/java/android/bluetooth/HeadsetBase.java5
-rw-r--r--core/java/android/content/Intent.java2
-rw-r--r--core/java/android/content/SyncStorageEngine.java2
-rw-r--r--core/java/android/content/pm/PackageParser.java95
-rw-r--r--core/java/android/hardware/Camera.java6
-rw-r--r--core/java/android/pim/vcard/ContactStruct.java12
-rw-r--r--core/java/android/pim/vcard/VCardComposer.java10
-rw-r--r--core/java/android/preference/Preference.java9
-rw-r--r--core/java/android/provider/ContactsContract.java65
-rw-r--r--core/java/android/provider/LiveFolders.java3
-rw-r--r--core/java/android/provider/Settings.java6
-rw-r--r--core/java/android/server/BluetoothA2dpService.java18
-rw-r--r--core/java/android/server/BluetoothEventLoop.java10
-rw-r--r--core/java/android/text/method/QwertyKeyListener.java6
-rw-r--r--core/java/android/webkit/HTML5VideoViewProxy.java117
-rw-r--r--core/java/android/webkit/PluginManager.java18
-rw-r--r--core/java/android/webkit/WebView.java57
-rw-r--r--core/java/android/widget/AutoCompleteTextView.java13
-rw-r--r--core/java/android/widget/QuickContactBadge.java15
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java13
-rw-r--r--core/jni/android_bluetooth_HeadsetBase.cpp24
-rw-r--r--core/res/res/drawable-hdpi/stat_notify_error.pngbin1031 -> 1057 bytes
-rw-r--r--[-rwxr-xr-x]core/res/res/drawable-hdpi/stat_notify_sdcard.pngbin905 -> 784 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_notify_sdcard_prepare.pngbin0 -> 1811 bytes
-rw-r--r--[-rwxr-xr-x]core/res/res/drawable-hdpi/stat_notify_sdcard_usb.pngbin1173 -> 1270 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_connected_3g.pngbin1170 -> 1257 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_connected_e.pngbin1100 -> 1216 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_connected_g.pngbin1119 -> 1212 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_in_3g.pngbin1179 -> 1226 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_in_e.pngbin1103 -> 1179 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_in_g.pngbin1116 -> 1181 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_inandout_3g.pngbin1158 -> 1190 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_inandout_e.pngbin1090 -> 1135 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_inandout_g.pngbin1106 -> 1143 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_out_3g.pngbin1160 -> 1220 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_out_e.pngbin1091 -> 1171 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_data_out_g.pngbin1111 -> 1178 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_gps_acquiring.pngbin716 -> 884 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_gps_on.pngbin1615 -> 2090 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_no_sim.pngbin960 -> 1021 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_phone_call.pngbin999 -> 1239 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_phone_call_bluetooth.pngbin1067 -> 1263 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_phone_call_forward.pngbin1054 -> 1319 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_phone_call_on_hold.pngbin988 -> 1200 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_speakerphone.pngbin1157 -> 1481 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_vp_phone_call.pngbin1201 -> 1462 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_vp_phone_call_bluetooth.pngbin1067 -> 1263 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_vp_phone_call_on_hold.pngbin1064 -> 1384 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_warning.pngbin1034 -> 1057 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_wifi_signal_0.pngbin1033 -> 1217 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_wifi_signal_1.pngbin1047 -> 1229 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_wifi_signal_2.pngbin1054 -> 1239 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_wifi_signal_3.pngbin1074 -> 1240 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_wifi_signal_4.pngbin4484 -> 1236 bytes
-rw-r--r--core/res/res/drawable-mdpi/stat_notify_sdcard.pngbin539 -> 552 bytes
-rw-r--r--core/res/res/drawable-mdpi/stat_notify_sdcard_prepare.pngbin0 -> 1046 bytes
-rw-r--r--core/res/res/drawable-mdpi/stat_notify_sdcard_usb.pngbin704 -> 781 bytes
-rw-r--r--core/res/res/layout/contact_header.xml7
-rw-r--r--core/res/res/layout/keyguard_screen_rotary_unlock.xml4
-rw-r--r--core/res/res/layout/keyguard_screen_rotary_unlock_land.xml2
-rw-r--r--core/res/res/layout/keyguard_screen_unlock_landscape.xml2
-rw-r--r--core/res/res/layout/keyguard_screen_unlock_portrait.xml2
-rw-r--r--core/res/res/values/public.xml3
-rw-r--r--core/res/res/values/strings.xml9
-rw-r--r--libs/audioflinger/AudioFlinger.cpp37
-rw-r--r--libs/rs/rsMatrix.cpp9
-rw-r--r--libs/rs/rsMatrix.h6
-rw-r--r--libs/rs/rsProgramVertex.cpp9
-rw-r--r--libs/rs/rsProgramVertex.h3
-rw-r--r--libs/rs/rsScriptC_Lib.cpp48
-rw-r--r--libs/surfaceflinger/Layer.cpp63
-rw-r--r--libs/surfaceflinger/LayerBase.cpp52
-rw-r--r--libs/surfaceflinger/LayerBase.h5
-rw-r--r--libs/surfaceflinger/SurfaceFlinger.cpp15
-rw-r--r--libs/utils/BackupData.cpp2
-rw-r--r--media/java/android/media/AudioService.java13
-rw-r--r--opengl/tests/gl_basic/Android.mk17
-rw-r--r--opengl/tests/gl_basic/gl_basic.cpp357
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java3
-rw-r--r--services/java/com/android/server/AppWidgetService.java9
-rw-r--r--services/java/com/android/server/BackupManagerService.java333
-rw-r--r--services/java/com/android/server/ConnectivityService.java191
-rw-r--r--services/java/com/android/server/MountService.java4
-rw-r--r--services/java/com/android/server/PackageManagerService.java175
-rw-r--r--services/java/com/android/server/WindowManagerService.java2
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java51
-rw-r--r--services/java/com/android/server/am/UsageStatsService.java5
-rw-r--r--telephony/java/com/android/internal/telephony/DataConnectionTracker.java35
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java5
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java5
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java10
-rw-r--r--wifi/java/android/net/wifi/WifiStateTracker.java11
100 files changed, 1579 insertions, 717 deletions
diff --git a/api/current.xml b/api/current.xml
index ab5369c..1b3b3d9 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -3144,6 +3144,17 @@
visibility="public"
>
</field>
+<field name="dropDownHorizontalOffset"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843436"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="dropDownItemStyle"
type="int"
transient="false"
@@ -3177,6 +3188,17 @@
visibility="public"
>
</field>
+<field name="dropDownVerticalOffset"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843437"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="dropDownWidth"
type="int"
transient="false"
@@ -10934,6 +10956,17 @@
visibility="public"
>
</field>
+<field name="stat_notify_sdcard_prepare"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="17301675"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="stat_notify_sdcard_usb"
type="int"
transient="false"
@@ -113197,37 +113230,6 @@
>
</field>
</interface>
-<class name="ContactsContract.CommonDataKinds.Birthday"
- extends="java.lang.Object"
- abstract="false"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-<field name="BIRTHDAY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;data1&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="CONTENT_ITEM_TYPE"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;vnd.android.cursor.item/birthday&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-</class>
<class name="ContactsContract.CommonDataKinds.Email"
extends="java.lang.Object"
abstract="false"
@@ -113382,11 +113384,24 @@
deprecated="not deprecated"
visibility="public"
>
+<method name="getTypeResource"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="type" type="java.lang.Integer">
+</parameter>
+</method>
<field name="CONTENT_ITEM_TYPE"
type="java.lang.String"
transient="false"
volatile="false"
- value="&quot;vnd.android.cursor.item/event&quot;"
+ value="&quot;vnd.android.cursor.item/contact_event&quot;"
static="true"
final="true"
deprecated="not deprecated"
@@ -113415,6 +113430,17 @@
visibility="public"
>
</field>
+<field name="TYPE_BIRTHDAY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="TYPE_OTHER"
type="int"
transient="false"
@@ -115726,6 +115752,98 @@
>
</constructor>
</class>
+<class name="ContactsContract.QuickContact"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="ContactsContract.QuickContact"
+ type="android.provider.ContactsContract.QuickContact"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="showQuickContact"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="target" type="android.view.View">
+</parameter>
+<parameter name="lookupUri" type="android.net.Uri">
+</parameter>
+<parameter name="mode" type="int">
+</parameter>
+<parameter name="excludeMimes" type="java.lang.String[]">
+</parameter>
+</method>
+<method name="showQuickContact"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="target" type="android.graphics.Rect">
+</parameter>
+<parameter name="lookupUri" type="android.net.Uri">
+</parameter>
+<parameter name="mode" type="int">
+</parameter>
+<parameter name="excludeMimes" type="java.lang.String[]">
+</parameter>
+</method>
+<field name="MODE_LARGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MODE_MEDIUM"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MODE_SMALL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
<class name="ContactsContract.RawContacts"
extends="java.lang.Object"
abstract="false"
@@ -186352,6 +186470,19 @@
<parameter name="excludeMimes" type="java.lang.String[]">
</parameter>
</method>
+<method name="setMode"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+</method>
<field name="mExcludeMimes"
type="java.lang.String[]"
transient="false"
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 76a133b..fc00a4c 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -122,7 +122,8 @@ public final class ActivityThread {
private static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV;
private static final boolean DEBUG_BROADCAST = false;
private static final boolean DEBUG_RESULTS = false;
- private static final boolean DEBUG_BACKUP = true;
+ private static final boolean DEBUG_BACKUP = false;
+ private static final boolean DEBUG_CONFIGURATION = false;
private static final long MIN_TIME_BETWEEN_GCS = 5*1000;
private static final Pattern PATTERN_SEMICOLON = Pattern.compile(";");
private static final int SQLITE_MEM_RELEASED_EVENT_LOG_TAG = 75003;
@@ -2388,6 +2389,8 @@ public final class ActivityThread {
appContext.setOuterContext(activity);
CharSequence title = r.activityInfo.loadLabel(appContext.getPackageManager());
Configuration config = new Configuration(mConfiguration);
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Launching activity "
+ + r.activityInfo.name + " with config " + config);
activity.attach(appContext, this, getInstrumentation(), r.token,
r.ident, app, r.intent, r.activityInfo, title, r.parent,
r.embeddedID, r.lastNonConfigurationInstance,
@@ -2954,6 +2957,8 @@ public final class ActivityThread {
if (!r.activity.mFinished && !a.mStartedActivity
&& r.activity.mDecor != null && !r.hideForNow) {
if (r.newConfig != null) {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Resuming activity "
+ + r.activityInfo.name + " with newConfig " + r.newConfig);
performConfigurationChanged(r.activity, r.newConfig);
r.newConfig = null;
}
@@ -3195,6 +3200,8 @@ public final class ActivityThread {
}
}
if (r.newConfig != null) {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Updating activity vis "
+ + r.activityInfo.name + " with new config " + r.newConfig);
performConfigurationChanged(r.activity, r.newConfig);
r.newConfig = null;
}
@@ -3476,6 +3483,10 @@ public final class ActivityThread {
Configuration changedConfig = null;
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Relaunching activity "
+ + tmp.token + " with configChanges=0x"
+ + Integer.toHexString(configChanges));
+
// First: make sure we have the most recent configuration and most
// recent version of the activity, or skip it if some previous call
// had taken a more recent version.
@@ -3494,6 +3505,7 @@ public final class ActivityThread {
}
if (tmp == null) {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Abort, activity not relaunching!");
return;
}
@@ -3503,13 +3515,16 @@ public final class ActivityThread {
}
}
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Relaunching activity "
+ + tmp.token + ": changedConfig=" + changedConfig);
+
// If there was a pending configuration change, execute it first.
if (changedConfig != null) {
handleConfigurationChanged(changedConfig);
}
ActivityRecord r = mActivities.get(tmp.token);
- if (localLOGV) Log.v(TAG, "Handling relaunch of " + r);
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Handling relaunch of " + r);
if (r == null) {
return;
}
@@ -3595,6 +3610,8 @@ public final class ActivityThread {
// the activity manager may, before then, decide the
// activity needs to be destroyed to handle its new
// configuration.
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Setting activity "
+ + ar.activityInfo.name + " newConfig=" + newConfig);
ar.newConfig = newConfig;
}
}
@@ -3652,6 +3669,8 @@ public final class ActivityThread {
}
}
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Config callback " + cb
+ + ": shouldChangeConfig=" + shouldChangeConfig);
if (shouldChangeConfig) {
cb.onConfigurationChanged(config);
@@ -3679,6 +3698,9 @@ public final class ActivityThread {
ArrayList<ComponentCallbacks> callbacks
= new ArrayList<ComponentCallbacks>();
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Handle configuration changed: "
+ + config);
+
synchronized(mPackages) {
if (mConfiguration == null) {
mConfiguration = new Configuration();
@@ -3729,6 +3751,9 @@ public final class ActivityThread {
return;
}
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Handle activity config changed: "
+ + r.activityInfo.name);
+
performConfigurationChanged(r.activity, mConfiguration);
}
diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java
index 0582e34..8ba7c01 100644
--- a/core/java/android/app/ApplicationContext.java
+++ b/core/java/android/app/ApplicationContext.java
@@ -2760,6 +2760,7 @@ class ApplicationContext extends Context {
if (mFile.exists()) {
if (!mFile.renameTo(mBackupFile)) {
Log.e(TAG, "Couldn't rename file " + mFile + " to backup file " + mBackupFile);
+ return false;
}
}
diff --git a/core/java/android/app/BackupAgent.java b/core/java/android/app/BackupAgent.java
index 0ac8a1e..b207998 100644
--- a/core/java/android/app/BackupAgent.java
+++ b/core/java/android/app/BackupAgent.java
@@ -36,6 +36,7 @@ import java.io.IOException;
*/
public abstract class BackupAgent extends ContextWrapper {
private static final String TAG = "BackupAgent";
+ private static final boolean DEBUG = false;
public BackupAgent() {
super(null);
@@ -116,7 +117,7 @@ public abstract class BackupAgent extends ContextWrapper {
ParcelFileDescriptor data,
ParcelFileDescriptor newState) throws RemoteException {
// !!! TODO - real implementation; for now just invoke the callbacks directly
- Log.v(TAG, "doBackup() invoked");
+ if (DEBUG) Log.v(TAG, "doBackup() invoked");
BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor());
try {
BackupAgent.this.onBackup(oldState, output, newState);
@@ -132,7 +133,7 @@ public abstract class BackupAgent extends ContextWrapper {
public void doRestore(ParcelFileDescriptor data, int appVersionCode,
ParcelFileDescriptor newState) throws RemoteException {
// !!! TODO - real implementation; for now just invoke the callbacks directly
- Log.v(TAG, "doRestore() invoked");
+ if (DEBUG) Log.v(TAG, "doRestore() invoked");
BackupDataInput input = new BackupDataInput(data.getFileDescriptor());
try {
BackupAgent.this.onRestore(input, appVersionCode, newState);
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index 38cac87..69c87ee 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -44,6 +44,12 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+/**
+ * Provides access to the system wallpaper. With WallpaperManager, you can
+ * get the current wallpaper, get the desired dimensions for the wallpaper, set
+ * the wallpaper, and more. Get an instance of WallpaperManager with
+ * {@link #getInstance(android.content.Context) getInstance()}.
+ */
public class WallpaperManager {
private static String TAG = "WallpaperManager";
private static boolean DEBUG = false;
@@ -310,8 +316,11 @@ public class WallpaperManager {
}
/**
- * Like {@link #peekDrawable}, but always returns a valid Drawable. If
+ * Retrieve the current system wallpaper; if
* no wallpaper is set, the system default wallpaper is returned.
+ * This is returned as an
+ * abstract Drawable that you can install in a View to display whatever
+ * wallpaper the user has currently set.
*
* @return Returns a Drawable object that will draw the wallpaper.
*/
@@ -326,10 +335,10 @@ public class WallpaperManager {
}
/**
- * Retrieve the current system wallpaper. This is returned as an
+ * Retrieve the current system wallpaper; if there is no wallpaper set,
+ * a null pointer is returned. This is returned as an
* abstract Drawable that you can install in a View to display whatever
- * wallpaper the user has currently set. If there is no wallpaper set,
- * a null pointer is returned.
+ * wallpaper the user has currently set.
*
* @return Returns a Drawable object that will draw the wallpaper or a
* null pointer if these is none.
@@ -345,8 +354,15 @@ public class WallpaperManager {
}
/**
- * Like {@link #peekFastDrawable}, but always returns a valid Drawable. If
- * no wallpaper is set, the system default wallpaper is returned.
+ * Like {@link #getDrawable()}, but the returned Drawable has a number
+ * of limitations to reduce its overhead as much as possible. It will
+ * never scale the wallpaper (only centering it if the requested bounds
+ * do match the bitmap bounds, which should not be typical), doesn't
+ * allow setting an alpha, color filter, or other attributes, etc. The
+ * bounds of the returned drawable will be initialized to the same bounds
+ * as the wallpaper, so normally you will not need to touch it. The
+ * drawable also assumes that it will be used in a context running in
+ * the same density as the screen (not in density compatibility mode).
*
* @return Returns a Drawable object that will draw the wallpaper.
*/
@@ -360,15 +376,8 @@ public class WallpaperManager {
}
/**
- * Like {@link #peekDrawable()}, but the returned Drawable has a number
- * of limitations to reduce its overhead as much as possible: it will
- * never scale the wallpaper (only centering it if the requested bounds
- * do match the bitmap bounds, which should not be typical), doesn't
- * allow setting an alpha, color filter, or other attributes, etc. The
- * bounds of the returned drawable will be initialized to the same bounds
- * as the wallpaper, so normally you will not need to touch it. The
- * drawable also assumes that it will be used in a context running in
- * the same density as the screen (not in density compatibility mode).
+ * Like {@link #getFastDrawable()}, but if there is no wallpaper set,
+ * a null pointer is returned.
*
* @return Returns an optimized Drawable object that will draw the
* wallpaper or a null pointer if these is none.
@@ -566,7 +575,7 @@ public class WallpaperManager {
* make sense when the wallpaper is larger than the screen.
*
* @param windowToken The window who these offsets should be associated
- * with, as returned by {@link android.view.View#getWindowVisibility()
+ * with, as returned by {@link android.view.View#getWindowToken()
* View.getWindowToken()}.
* @param xOffset The offset olong the X dimension, from 0 to 1.
* @param yOffset The offset along the Y dimension, from 0 to 1.
@@ -589,7 +598,7 @@ public class WallpaperManager {
* to scroll from whatever its last offsets were.
*
* @param windowToken The window who these offsets should be associated
- * with, as returned by {@link android.view.View#getWindowVisibility()
+ * with, as returned by {@link android.view.View#getWindowToken()
* View.getWindowToken()}.
*/
public void clearWallpaperOffsets(IBinder windowToken) {
diff --git a/core/java/android/backup/AbsoluteFileBackupHelper.java b/core/java/android/backup/AbsoluteFileBackupHelper.java
index ab24675..1dbccc9 100644
--- a/core/java/android/backup/AbsoluteFileBackupHelper.java
+++ b/core/java/android/backup/AbsoluteFileBackupHelper.java
@@ -31,6 +31,7 @@ import java.io.FileDescriptor;
*/
public class AbsoluteFileBackupHelper extends FileBackupHelperBase implements BackupHelper {
private static final String TAG = "AbsoluteFileBackupHelper";
+ private static final boolean DEBUG = false;
Context mContext;
String[] mFiles;
@@ -54,8 +55,7 @@ public class AbsoluteFileBackupHelper extends FileBackupHelperBase implements Ba
}
public void restoreEntity(BackupDataInputStream data) {
- // TODO: turn this off before ship
- Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
+ if (DEBUG) Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
String key = data.getKey();
if (isKeyInList(key, mFiles)) {
File f = new File(key);
diff --git a/core/java/android/backup/FileBackupHelper.java b/core/java/android/backup/FileBackupHelper.java
index 4058497..dacfc8f 100644
--- a/core/java/android/backup/FileBackupHelper.java
+++ b/core/java/android/backup/FileBackupHelper.java
@@ -26,6 +26,7 @@ import java.io.FileDescriptor;
/** @hide */
public class FileBackupHelper extends FileBackupHelperBase implements BackupHelper {
private static final String TAG = "FileBackupHelper";
+ private static final boolean DEBUG = false;
Context mContext;
File mFilesDir;
@@ -60,8 +61,7 @@ public class FileBackupHelper extends FileBackupHelperBase implements BackupHelp
}
public void restoreEntity(BackupDataInputStream data) {
- // TODO: turn this off before ship
- Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
+ if (DEBUG) Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
String key = data.getKey();
if (isKeyInList(key, mFiles)) {
File f = new File(mFilesDir, key);
diff --git a/core/java/android/backup/SharedPreferencesBackupHelper.java b/core/java/android/backup/SharedPreferencesBackupHelper.java
index 4a7b399..6a0bc96 100644
--- a/core/java/android/backup/SharedPreferencesBackupHelper.java
+++ b/core/java/android/backup/SharedPreferencesBackupHelper.java
@@ -26,6 +26,7 @@ import java.io.FileDescriptor;
/** @hide */
public class SharedPreferencesBackupHelper extends FileBackupHelperBase implements BackupHelper {
private static final String TAG = "SharedPreferencesBackupHelper";
+ private static final boolean DEBUG = false;
private Context mContext;
private String[] mPrefGroups;
@@ -56,9 +57,9 @@ public class SharedPreferencesBackupHelper extends FileBackupHelperBase implemen
public void restoreEntity(BackupDataInputStream data) {
Context context = mContext;
- // TODO: turn this off before ship
- Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
String key = data.getKey();
+ if (DEBUG) Log.d(TAG, "got entity '" + key + "' size=" + data.size());
+
if (isKeyInList(key, mPrefGroups)) {
File f = context.getSharedPrefsFile(key).getAbsoluteFile();
writeFile(f, data);
diff --git a/core/java/android/bluetooth/HeadsetBase.java b/core/java/android/bluetooth/HeadsetBase.java
index 29cf41d..e2935c9 100644
--- a/core/java/android/bluetooth/HeadsetBase.java
+++ b/core/java/android/bluetooth/HeadsetBase.java
@@ -211,9 +211,10 @@ public final class HeadsetBase {
*/
public boolean connectAsync() {
- return connectAsyncNative();
+ int ret = connectAsyncNative();
+ return (ret == 0) ? true : false;
}
- private native boolean connectAsyncNative();
+ private native int connectAsyncNative();
public int getRemainingAsyncConnectWaitingTimeMs() {
return mTimeoutRemainingMs;
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 5fb5768..b785dbf 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1330,7 +1330,7 @@ public class Intent implements Parcelable {
public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED";
/**
* Broadcast Action: The current system wallpaper has changed. See
- * {@link Context#getWallpaper} for retrieving the new wallpaper.
+ * {@link android.app.WallpaperManager} for retrieving the new wallpaper.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index 11d984d..fb2608a 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -103,7 +103,7 @@ public class SyncStorageEngine extends Handler {
public static final String MESG_SUCCESS = "success";
public static final String MESG_CANCELED = "canceled";
- public static final int MAX_HISTORY = 15;
+ public static final int MAX_HISTORY = 100;
private static final int MSG_WRITE_STATUS = 1;
private static final long WRITE_STATUS_DELAY = 1000*60*10; // 10 minutes
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 3e117d4..83e63b9 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -986,6 +986,7 @@ public class PackageParser {
}
final int NP = PackageParser.NEW_PERMISSIONS.length;
+ StringBuilder implicitPerms = null;
for (int ip=0; ip<NP; ip++) {
final PackageParser.NewPermissionInfo npi
= PackageParser.NEW_PERMISSIONS[ip];
@@ -993,11 +994,20 @@ public class PackageParser {
break;
}
if (!pkg.requestedPermissions.contains(npi.name)) {
- Log.i(TAG, "Impliciting adding " + npi.name + " to old pkg "
- + pkg.packageName);
+ if (implicitPerms == null) {
+ implicitPerms = new StringBuilder(128);
+ implicitPerms.append(pkg.packageName);
+ implicitPerms.append(": compat added ");
+ } else {
+ implicitPerms.append(' ');
+ }
+ implicitPerms.append(npi.name);
pkg.requestedPermissions.add(npi.name);
}
}
+ if (implicitPerms != null) {
+ Log.i(TAG, implicitPerms.toString());
+ }
if (supportsSmallScreens < 0 || (supportsSmallScreens > 0
&& pkg.applicationInfo.targetSdkVersion
@@ -1335,8 +1345,10 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestApplication_backupAgent);
if (backupAgent != null) {
ai.backupAgentName = buildClassName(pkgName, backupAgent, outError);
- Log.v(TAG, "android:backupAgent = " + ai.backupAgentName
- + " from " + pkgName + "+" + backupAgent);
+ if (false) {
+ Log.v(TAG, "android:backupAgent = " + ai.backupAgentName
+ + " from " + pkgName + "+" + backupAgent);
+ }
if (sa.getBoolean(
com.android.internal.R.styleable.AndroidManifestApplication_killAfterRestore,
@@ -1526,8 +1538,9 @@ public class PackageParser {
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "Unknown element under <application>: " + tagName);
+ Log.w(TAG, "Unknown element under <application>: " + tagName
+ + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
} else {
@@ -1572,25 +1585,6 @@ public class PackageParser {
return true;
}
- private boolean parseComponentInfo(Package owner, int flags,
- ComponentInfo outInfo, String[] outError, String tag, TypedArray sa,
- int nameRes, int labelRes, int iconRes, int processRes,
- int enabledRes) {
- if (!parsePackageItemInfo(owner, outInfo, outError, tag, sa,
- nameRes, labelRes, iconRes)) {
- return false;
- }
-
- if (processRes != 0) {
- outInfo.processName = buildProcessName(owner.applicationInfo.packageName,
- owner.applicationInfo.processName, sa.getNonResourceString(processRes),
- flags, mSeparateProcesses, outError);
- }
- outInfo.enabled = sa.getBoolean(enabledRes, true);
-
- return outError[0] == null;
- }
-
private Activity parseActivity(Package owner, Resources res,
XmlPullParser parser, AttributeSet attrs, int flags, String[] outError,
boolean receiver) throws XmlPullParserException, IOException {
@@ -1749,9 +1743,13 @@ public class PackageParser {
if (!RIGID_PARSER) {
Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
if (receiver) {
- Log.w(TAG, "Unknown element under <receiver>: " + parser.getName());
+ Log.w(TAG, "Unknown element under <receiver>: " + parser.getName()
+ + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
} else {
- Log.w(TAG, "Unknown element under <activity>: " + parser.getName());
+ Log.w(TAG, "Unknown element under <activity>: " + parser.getName()
+ + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
}
XmlUtils.skipCurrentTag(parser);
continue;
@@ -1891,8 +1889,9 @@ public class PackageParser {
}
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "Unknown element under <activity-alias>: " + parser.getName());
+ Log.w(TAG, "Unknown element under <activity-alias>: " + parser.getName()
+ + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2055,8 +2054,9 @@ public class PackageParser {
outInfo.info.grantUriPermissions = true;
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "No path, pathPrefix, or pathPattern for <path-permission>");
+ Log.w(TAG, "Unknown element under <path-permission>: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2096,8 +2096,9 @@ public class PackageParser {
if (!havePerm) {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "No readPermission or writePermssion for <path-permission>");
+ Log.w(TAG, "No readPermission or writePermssion for <path-permission>: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2141,8 +2142,9 @@ public class PackageParser {
}
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "No path, pathPrefix, or pathPattern for <path-permission>");
+ Log.w(TAG, "No path, pathPrefix, or pathPattern for <path-permission>: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2153,9 +2155,9 @@ public class PackageParser {
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
Log.w(TAG, "Unknown element under <provider>: "
- + parser.getName());
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2233,9 +2235,9 @@ public class PackageParser {
}
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
Log.w(TAG, "Unknown element under <service>: "
- + parser.getName());
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2272,9 +2274,9 @@ public class PackageParser {
}
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
Log.w(TAG, "Unknown element under " + tag + ": "
- + parser.getName());
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2330,8 +2332,9 @@ public class PackageParser {
data.putFloat(name, v.getFloat());
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "<meta-data> only supports string, integer, float, color, boolean, and resource reference types");
+ Log.w(TAG, "<meta-data> only supports string, integer, float, color, boolean, and resource reference types: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
} else {
outError[0] = "<meta-data> only supports string, integer, float, color, boolean, and resource reference types";
data = null;
@@ -2365,6 +2368,7 @@ public class PackageParser {
com.android.internal.R.styleable.AndroidManifestIntentFilter_priority, 0);
if (priority > 0 && isActivity && (flags&PARSE_IS_SYSTEM) == 0) {
Log.w(TAG, "Activity with priority > 0, forcing to 0 at "
+ + mArchiveSourcePath + " "
+ parser.getPositionDescription());
priority = 0;
}
@@ -2462,8 +2466,9 @@ public class PackageParser {
sa.recycle();
XmlUtils.skipCurrentTag(parser);
} else if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "Unknown element under <intent-filter>: " + parser.getName());
+ Log.w(TAG, "Unknown element under <intent-filter>: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
} else {
outError[0] = "Bad element under <intent-filter>: " + parser.getName();
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 11c8b6f..66f5740 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1281,7 +1281,11 @@ public class Camera {
}
/**
- * Sets the scene mode.
+ * Sets the scene mode. Other parameters may be changed after changing
+ * scene mode. For example, flash and supported flash mode may be
+ * changed to "off" in night scene mode. After setting scene mode,
+ * applications should call getParameters to know if some parameters are
+ * changed.
*
* @param value SCENE_MODE_XXX string constants.
*/
diff --git a/core/java/android/pim/vcard/ContactStruct.java b/core/java/android/pim/vcard/ContactStruct.java
index e87c796..b6a453a 100644
--- a/core/java/android/pim/vcard/ContactStruct.java
+++ b/core/java/android/pim/vcard/ContactStruct.java
@@ -25,8 +25,8 @@ import android.provider.ContactsContract;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.Groups;
import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Birthday;
import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Event;
import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
import android.provider.ContactsContract.CommonDataKinds.Im;
import android.provider.ContactsContract.CommonDataKinds.Nickname;
@@ -810,7 +810,8 @@ public class ContactStruct {
} else if (propName.equals("NICKNAME") || propName.equals("X-NICKNAME")) {
addNickName(propValue);
} else if (propName.equals("SOUND")) {
- if (Constants.ATTR_TYPE_X_IRMC_N.equals(paramMap.get(Constants.ATTR_TYPE))) {
+ Collection<String> typeCollection = paramMap.get(Constants.ATTR_TYPE);
+ if (typeCollection != null && typeCollection.contains(Constants.ATTR_TYPE_X_IRMC_N)) {
handlePhoneticNameFromSound(propValueList);
} else {
// Ignore this field since Android cannot understand what it is.
@@ -1316,9 +1317,10 @@ public class ContactStruct {
if (!TextUtils.isEmpty(mBirthday)) {
builder = ContentProviderOperation.newInsert(Data.CONTENT_URI);
- builder.withValueBackReference(Birthday.RAW_CONTACT_ID, 0);
- builder.withValue(Data.MIMETYPE, Birthday.CONTENT_ITEM_TYPE);
- builder.withValue(Birthday.BIRTHDAY, mBirthday);
+ builder.withValueBackReference(Event.RAW_CONTACT_ID, 0);
+ builder.withValue(Data.MIMETYPE, Event.CONTENT_ITEM_TYPE);
+ builder.withValue(Event.START_DATE, mBirthday);
+ builder.withValue(Event.TYPE, Event.TYPE_BIRTHDAY);
operationList.add(builder.build());
}
diff --git a/core/java/android/pim/vcard/VCardComposer.java b/core/java/android/pim/vcard/VCardComposer.java
index c943d85..7b75f4a 100644
--- a/core/java/android/pim/vcard/VCardComposer.java
+++ b/core/java/android/pim/vcard/VCardComposer.java
@@ -30,8 +30,8 @@ import android.provider.CallLog.Calls;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Birthday;
import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Event;
import android.provider.ContactsContract.CommonDataKinds.Im;
import android.provider.ContactsContract.CommonDataKinds.Nickname;
import android.provider.ContactsContract.CommonDataKinds.Note;
@@ -1301,12 +1301,16 @@ public class VCardComposer {
private void appendBirthday(final StringBuilder builder,
final Map<String, List<ContentValues>> contentValuesListMap) {
final List<ContentValues> contentValuesList = contentValuesListMap
- .get(Birthday.CONTENT_ITEM_TYPE);
+ .get(Event.CONTENT_ITEM_TYPE);
if (contentValuesList != null && contentValuesList.size() > 0) {
+ Integer eventType = contentValuesList.get(0).getAsInteger(Event.TYPE);
+ if (eventType == null || !eventType.equals(Event.TYPE_BIRTHDAY)) {
+ return;
+ }
// Theoretically, there must be only one birthday for each vCard data and
// we are afraid of some parse error occuring in some devices, so
// we emit only one birthday entry for now.
- String birthday = contentValuesList.get(0).getAsString(Birthday.BIRTHDAY);
+ String birthday = contentValuesList.get(0).getAsString(Event.START_DATE);
if (birthday != null) {
birthday = birthday.trim();
}
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index cebb75c..08a2a9f 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -102,7 +102,6 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
private int mLayoutResId = com.android.internal.R.layout.preference;
private int mWidgetLayoutResId;
private boolean mHasSpecifiedLayout = false;
- private View mLayoutView;
private OnPreferenceChangeInternalListener mListener;
@@ -337,7 +336,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
if (!mHasSpecifiedLayout) {
mHasSpecifiedLayout = true;
}
- mLayoutView = null;
+
mLayoutResId = layoutResId;
}
@@ -361,7 +360,6 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
* @see #setLayoutResource(int)
*/
public void setWidgetLayoutResource(int widgetLayoutResId) {
- mLayoutView = null;
mWidgetLayoutResId = widgetLayoutResId;
}
@@ -389,10 +387,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
*/
public View getView(View convertView, ViewGroup parent) {
if (convertView == null) {
- if (mLayoutView == null) {
- mLayoutView = onCreateView(parent);
- }
- convertView = mLayoutView;
+ convertView = onCreateView(parent);
}
onBindView(convertView);
return convertView;
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 70a20d6..2e4bbab 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -1692,26 +1692,6 @@ public final class ContactsContract {
}
/**
- * Common data definition for birthdays.
- */
- public static final class Birthday implements DataColumnsWithJoins {
- /**
- * This utility class cannot be instantiated
- */
- private Birthday() {}
-
- /** MIME type used when storing this in data table. */
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/birthday";
-
- /**
- * The birthday. This must be of the form YYYY-MM-DD or YYYY-MM-DDThh:mm:ss
- * These are xs:date and xs:dateTime
- * <P>Type: TEXT</P>
- */
- public static final String BIRTHDAY = DATA1;
- }
-
- /**
* Common data definition for relations.
*/
public static final class Relation implements DataColumnsWithJoins, CommonColumns {
@@ -1755,16 +1735,34 @@ public final class ContactsContract {
private Event() {}
/** MIME type used when storing this in data table. */
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event";
+ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_event";
public static final int TYPE_ANNIVERSARY = 1;
public static final int TYPE_OTHER = 2;
+ public static final int TYPE_BIRTHDAY = 3;
/**
* The event start date as the user entered it.
* <P>Type: TEXT</P>
*/
public static final String START_DATE = DATA;
+
+ /**
+ * Return the string resource that best describes the given
+ * {@link #TYPE}. Will always return a valid resource.
+ */
+ public static int getTypeResource(Integer type) {
+ if (type == null) {
+ return com.android.internal.R.string.eventTypeOther;
+ }
+ switch (type) {
+ case TYPE_ANNIVERSARY:
+ return com.android.internal.R.string.eventTypeAnniversary;
+ case TYPE_BIRTHDAY: return com.android.internal.R.string.eventTypeBirthday;
+ case TYPE_OTHER: return com.android.internal.R.string.eventTypeOther;
+ default: return com.android.internal.R.string.eventTypeOther;
+ }
+ }
}
/**
@@ -2133,18 +2131,16 @@ public final class ContactsContract {
}
/**
- * Helper methods to display FastTrack dialogs that allow users to pivot on
+ * Helper methods to display QuickContact dialogs that allow users to pivot on
* a specific {@link Contacts} entry.
- *
- * @hide
*/
- public static final class FastTrack {
+ public static final class QuickContact {
/**
* Action used to trigger person pivot dialog.
* @hide
*/
- public static final String ACTION_FAST_TRACK =
- "com.android.contacts.action.FAST_TRACK";
+ public static final String ACTION_QUICK_CONTACT =
+ "com.android.contacts.action.QUICK_CONTACT";
/**
* Extra used to specify pivot dialog location in screen coordinates.
@@ -2166,19 +2162,19 @@ public final class ContactsContract {
public static final String EXTRA_EXCLUDE_MIMES = "exclude_mimes";
/**
- * Small FastTrack mode, usually presented with minimal actions.
+ * Small QuickContact mode, usually presented with minimal actions.
*/
public static final int MODE_SMALL = 1;
/**
- * Medium FastTrack mode, includes actions and light summary describing
+ * Medium QuickContact mode, includes actions and light summary describing
* the {@link Contacts} entry being shown. This may include social
* status and presence details.
*/
public static final int MODE_MEDIUM = 2;
/**
- * Large FastTrack mode, includes actions and larger, card-like summary
+ * Large QuickContact mode, includes actions and larger, card-like summary
* of the {@link Contacts} entry being shown. This may include detailed
* information, such as a photo.
*/
@@ -2207,7 +2203,7 @@ public final class ContactsContract {
* already viewing the contact details card, this can be used
* to omit the details entry from the dialog.
*/
- public static void showFastTrack(Context context, View target, Uri lookupUri, int mode,
+ public static void showQuickContact(Context context, View target, Uri lookupUri, int mode,
String[] excludeMimes) {
// Find location and bounds of target view
final int[] location = new int[2];
@@ -2220,7 +2216,7 @@ public final class ContactsContract {
rect.bottom = rect.top + target.getHeight();
// Trigger with obtained rectangle
- showFastTrack(context, rect, lookupUri, mode, excludeMimes);
+ showQuickContact(context, rect, lookupUri, mode, excludeMimes);
}
/**
@@ -2246,14 +2242,15 @@ public final class ContactsContract {
* already viewing the contact details card, this can be used
* to omit the details entry from the dialog.
*/
- public static void showFastTrack(Context context, Rect target, Uri lookupUri, int mode,
+ public static void showQuickContact(Context context, Rect target, Uri lookupUri, int mode,
String[] excludeMimes) {
// Launch pivot dialog through intent for now
- final Intent intent = new Intent(ACTION_FAST_TRACK);
+ final Intent intent = new Intent(ACTION_QUICK_CONTACT);
intent.setData(lookupUri);
intent.putExtra(EXTRA_TARGET_RECT, target);
intent.putExtra(EXTRA_MODE, mode);
intent.putExtra(EXTRA_EXCLUDE_MIMES, excludeMimes);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
context.startActivity(intent);
}
}
diff --git a/core/java/android/provider/LiveFolders.java b/core/java/android/provider/LiveFolders.java
index 19f361b..7856bab 100644
--- a/core/java/android/provider/LiveFolders.java
+++ b/core/java/android/provider/LiveFolders.java
@@ -40,12 +40,11 @@ import android.annotation.SdkConstant;
* to retrieve the folder's content.</p>
*
* <h3>Setting up the live folder activity</h3>
- * <p>The following code sample shows how to write an activity that creates a live fodler:</p>
+ * <p>The following code sample shows how to write an activity that creates a live folder:</p>
* <pre>
* public static class MyLiveFolder extends Activity {
* public static final Uri CONTENT_URI = Uri.parse("content://my.app/live");
*
- * &amp;#064;Override
* protected void onCreate(Bundle savedInstanceState) {
* super.onCreate(savedInstanceState);
*
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index f27902d..2ca17f6 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -464,7 +464,7 @@ public final class Settings {
resolver.insert(uri, values);
return true;
} catch (SQLException e) {
- Log.e(TAG, "Can't set key " + name + " in " + uri, e);
+ Log.w(TAG, "Can't set key " + name + " in " + uri, e);
return false;
}
}
@@ -501,7 +501,7 @@ public final class Settings {
mValues.put(name, value);
} catch (SQLException e) {
// SQL error: return null, but don't cache it.
- Log.e(TAG, "Can't get key " + name + " from " + mUri, e);
+ Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
} finally {
if (c != null) c.close();
}
@@ -3746,7 +3746,7 @@ public final class Settings {
// The stored URL is bad... ignore it.
} catch (IllegalArgumentException e) {
// Column not found
- Log.e(TAG, "Intent column not found", e);
+ Log.w(TAG, "Intent column not found", e);
}
}
} finally {
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java
index 4a5f431..d61b42f 100644
--- a/core/java/android/server/BluetoothA2dpService.java
+++ b/core/java/android/server/BluetoothA2dpService.java
@@ -112,6 +112,13 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
Message msg = Message.obtain(mHandler, MESSAGE_CONNECT_TO, device);
mHandler.sendMessageDelayed(msg, 6000);
}
+ } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) {
+ synchronized (this) {
+ if (mAudioDevices.containsKey(device)) {
+ int state = mAudioDevices.get(device);
+ handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED);
+ }
+ }
}
}
};
@@ -135,6 +142,7 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
+ mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
mContext.registerReceiver(mReceiver, mIntentFilter);
mAudioDevices = new HashMap<BluetoothDevice, Integer>();
@@ -333,10 +341,11 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
return false;
}
String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());
- if (path == null) {
+ Integer state = mAudioDevices.get(device);
+ if (path == null || state == null) {
return false;
}
- switch (mAudioDevices.get(device)) {
+ switch (state.intValue()) {
case BluetoothA2dp.STATE_CONNECTED:
return true;
case BluetoothA2dp.STATE_PLAYING:
@@ -354,10 +363,11 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
return false;
}
String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());
- if (path == null) {
+ Integer state = mAudioDevices.get(device);
+ if (path == null || state == null) {
return false;
}
- switch (mAudioDevices.get(device)) {
+ switch (state.intValue()) {
case BluetoothA2dp.STATE_PLAYING:
return true;
case BluetoothA2dp.STATE_CONNECTED:
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index 037e9d3..0152223 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -403,9 +403,13 @@ class BluetoothEventLoop {
mBluetoothService.cancelPairingUserInput(address);
return null;
}
- // Set state to BONDING, for incoming connections it will be set here.
- // For outgoing connections, it gets set when call createBond.
- mBluetoothService.getBondState().setBondState(address, BluetoothDevice.BOND_BONDING);
+ // Set state to BONDING. For incoming connections it will be set here.
+ // For outgoing connections, it gets set when we call createBond.
+ // Also set it only when the state is not already Bonded, we can sometimes
+ // get an authorization request from the remote end if it doesn't have the link key
+ // while we still have it.
+ if (mBluetoothService.getBondState().getBondState(address) != BluetoothDevice.BOND_BONDED)
+ mBluetoothService.getBondState().setBondState(address, BluetoothDevice.BOND_BONDING);
return address;
}
diff --git a/core/java/android/text/method/QwertyKeyListener.java b/core/java/android/text/method/QwertyKeyListener.java
index f736f85..2e76470 100644
--- a/core/java/android/text/method/QwertyKeyListener.java
+++ b/core/java/android/text/method/QwertyKeyListener.java
@@ -405,12 +405,13 @@ public class QwertyKeyListener extends BaseKeyListener {
PICKER_SETS.put('C', "\u00C7\u0106\u010C");
PICKER_SETS.put('D', "\u010E");
PICKER_SETS.put('E', "\u00C8\u00C9\u00CA\u00CB\u0118\u011A\u0112");
+ PICKER_SETS.put('G', "\u011E");
PICKER_SETS.put('L', "\u0141");
PICKER_SETS.put('I', "\u00CC\u00CD\u00CE\u00CF\u012A\u0130");
PICKER_SETS.put('N', "\u00D1\u0143\u0147");
PICKER_SETS.put('O', "\u00D8\u0152\u00D5\u00D2\u00D3\u00D4\u00D6\u014C");
PICKER_SETS.put('R', "\u0158");
- PICKER_SETS.put('S', "\u015A\u0160");
+ PICKER_SETS.put('S', "\u015A\u0160\u015E");
PICKER_SETS.put('T', "\u0164");
PICKER_SETS.put('U', "\u00D9\u00DA\u00DB\u00DC\u016E\u016A");
PICKER_SETS.put('Y', "\u00DD\u0178");
@@ -419,12 +420,13 @@ public class QwertyKeyListener extends BaseKeyListener {
PICKER_SETS.put('c', "\u00E7\u0107\u010D");
PICKER_SETS.put('d', "\u010F");
PICKER_SETS.put('e', "\u00E8\u00E9\u00EA\u00EB\u0119\u011B\u0113");
+ PICKER_SETS.put('g', "\u011F");
PICKER_SETS.put('i', "\u00EC\u00ED\u00EE\u00EF\u012B\u0131");
PICKER_SETS.put('l', "\u0142");
PICKER_SETS.put('n', "\u00F1\u0144\u0148");
PICKER_SETS.put('o', "\u00F8\u0153\u00F5\u00F2\u00F3\u00F4\u00F6\u014D");
PICKER_SETS.put('r', "\u0159");
- PICKER_SETS.put('s', "\u00A7\u00DF\u015B\u0161");
+ PICKER_SETS.put('s', "\u00A7\u00DF\u015B\u0161\u015F");
PICKER_SETS.put('t', "\u0165");
PICKER_SETS.put('u', "\u00F9\u00FA\u00FB\u00FC\u016F\u016B");
PICKER_SETS.put('y', "\u00FD\u00FF");
diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java
index 8b783e8..b7a9065 100644
--- a/core/java/android/webkit/HTML5VideoViewProxy.java
+++ b/core/java/android/webkit/HTML5VideoViewProxy.java
@@ -39,10 +39,8 @@ import android.view.MotionEvent;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
-import android.webkit.ViewManager.ChildView;
import android.widget.AbsoluteLayout;
import android.widget.FrameLayout;
-import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.VideoView;
@@ -56,20 +54,22 @@ import java.util.Map;
*/
class HTML5VideoViewProxy extends Handler
implements MediaPlayer.OnPreparedListener,
- MediaPlayer.OnCompletionListener {
+ MediaPlayer.OnCompletionListener,
+ MediaPlayer.OnErrorListener {
// Logging tag.
private static final String LOGTAG = "HTML5VideoViewProxy";
// Message Ids for WebCore thread -> UI thread communication.
- private static final int INIT = 100;
- private static final int PLAY = 101;
- private static final int SET_POSTER = 102;
- private static final int SEEK = 103;
- private static final int PAUSE = 104;
+ private static final int PLAY = 100;
+ private static final int SEEK = 101;
+ private static final int PAUSE = 102;
+ private static final int ERROR = 103;
+ private static final int LOAD_DEFAULT_POSTER = 104;
// Message Ids to be handled on the WebCore thread
private static final int PREPARED = 200;
private static final int ENDED = 201;
+ private static final int POSTER_FETCHED = 202;
// The C++ MediaPlayerPrivateAndroid object.
int mNativePointer;
@@ -77,10 +77,9 @@ class HTML5VideoViewProxy extends Handler
private Handler mWebCoreHandler;
// The WebView instance that created this view.
private WebView mWebView;
- // The ChildView instance used by the ViewManager.
- private ChildView mChildView;
// The poster image to be shown when the video is not playing.
- private ImageView mPosterView;
+ // This ref prevents the bitmap from being GC'ed.
+ private Bitmap mPoster;
// The poster downloader.
private PosterDownloader mPosterDownloader;
// The seek position.
@@ -138,6 +137,7 @@ class HTML5VideoViewProxy extends Handler
mVideoView.setVideoURI(Uri.parse(url));
mVideoView.setOnCompletionListener(proxy);
mVideoView.setOnPreparedListener(proxy);
+ mVideoView.setOnErrorListener(proxy);
mVideoView.seekTo(time);
mLayout.addView(mVideoView, layoutParams);
mProgressView = client.getVideoLoadingProgressView();
@@ -163,11 +163,12 @@ class HTML5VideoViewProxy extends Handler
}
public static void onPrepared() {
- if (mProgressView != null) {
- mProgressView.setVisibility(View.GONE);
- mLayout.removeView(mProgressView);
- mProgressView = null;
+ if (mProgressView == null || mLayout == null) {
+ return;
}
+ mProgressView.setVisibility(View.GONE);
+ mLayout.removeView(mProgressView);
+ mProgressView = null;
}
}
@@ -189,6 +190,12 @@ class HTML5VideoViewProxy extends Handler
playbackEnded();
}
+ // MediaPlayer.OnErrorListener
+ public boolean onError(MediaPlayer mp, int what, int extra) {
+ sendMessage(obtainMessage(ERROR));
+ return false;
+ }
+
public void playbackEnded() {
Message msg = Message.obtain(mWebCoreHandler, ENDED);
mWebCoreHandler.sendMessage(msg);
@@ -199,18 +206,6 @@ class HTML5VideoViewProxy extends Handler
public void handleMessage(Message msg) {
// This executes on the UI thread.
switch (msg.what) {
- case INIT: {
- mPosterView = new ImageView(mWebView.getContext());
- WebChromeClient client = mWebView.getWebChromeClient();
- if (client != null) {
- Bitmap poster = client.getDefaultVideoPoster();
- if (poster != null) {
- mPosterView.setImageBitmap(poster);
- }
- }
- mChildView.mView = mPosterView;
- break;
- }
case PLAY: {
String url = (String) msg.obj;
WebChromeClient client = mWebView.getWebChromeClient();
@@ -219,11 +214,6 @@ class HTML5VideoViewProxy extends Handler
}
break;
}
- case SET_POSTER: {
- Bitmap poster = (Bitmap) msg.obj;
- mPosterView.setImageBitmap(poster);
- break;
- }
case SEEK: {
Integer time = (Integer) msg.obj;
mSeekPosition = time;
@@ -234,6 +224,20 @@ class HTML5VideoViewProxy extends Handler
VideoPlayer.pause(this);
break;
}
+ case ERROR: {
+ WebChromeClient client = mWebView.getWebChromeClient();
+ if (client != null) {
+ client.onHideCustomView();
+ }
+ break;
+ }
+ case LOAD_DEFAULT_POSTER: {
+ WebChromeClient client = mWebView.getWebChromeClient();
+ if (client != null) {
+ doSetPoster(client.getDefaultVideoPoster());
+ }
+ break;
+ }
}
}
@@ -302,9 +306,7 @@ class HTML5VideoViewProxy extends Handler
if (mPosterBytes.size() > 0) {
Bitmap poster = BitmapFactory.decodeByteArray(
mPosterBytes.toByteArray(), 0, mPosterBytes.size());
- if (poster != null) {
- mProxy.doSetPoster(poster);
- }
+ mProxy.doSetPoster(poster);
}
cleanup();
} else if (mStatusCode >= 300 && mStatusCode < 400) {
@@ -401,6 +403,10 @@ class HTML5VideoViewProxy extends Handler
case ENDED:
nativeOnEnded(mNativePointer);
break;
+ case POSTER_FETCHED:
+ Bitmap poster = (Bitmap) msg.obj;
+ nativeOnPosterFetched(poster, mNativePointer);
+ break;
}
}
};
@@ -410,10 +416,11 @@ class HTML5VideoViewProxy extends Handler
if (poster == null) {
return;
}
- // Send the bitmap over to the UI thread.
- Message message = obtainMessage(SET_POSTER);
- message.obj = poster;
- sendMessage(message);
+ // Save a ref to the bitmap and send it over to the WebCore thread.
+ mPoster = poster;
+ Message msg = Message.obtain(mWebCoreHandler, POSTER_FETCHED);
+ msg.obj = poster;
+ mWebCoreHandler.sendMessage(msg);
}
public Context getContext() {
@@ -453,38 +460,15 @@ class HTML5VideoViewProxy extends Handler
}
/**
- * Create the child view that will cary the poster.
+ * Tear down this proxy object.
*/
- public void createView() {
- mChildView = mWebView.mViewManager.createView();
- sendMessage(obtainMessage(INIT));
- }
-
- /**
- * Attach the poster view.
- * @param x, y are the screen coordinates where the poster should be hung.
- * @param width, height denote the size of the poster.
- */
- public void attachView(int x, int y, int width, int height) {
- if (mChildView == null) {
- return;
- }
- mChildView.attachView(x, y, width, height);
- }
-
- /**
- * Remove the child view and, thus, the poster.
- */
- public void removeView() {
- if (mChildView == null) {
- return;
- }
- mChildView.removeView();
+ public void teardown() {
// This is called by the C++ MediaPlayerPrivate dtor.
// Cancel any active poster download.
if (mPosterDownloader != null) {
mPosterDownloader.cancelAndReleaseQueue();
}
+ mNativePointer = 0;
}
/**
@@ -493,6 +477,8 @@ class HTML5VideoViewProxy extends Handler
*/
public void loadPoster(String url) {
if (url == null) {
+ Message message = obtainMessage(LOAD_DEFAULT_POSTER);
+ sendMessage(message);
return;
}
// Cancel any active poster download.
@@ -516,4 +502,5 @@ class HTML5VideoViewProxy extends Handler
private native void nativeOnPrepared(int duration, int width, int height, int nativePointer);
private native void nativeOnEnded(int nativePointer);
+ private native void nativeOnPosterFetched(Bitmap poster, int nativePointer);
}
diff --git a/core/java/android/webkit/PluginManager.java b/core/java/android/webkit/PluginManager.java
index 766bd75..edba446 100644
--- a/core/java/android/webkit/PluginManager.java
+++ b/core/java/android/webkit/PluginManager.java
@@ -65,6 +65,15 @@ public class PluginManager {
private ArrayList<PackageInfo> mPackageInfoCache;
+ // Only plugin matches one of the signatures in the list can be loaded
+ // inside the WebView process
+ private static final String SIGNATURE_1 = "308204a830820390a003020102020900936eacbe07f201df300d06092a864886f70d0101050500308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d301e170d3038303232393031333334365a170d3335303731373031333334365a308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d30820120300d06092a864886f70d01010105000382010d00308201080282010100d6931904dec60b24b1edc762e0d9d8253e3ecd6ceb1de2ff068ca8e8bca8cd6bd3786ea70aa76ce60ebb0f993559ffd93e77a943e7e83d4b64b8e4fea2d3e656f1e267a81bbfb230b578c20443be4c7218b846f5211586f038a14e89c2be387f8ebecf8fcac3da1ee330c9ea93d0a7c3dc4af350220d50080732e0809717ee6a053359e6a694ec2cb3f284a0a466c87a94d83b31093a67372e2f6412c06e6d42f15818dffe0381cc0cd444da6cddc3b82458194801b32564134fbfde98c9287748dbf5676a540d8154c8bbca07b9e247553311c46b9af76fdeeccc8e69e7c8a2d08e782620943f99727d3c04fe72991d99df9bae38a0b2177fa31d5b6afee91f020103a381fc3081f9301d0603551d0e04160414485900563d272c46ae118605a47419ac09ca8c113081c90603551d230481c13081be8014485900563d272c46ae118605a47419ac09ca8c11a1819aa48197308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d820900936eacbe07f201df300c0603551d13040530030101ff300d06092a864886f70d010105050003820101007aaf968ceb50c441055118d0daabaf015b8a765a27a715a2c2b44f221415ffdace03095abfa42df70708726c2069e5c36eddae0400be29452c084bc27eb6a17eac9dbe182c204eb15311f455d824b656dbe4dc2240912d7586fe88951d01a8feb5ae5a4260535df83431052422468c36e22c2a5ef994d61dd7306ae4c9f6951ba3c12f1d1914ddc61f1a62da2df827f603fea5603b2c540dbd7c019c36bab29a4271c117df523cdbc5f3817a49e0efa60cbd7f74177e7a4f193d43f4220772666e4c4d83e1bd5a86087cf34f2dec21e245ca6c2bb016e683638050d2c430eea7c26a1c49d3760a58ab7f1a82cc938b4831384324bd0401fa12163a50570e684d";
+ private static final String SIGNATURE_2 = "308204c5308203ada003020102020900d7cb412f75f4887e300d06092a864886f70d010105050030819d310b3009060355040613025553311330110603550408130a43616c69666f726e69613111300f0603550407130853616e204a6f736531233021060355040a131a41646f62652053797374656d7320496e636f72706f7261746564311c301a060355040b1313496e666f726d6174696f6e2053797374656d73312330210603550403131a41646f62652053797374656d7320496e636f72706f7261746564301e170d3039313030313030323331345a170d3337303231363030323331345a30819d310b3009060355040613025553311330110603550408130a43616c69666f726e69613111300f0603550407130853616e204a6f736531233021060355040a131a41646f62652053797374656d7320496e636f72706f7261746564311c301a060355040b1313496e666f726d6174696f6e2053797374656d73312330210603550403131a41646f62652053797374656d7320496e636f72706f726174656430820120300d06092a864886f70d01010105000382010d0030820108028201010099724f3e05bbd78843794f357776e04b340e13cb1c9ccb3044865180d7d8fec8166c5bbd876da8b80aa71eb6ba3d4d3455c9a8de162d24a25c4c1cd04c9523affd06a279fc8f0d018f242486bdbb2dbfbf6fcb21ed567879091928b876f7ccebc7bccef157366ebe74e33ae1d7e9373091adab8327482154afc0693a549522f8c796dd84d16e24bb221f5dbb809ca56dd2b6e799c5fa06b6d9c5c09ada54ea4c5db1523a9794ed22a3889e5e05b29f8ee0a8d61efe07ae28f65dece2ff7edc5b1416d7c7aad7f0d35e8f4a4b964dbf50ae9aa6d620157770d974131b3e7e3abd6d163d65758e2f0822db9c88598b9db6263d963d13942c91fc5efe34fc1e06e3020103a382010630820102301d0603551d0e041604145af418e419a639e1657db960996364a37ef20d403081d20603551d230481ca3081c780145af418e419a639e1657db960996364a37ef20d40a181a3a481a030819d310b3009060355040613025553311330110603550408130a43616c69666f726e69613111300f0603550407130853616e204a6f736531233021060355040a131a41646f62652053797374656d7320496e636f72706f7261746564311c301a060355040b1313496e666f726d6174696f6e2053797374656d73312330210603550403131a41646f62652053797374656d7320496e636f72706f7261746564820900d7cb412f75f4887e300c0603551d13040530030101ff300d06092a864886f70d0101050500038201010076c2a11fe303359689c2ebc7b2c398eff8c3f9ad545cdbac75df63bf7b5395b6988d1842d6aa1556d595b5692e08224d667a4c9c438f05e74906c53dd8016dde7004068866f01846365efd146e9bfaa48c9ecf657f87b97c757da11f225c4a24177bf2d7188e6cce2a70a1e8a841a14471eb51457398b8a0addd8b6c8c1538ca8f1e40b4d8b960009ea22c188d28924813d2c0b4a4d334b7cf05507e1fcf0a06fe946c7ffc435e173af6fc3e3400643710acc806f830a14788291d46f2feed9fb5c70423ca747ed1572d752894ac1f19f93989766308579393fabb43649aa8806a313b1ab9a50922a44c2467b9062037f2da0d484d9ffd8fe628eeea629ba637";
+
+ private static final Signature[] SIGNATURES = new Signature[] {
+ new Signature(SIGNATURE_1), new Signature(SIGNATURE_2)
+ };
+
private PluginManager(Context context) {
mContext = context;
mPackageInfoCache = new ArrayList<PackageInfo>();
@@ -148,9 +157,12 @@ public class PluginManager {
}
boolean signatureMatch = false;
for (Signature signature : signatures) {
- // TODO: check signature against Google provided one
- signatureMatch = true;
- break;
+ for (int i = 0; i < SIGNATURES.length; i++) {
+ if (SIGNATURES[i].equals(signature)) {
+ signatureMatch = true;
+ break;
+ }
+ }
}
if (!signatureMatch) {
continue;
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 50358c2..4bc1a0e 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2863,17 +2863,31 @@ public class WebView extends AbsoluteLayout
invalidate();
if (mNeedToAdjustWebTextView) {
mNeedToAdjustWebTextView = false;
- mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
- contentToViewDimension(
- nativeFocusCandidateTextSize()));
- Rect bounds = nativeFocusCandidateNodeBounds();
- Rect vBox = contentToViewRect(bounds);
- mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
- vBox.height());
- // If it is a password field, start drawing the
- // WebTextView once again.
- if (nativeFocusCandidateIsPassword()) {
- mWebTextView.setInPassword(true);
+ Rect contentBounds = nativeFocusCandidateNodeBounds();
+ Rect vBox = contentToViewRect(contentBounds);
+ Rect visibleRect = new Rect();
+ calcOurVisibleRect(visibleRect);
+ if (visibleRect.contains(vBox)) {
+ // As a result of the zoom, the textfield is now on
+ // screen. Place the WebTextView in its new place,
+ // accounting for our new scroll/zoom values.
+ mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
+ contentToViewDimension(
+ nativeFocusCandidateTextSize()));
+ mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
+ vBox.height());
+ // If it is a password field, start drawing the
+ // WebTextView once again.
+ if (nativeFocusCandidateIsPassword()) {
+ mWebTextView.setInPassword(true);
+ }
+ } else {
+ // The textfield is now off screen. The user probably
+ // was not zooming to see the textfield better. Remove
+ // the WebTextView. If the user types a key, and the
+ // textfield is still in focus, we will reconstruct
+ // the WebTextView and scroll it back on screen.
+ mWebTextView.remove();
}
}
}
@@ -3857,11 +3871,25 @@ public class WebView extends AbsoluteLayout
if (mSnapScrollMode == SNAP_X
|| mSnapScrollMode == SNAP_X_LOCK) {
- scrollBy(deltaX, 0);
+ if (deltaX == 0) {
+ // keep the scrollbar on the screen even there is no
+ // scroll
+ awakenScrollBars(ViewConfiguration
+ .getScrollDefaultDelay(), false);
+ } else {
+ scrollBy(deltaX, 0);
+ }
mLastTouchX = x;
} else if (mSnapScrollMode == SNAP_Y
|| mSnapScrollMode == SNAP_Y_LOCK) {
- scrollBy(0, deltaY);
+ if (deltaY == 0) {
+ // keep the scrollbar on the screen even there is no
+ // scroll
+ awakenScrollBars(ViewConfiguration
+ .getScrollDefaultDelay(), false);
+ } else {
+ scrollBy(0, deltaY);
+ }
mLastTouchY = y;
} else {
scrollBy(deltaX, deltaY);
@@ -3886,6 +3914,9 @@ public class WebView extends AbsoluteLayout
}
if (done) {
+ // keep the scrollbar on the screen even there is no scroll
+ awakenScrollBars(ViewConfiguration.getScrollDefaultDelay(),
+ false);
// return false to indicate that we can't pan out of the
// view space
return false;
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index 953dd92..1449ea5 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -82,6 +82,8 @@ import com.android.internal.R;
* @attr ref android.R.styleable#AutoCompleteTextView_dropDownAnchor
* @attr ref android.R.styleable#AutoCompleteTextView_dropDownWidth
* @attr ref android.R.styleable#AutoCompleteTextView_dropDownHeight
+ * @attr ref android.R.styleable#AutoCompleteTextView_dropDownVerticalOffset
+ * @attr ref android.R.styleable#AutoCompleteTextView_dropDownHorizontalOffset
*/
public class AutoCompleteTextView extends EditText implements Filter.FilterListener {
static final boolean DEBUG = false;
@@ -1153,7 +1155,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
heightSpec = mDropDownHeight;
}
- mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
+ mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
mPopup.update(getDropDownAnchorView(), mDropDownHorizontalOffset,
mDropDownVerticalOffset, widthSpec, heightSpec);
@@ -1183,8 +1185,8 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
// use outside touchable to dismiss drop down when touching outside of it, so
// only set this if the dropdown is not always visible
- mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
- mPopup.setTouchInterceptor(new PopupTouchIntercepter());
+ mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
+ mPopup.setTouchInterceptor(new PopupTouchInterceptor());
mPopup.showAsDropDown(getDropDownAnchorView(),
mDropDownHorizontalOffset, mDropDownVerticalOffset);
mDropDownList.setSelection(ListView.INVALID_POSITION);
@@ -1408,9 +1410,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
}
}
- private class PopupTouchIntercepter implements OnTouchListener {
+ private class PopupTouchInterceptor implements OnTouchListener {
public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ if (event.getAction() == MotionEvent.ACTION_DOWN &&
+ mPopup != null && mPopup.isShowing()) {
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
showDropDown();
}
diff --git a/core/java/android/widget/QuickContactBadge.java b/core/java/android/widget/QuickContactBadge.java
index b550d69..8019f14 100644
--- a/core/java/android/widget/QuickContactBadge.java
+++ b/core/java/android/widget/QuickContactBadge.java
@@ -25,7 +25,7 @@ import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.FastTrack;
+import android.provider.ContactsContract.QuickContact;
import android.provider.ContactsContract.Intents;
import android.provider.ContactsContract.PhoneLookup;
import android.provider.ContactsContract.RawContacts;
@@ -88,7 +88,7 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
com.android.internal.R.styleable.QuickContactBadge, defStyle, 0);
mMode = a.getInt(com.android.internal.R.styleable.QuickContactBadge_quickContactWindowSize,
- FastTrack.MODE_MEDIUM);
+ QuickContact.MODE_MEDIUM);
a.recycle();
@@ -103,6 +103,15 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
}
/**
+ * Set the QuickContact window mode. Options are {@link QuickContact#MODE_SMALL},
+ * {@link QuickContact#MODE_MEDIUM}, {@link QuickContact#MODE_LARGE}.
+ * @param size
+ */
+ public void setMode(int size) {
+ mMode = size;
+ }
+
+ /**
* Assign the contact uri that this QuickContactBadge should be associated
* with. Note that this is only used for displaying the QuickContact window and
* won't bind the contact's photo for you.
@@ -199,7 +208,7 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
}
private void trigger(Uri lookupUri) {
- FastTrack.showFastTrack(getContext(), this, lookupUri, mMode, mExcludeMimes);
+ QuickContact.showQuickContact(getContext(), this, lookupUri, mMode, mExcludeMimes);
}
private class QueryHandler extends AsyncQueryHandler {
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 7a8a3be..4b26b8f 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -2988,7 +2988,10 @@ public final class BatteryStatsImpl extends BatteryStats {
if (mBackupFile.exists()) {
mBackupFile.delete();
}
- mFile.renameTo(mBackupFile);
+ if (!mFile.renameTo(mBackupFile)) {
+ Log.w("BatteryStats", "Failed to back up file before writing new stats");
+ return;
+ }
}
try {
@@ -3003,8 +3006,14 @@ public final class BatteryStatsImpl extends BatteryStats {
mBackupFile.delete();
mLastWriteTime = SystemClock.elapsedRealtime();
+ return;
} catch (IOException e) {
- Log.e("BatteryStats", "Error writing battery statistics", e);
+ Log.w("BatteryStats", "Error writing battery statistics", e);
+ }
+ if (mFile.exists()) {
+ if (!mFile.delete()) {
+ Log.w(TAG, "Failed to delete mangled file " + mFile);
+ }
}
}
diff --git a/core/jni/android_bluetooth_HeadsetBase.cpp b/core/jni/android_bluetooth_HeadsetBase.cpp
index bb19e92..bad0186 100644
--- a/core/jni/android_bluetooth_HeadsetBase.cpp
+++ b/core/jni/android_bluetooth_HeadsetBase.cpp
@@ -260,7 +260,7 @@ static jboolean connectNative(JNIEnv *env, jobject obj)
#endif
}
-static jboolean connectAsyncNative(JNIEnv *env, jobject obj) {
+static jint connectAsyncNative(JNIEnv *env, jobject obj) {
LOGV(__FUNCTION__);
#ifdef HAVE_BLUETOOTH
struct sockaddr_rc addr;
@@ -268,7 +268,7 @@ static jboolean connectAsyncNative(JNIEnv *env, jobject obj) {
if (nat->rfcomm_connected) {
LOGV("RFCOMM socket is already connected or connection is in progress.");
- return JNI_TRUE;
+ return 0;
}
if (nat->rfcomm_sock < 0) {
@@ -278,7 +278,7 @@ static jboolean connectAsyncNative(JNIEnv *env, jobject obj) {
if (nat->rfcomm_sock < 0) {
LOGE("%s: Could not create RFCOMM socket: %s\n", __FUNCTION__,
strerror(errno));
- return JNI_FALSE;
+ return -1;
}
if (debug_no_encrypt()) {
@@ -291,7 +291,7 @@ static jboolean connectAsyncNative(JNIEnv *env, jobject obj) {
sizeof(lm)) < 0) {
LOGE("%s: Can't set RFCOMM link mode", __FUNCTION__);
close(nat->rfcomm_sock);
- return JNI_FALSE;
+ return -1;
}
LOGI("Created RFCOMM socket fd %d.", nat->rfcomm_sock);
}
@@ -314,7 +314,7 @@ static jboolean connectAsyncNative(JNIEnv *env, jobject obj) {
if (rc >= 0) {
nat->rfcomm_connected = 1;
LOGI("async connect successful");
- return JNI_TRUE;
+ return 0;
}
else if (rc < 0) {
if (errno == EINPROGRESS || errno == EAGAIN)
@@ -322,20 +322,20 @@ static jboolean connectAsyncNative(JNIEnv *env, jobject obj) {
LOGI("async connect is in progress (%s)",
strerror(errno));
nat->rfcomm_connected = -1;
- return JNI_TRUE;
+ return 0;
}
else
{
LOGE("async connect error: %s (%d)", strerror(errno), errno);
close(nat->rfcomm_sock);
nat->rfcomm_sock = -1;
- return JNI_FALSE;
+ return -errno;
}
}
} // fcntl(nat->rfcomm_sock ...)
} // if (nat->rfcomm_sock_flags >= 0)
#endif
- return JNI_FALSE;
+ return -1;
}
static jint waitForAsyncConnectNative(JNIEnv *env, jobject obj,
@@ -357,9 +357,11 @@ static jint waitForAsyncConnectNative(JNIEnv *env, jobject obj,
close(nat->rfcomm_sock);
nat->rfcomm_sock = -1;
}
- if (JNI_FALSE == connectAsyncNative(env, obj)) {
+ int ret = connectAsyncNative(env, obj);
+
+ if (ret < 0) {
LOGI("Failed to re-open RFCOMM socket!");
- return -1;
+ return ret;
}
if (nat->rfcomm_sock >= 0) {
@@ -532,7 +534,7 @@ static JNINativeMethod sMethods[] = {
{"initializeNativeDataNative", "(I)V", (void *)initializeNativeDataNative},
{"cleanupNativeDataNative", "()V", (void *)cleanupNativeDataNative},
{"connectNative", "()Z", (void *)connectNative},
- {"connectAsyncNative", "()Z", (void *)connectAsyncNative},
+ {"connectAsyncNative", "()I", (void *)connectAsyncNative},
{"waitForAsyncConnectNative", "(I)I", (void *)waitForAsyncConnectNative},
{"disconnectNative", "()V", (void *)disconnectNative},
{"sendURCNative", "(Ljava/lang/String;)Z", (void *)sendURCNative},
diff --git a/core/res/res/drawable-hdpi/stat_notify_error.png b/core/res/res/drawable-hdpi/stat_notify_error.png
index 9853cda..37c8853 100644
--- a/core/res/res/drawable-hdpi/stat_notify_error.png
+++ b/core/res/res/drawable-hdpi/stat_notify_error.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_notify_sdcard.png b/core/res/res/drawable-hdpi/stat_notify_sdcard.png
index 320d63d..d3b624b 100755..100644
--- a/core/res/res/drawable-hdpi/stat_notify_sdcard.png
+++ b/core/res/res/drawable-hdpi/stat_notify_sdcard.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_notify_sdcard_prepare.png b/core/res/res/drawable-hdpi/stat_notify_sdcard_prepare.png
new file mode 100644
index 0000000..a483ba2
--- /dev/null
+++ b/core/res/res/drawable-hdpi/stat_notify_sdcard_prepare.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_notify_sdcard_usb.png b/core/res/res/drawable-hdpi/stat_notify_sdcard_usb.png
index 1b49692..a5e369e 100755..100644
--- a/core/res/res/drawable-hdpi/stat_notify_sdcard_usb.png
+++ b/core/res/res/drawable-hdpi/stat_notify_sdcard_usb.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_connected_3g.png b/core/res/res/drawable-hdpi/stat_sys_data_connected_3g.png
index 42af121..4f1f377 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_connected_3g.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_connected_3g.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_connected_e.png b/core/res/res/drawable-hdpi/stat_sys_data_connected_e.png
index 6106dd4..c65f56a 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_connected_e.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_connected_e.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_connected_g.png b/core/res/res/drawable-hdpi/stat_sys_data_connected_g.png
index cc6e284..4aca0c7 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_connected_g.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_connected_g.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_in_3g.png b/core/res/res/drawable-hdpi/stat_sys_data_in_3g.png
index 5848981..64f8087 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_in_3g.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_in_3g.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_in_e.png b/core/res/res/drawable-hdpi/stat_sys_data_in_e.png
index e4c6c2b..90aaf71 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_in_e.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_in_e.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_in_g.png b/core/res/res/drawable-hdpi/stat_sys_data_in_g.png
index 05a910b..c21387e 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_in_g.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_in_g.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_inandout_3g.png b/core/res/res/drawable-hdpi/stat_sys_data_inandout_3g.png
index b4383e2..ebfa6fb 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_inandout_3g.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_inandout_3g.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_inandout_e.png b/core/res/res/drawable-hdpi/stat_sys_data_inandout_e.png
index 78b04db..7ccd7de 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_inandout_e.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_inandout_e.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_inandout_g.png b/core/res/res/drawable-hdpi/stat_sys_data_inandout_g.png
index 9475159..c614d0d 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_inandout_g.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_inandout_g.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_out_3g.png b/core/res/res/drawable-hdpi/stat_sys_data_out_3g.png
index 2f49d60..9936f2a 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_out_3g.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_out_3g.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_out_e.png b/core/res/res/drawable-hdpi/stat_sys_data_out_e.png
index 433fa8d..904c565 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_out_e.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_out_e.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_data_out_g.png b/core/res/res/drawable-hdpi/stat_sys_data_out_g.png
index eb43a91..1261c15 100644
--- a/core/res/res/drawable-hdpi/stat_sys_data_out_g.png
+++ b/core/res/res/drawable-hdpi/stat_sys_data_out_g.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_gps_acquiring.png b/core/res/res/drawable-hdpi/stat_sys_gps_acquiring.png
index fe7b2cc..9003d67 100644
--- a/core/res/res/drawable-hdpi/stat_sys_gps_acquiring.png
+++ b/core/res/res/drawable-hdpi/stat_sys_gps_acquiring.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_gps_on.png b/core/res/res/drawable-hdpi/stat_sys_gps_on.png
index 6ab4720..99a8c6c 100644
--- a/core/res/res/drawable-hdpi/stat_sys_gps_on.png
+++ b/core/res/res/drawable-hdpi/stat_sys_gps_on.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_no_sim.png b/core/res/res/drawable-hdpi/stat_sys_no_sim.png
index 48d1ca3..157491e 100644
--- a/core/res/res/drawable-hdpi/stat_sys_no_sim.png
+++ b/core/res/res/drawable-hdpi/stat_sys_no_sim.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_phone_call.png b/core/res/res/drawable-hdpi/stat_sys_phone_call.png
index 0aa15d6..950713b 100644
--- a/core/res/res/drawable-hdpi/stat_sys_phone_call.png
+++ b/core/res/res/drawable-hdpi/stat_sys_phone_call.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_phone_call_bluetooth.png b/core/res/res/drawable-hdpi/stat_sys_phone_call_bluetooth.png
index a143f87..2d13237 100644
--- a/core/res/res/drawable-hdpi/stat_sys_phone_call_bluetooth.png
+++ b/core/res/res/drawable-hdpi/stat_sys_phone_call_bluetooth.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_phone_call_forward.png b/core/res/res/drawable-hdpi/stat_sys_phone_call_forward.png
index b1ab8ac..07a2e9d 100644
--- a/core/res/res/drawable-hdpi/stat_sys_phone_call_forward.png
+++ b/core/res/res/drawable-hdpi/stat_sys_phone_call_forward.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_phone_call_on_hold.png b/core/res/res/drawable-hdpi/stat_sys_phone_call_on_hold.png
index b881a67..033a558 100644
--- a/core/res/res/drawable-hdpi/stat_sys_phone_call_on_hold.png
+++ b/core/res/res/drawable-hdpi/stat_sys_phone_call_on_hold.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_speakerphone.png b/core/res/res/drawable-hdpi/stat_sys_speakerphone.png
index 62eadb3..51dea58 100644
--- a/core/res/res/drawable-hdpi/stat_sys_speakerphone.png
+++ b/core/res/res/drawable-hdpi/stat_sys_speakerphone.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_vp_phone_call.png b/core/res/res/drawable-hdpi/stat_sys_vp_phone_call.png
index d6b25d2..dfb3424 100644
--- a/core/res/res/drawable-hdpi/stat_sys_vp_phone_call.png
+++ b/core/res/res/drawable-hdpi/stat_sys_vp_phone_call.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_vp_phone_call_bluetooth.png b/core/res/res/drawable-hdpi/stat_sys_vp_phone_call_bluetooth.png
index a143f87..2d13237 100644
--- a/core/res/res/drawable-hdpi/stat_sys_vp_phone_call_bluetooth.png
+++ b/core/res/res/drawable-hdpi/stat_sys_vp_phone_call_bluetooth.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_vp_phone_call_on_hold.png b/core/res/res/drawable-hdpi/stat_sys_vp_phone_call_on_hold.png
index 53608cf..402295b 100644
--- a/core/res/res/drawable-hdpi/stat_sys_vp_phone_call_on_hold.png
+++ b/core/res/res/drawable-hdpi/stat_sys_vp_phone_call_on_hold.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_warning.png b/core/res/res/drawable-hdpi/stat_sys_warning.png
index 8f7bd5d..37c8853 100644
--- a/core/res/res/drawable-hdpi/stat_sys_warning.png
+++ b/core/res/res/drawable-hdpi/stat_sys_warning.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_0.png b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_0.png
index 9a0aa21..55a2ad8 100644
--- a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_0.png
+++ b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_0.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_1.png b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_1.png
index 39db490..d16b3e8 100644
--- a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_1.png
+++ b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_1.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_2.png b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_2.png
index 5c0ae76..2511083 100644
--- a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_2.png
+++ b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_2.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_3.png b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_3.png
index f7e0b38..e0799a5 100644
--- a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_3.png
+++ b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_3.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_4.png b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_4.png
index 5ad5d12..2385c3a 100644
--- a/core/res/res/drawable-hdpi/stat_sys_wifi_signal_4.png
+++ b/core/res/res/drawable-hdpi/stat_sys_wifi_signal_4.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_notify_sdcard.png b/core/res/res/drawable-mdpi/stat_notify_sdcard.png
index feac3b7..23093ac 100644
--- a/core/res/res/drawable-mdpi/stat_notify_sdcard.png
+++ b/core/res/res/drawable-mdpi/stat_notify_sdcard.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_notify_sdcard_prepare.png b/core/res/res/drawable-mdpi/stat_notify_sdcard_prepare.png
new file mode 100644
index 0000000..9abb1c9
--- /dev/null
+++ b/core/res/res/drawable-mdpi/stat_notify_sdcard_prepare.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_notify_sdcard_usb.png b/core/res/res/drawable-mdpi/stat_notify_sdcard_usb.png
index 6de4043..9880694 100644
--- a/core/res/res/drawable-mdpi/stat_notify_sdcard_usb.png
+++ b/core/res/res/drawable-mdpi/stat_notify_sdcard_usb.png
Binary files differ
diff --git a/core/res/res/layout/contact_header.xml b/core/res/res/layout/contact_header.xml
index b2bc845..d551a26 100644
--- a/core/res/res/layout/contact_header.xml
+++ b/core/res/res/layout/contact_header.xml
@@ -23,10 +23,9 @@
android:paddingRight="5dip">
<android.widget.QuickContactBadge android:id="@+id/photo"
- android:layout_alignParentLeft="true"
android:layout_gravity="center_vertical"
- android:layout_marginRight="10dip"
- android:layout_marginLeft="10dip"
+ android:layout_marginRight="8dip"
+ android:layout_marginLeft="-1dip"
style="@*android:style/Widget.QuickContactBadge.WindowSmall" />
/>
@@ -60,7 +59,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:maxLines="1"
+ android:singleLine="true"
android:ellipsize="end"
android:layout_marginTop="-4dip"
/>
diff --git a/core/res/res/layout/keyguard_screen_rotary_unlock.xml b/core/res/res/layout/keyguard_screen_rotary_unlock.xml
index 9f18124..59b69cd 100644
--- a/core/res/res/layout/keyguard_screen_rotary_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_rotary_unlock.xml
@@ -30,7 +30,7 @@
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="#A0000000"
+ android:background="#70000000"
>
<TextView
@@ -135,4 +135,4 @@
</RelativeLayout>
-</FrameLayout> \ No newline at end of file
+</FrameLayout>
diff --git a/core/res/res/layout/keyguard_screen_rotary_unlock_land.xml b/core/res/res/layout/keyguard_screen_rotary_unlock_land.xml
index 5fe1dde..c503455 100644
--- a/core/res/res/layout/keyguard_screen_rotary_unlock_land.xml
+++ b/core/res/res/layout/keyguard_screen_rotary_unlock_land.xml
@@ -30,7 +30,7 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="#A0000000"
+ android:background="#70000000"
>
<!-- left side -->
diff --git a/core/res/res/layout/keyguard_screen_unlock_landscape.xml b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
index 059e899..3e00ae8e1 100644
--- a/core/res/res/layout/keyguard_screen_unlock_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
@@ -26,7 +26,7 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="#A0000000"
+ android:background="#70000000"
>
<!-- left side: instructions and emergency call button -->
diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
index f3c7559..0525356 100644
--- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
@@ -26,7 +26,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
- android:background="#A0000000"
+ android:background="#70000000"
>
<LinearLayout
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 999e6ed..52e3200 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1176,6 +1176,8 @@
<public type="attr" name="scrollbarDefaultDelayBeforeFade" />
<public type="attr" name="fadeScrollbars" />
<public type="attr" name="colorBackgroundCacheHint" />
+ <public type="attr" name="dropDownHorizontalOffset" />
+ <public type="attr" name="dropDownVerticalOffset" />
<public type="style" name="Theme.Wallpaper" />
<public type="style" name="Theme.Wallpaper.NoTitleBar" />
@@ -1191,4 +1193,5 @@
can be seen. -->
<public type="drawable" name="screen_background_dark_transparent" />
<public type="drawable" name="screen_background_light_transparent" />
+ <public type="drawable" name="stat_notify_sdcard_prepare" />
</resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 7191a46..7760db1 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1243,6 +1243,13 @@
<!-- MMS phone number type -->
<string name="phoneTypeMms">MMS</string>
+ <!-- Label for a birthday event -->
+ <string name="eventTypeBirthday">Birthday</string>
+ <!-- Label for an anniversary event -->
+ <string name="eventTypeAnniversary">Anniversary</string>
+ <!-- Label for other events -->
+ <string name="eventTypeOther">Event</string>
+
<!-- Custom email type -->
<string name="emailTypeCustom">Custom</string>
<!-- Home email type -->
@@ -1299,7 +1306,7 @@
<string name="orgTypeOther">Other</string>
<!-- Custom organization type -->
<string name="orgTypeCustom">Custom</string>
-
+
<!-- Attbution of a contact status update, when the time of update is unknown -->
<string name="contact_status_update_attribution">Via <xliff:g id="source" example="Google Talk">%1$s</xliff:g></string>
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 2ed5d3b..8e967fb 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -603,18 +603,19 @@ status_t AudioFlinger::setParameters(int ioHandle, const String8& keyValuePairs)
return result;
}
- // Check if parameters are for an output
- PlaybackThread *playbackThread = checkPlaybackThread_l(ioHandle);
- if (playbackThread != NULL) {
- return playbackThread->setParameters(keyValuePairs);
+ // hold a strong ref on thread in case closeOutput() or closeInput() is called
+ // and the thread is exited once the lock is released
+ sp<ThreadBase> thread;
+ {
+ Mutex::Autolock _l(mLock);
+ thread = checkPlaybackThread_l(ioHandle);
+ if (thread == NULL) {
+ thread = checkRecordThread_l(ioHandle);
+ }
}
-
- // Check if parameters are for an input
- RecordThread *recordThread = checkRecordThread_l(ioHandle);
- if (recordThread != NULL) {
- return recordThread->setParameters(keyValuePairs);
+ if (thread != NULL) {
+ return thread->setParameters(keyValuePairs);
}
-
return BAD_VALUE;
}
@@ -626,6 +627,9 @@ String8 AudioFlinger::getParameters(int ioHandle, const String8& keys)
if (ioHandle == 0) {
return mAudioHardware->getParameters(keys);
}
+
+ Mutex::Autolock _l(mLock);
+
PlaybackThread *playbackThread = checkPlaybackThread_l(ioHandle);
if (playbackThread != NULL) {
return playbackThread->getParameters(keys);
@@ -736,7 +740,7 @@ AudioFlinger::ThreadBase::~ThreadBase()
void AudioFlinger::ThreadBase::exit()
{
- // keep a strong ref on ourself so that we want get
+ // keep a strong ref on ourself so that we wont get
// destroyed in the middle of requestExitAndWait()
sp <ThreadBase> strongMe = this;
@@ -778,9 +782,14 @@ status_t AudioFlinger::ThreadBase::setParameters(const String8& keyValuePairs)
mNewParameters.add(keyValuePairs);
mWaitWorkCV.signal();
- mParamCond.wait(mLock);
- status = mParamStatus;
- mWaitWorkCV.signal();
+ // wait condition with timeout in case the thread loop has exited
+ // before the request could be processed
+ if (mParamCond.waitRelative(mLock, seconds(2)) == NO_ERROR) {
+ status = mParamStatus;
+ mWaitWorkCV.signal();
+ } else {
+ status = TIMED_OUT;
+ }
return status;
}
diff --git a/libs/rs/rsMatrix.cpp b/libs/rs/rsMatrix.cpp
index 5f68197..2f21405 100644
--- a/libs/rs/rsMatrix.cpp
+++ b/libs/rs/rsMatrix.cpp
@@ -85,7 +85,7 @@ void Matrix::loadRotate(float rot, float x, float y, float z)
const float zx = z * x;
const float xs = x * s;
const float ys = y * s;
- const float zs = z * s;
+ const float zs = z * s;
m[ 0] = x*x*nc + c;
m[ 4] = xy*nc - zs;
m[ 8] = zx*nc + ys;
@@ -156,4 +156,9 @@ void Matrix::loadFrustum(float l, float r, float b, float t, float n, float f) {
m[15]= 0;
}
-
+void Matrix::vectorMultiply(float *out, const float *in) const {
+ out[0] = (m[0] * in[0]) + (m[4] * in[1]) + (m[8] * in[2]) + m[12];
+ out[1] = (m[1] * in[0]) + (m[5] * in[1]) + (m[9] * in[2]) + m[13];
+ out[2] = (m[2] * in[0]) + (m[6] * in[1]) + (m[10] * in[2]) + m[14];
+ out[3] = (m[3] * in[0]) + (m[7] * in[1]) + (m[11] * in[2]) + m[15];
+}
diff --git a/libs/rs/rsMatrix.h b/libs/rs/rsMatrix.h
index 7dc4165..11ce42e 100644
--- a/libs/rs/rsMatrix.h
+++ b/libs/rs/rsMatrix.h
@@ -23,7 +23,7 @@
namespace android {
namespace renderscript {
-struct Matrix
+struct Matrix
{
float m[16];
@@ -47,6 +47,8 @@ struct Matrix
void loadOrtho(float l, float r, float b, float t, float n, float f);
void loadFrustum(float l, float r, float b, float t, float n, float f);
+ void vectorMultiply(float *v4out, const float *v3in) const;
+
void multiply(const Matrix *rhs) {
Matrix tmp;
tmp.loadMultiply(this, rhs);
@@ -71,7 +73,7 @@ struct Matrix
};
-
+
}
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index 9bfa602..eea8b3b 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -121,7 +121,14 @@ void ProgramVertex::setTextureMatrix(const rsc_Matrix *m) const
mDirty = true;
}
-
+void ProgramVertex::transformToScreen(const Context *rsc, float *v4out, const float *v3in) const
+{
+ float *f = static_cast<float *>(mConstants->getPtr());
+ Matrix mvp;
+ mvp.loadMultiply((Matrix *)&f[RS_PROGRAM_VERTEX_MODELVIEW_OFFSET],
+ (Matrix *)&f[RS_PROGRAM_VERTEX_PROJECTION_OFFSET]);
+ mvp.vectorMultiply(v4out, v3in);
+}
ProgramVertexState::ProgramVertexState()
{
diff --git a/libs/rs/rsProgramVertex.h b/libs/rs/rsProgramVertex.h
index e198f23..493668c 100644
--- a/libs/rs/rsProgramVertex.h
+++ b/libs/rs/rsProgramVertex.h
@@ -43,6 +43,9 @@ public:
void setModelviewMatrix(const rsc_Matrix *) const;
void setTextureMatrix(const rsc_Matrix *) const;
+ void transformToScreen(const Context *, float *v4out, const float *v3in) const;
+
+
protected:
uint32_t mLightCount;
ObjectBaseRef<const Light> mLights[MAX_LIGHTS];
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index 8919465..17d14f5 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -22,6 +22,8 @@
#include "acc/acc.h"
#include "utils/Timers.h"
+#define GL_GLEXT_PROTOTYPES
+
#include <GLES/gl.h>
#include <GLES/glext.h>
@@ -744,6 +746,48 @@ static void SC_drawQuad(float x1, float y1, float z1,
x4, y4, z4, 0, 0);
}
+static void SC_drawSpriteScreenspace(float x, float y, float z, float w, float h)
+{
+ GET_TLS();
+ rsc->setupCheck();
+
+ GLint crop[4] = {0, h, w, -h};
+ glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
+ glDrawTexfOES(x, y, z, w, h);
+}
+
+static void SC_drawSprite(float x, float y, float z, float w, float h)
+{
+ GET_TLS();
+ rsc->setupCheck();
+
+ float vin[3] = {x, y, z};
+ float vout[4];
+
+ //LOGE("ds in %f %f %f", x, y, z);
+ rsc->getVertex()->transformToScreen(rsc, vout, vin);
+ //LOGE("ds out %f %f %f %f", vout[0], vout[1], vout[2], vout[3]);
+ vout[0] /= vout[3];
+ vout[1] /= vout[3];
+ vout[2] /= vout[3];
+
+ vout[0] *= rsc->getWidth() / 2;
+ vout[1] *= rsc->getHeight() / 2;
+ vout[0] += rsc->getWidth() / 2;
+ vout[1] += rsc->getHeight() / 2;
+
+ vout[0] -= w/2;
+ vout[1] -= h/2;
+
+ //LOGE("ds out2 %f %f %f", vout[0], vout[1], vout[2]);
+
+ // U, V, W, H
+ GLint crop[4] = {0, h, w, -h};
+ glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
+ glDrawTexiOES(vout[0], vout[1], 0/*vout[2]*/, w, h);
+}
+
+
static void SC_drawRect(float x1, float y1,
float x2, float y2, float z)
{
@@ -1172,6 +1216,10 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
"void", "(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)" },
{ "drawQuadTexCoords", (void *)&SC_drawQuadTexCoords,
"void", "(float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, float x4, float y4, float z4, float u4, float v4)" },
+ { "drawSprite", (void *)&SC_drawSprite,
+ "void", "(float x, float y, float z, float w, float h)" },
+ { "drawSpriteScreenspace", (void *)&SC_drawSpriteScreenspace,
+ "void", "(float x, float y, float z, float w, float h)" },
{ "drawLine", (void *)&SC_drawLine,
"void", "(float x1, float y1, float z1, float x2, float y2, float z2)" },
{ "drawPoint", (void *)&SC_drawPoint,
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index 2894bf0..07222ec 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -294,8 +294,8 @@ sp<SurfaceBuffer> Layer::requestBuffer(int index, int usage)
this, index, w, h, strerror(-err));
} else {
LOGD_IF(DEBUG_RESIZE,
- "Layer::requestBuffer(this=%p), index=%d, w=%d, h=%d",
- this, index, w, h);
+ "Layer::requestBuffer(this=%p), index=%d, w=%d, h=%d, handle=%p",
+ this, index, w, h, buffer->handle);
}
if (err == NO_ERROR && buffer->handle != 0) {
@@ -318,22 +318,18 @@ uint32_t Layer::doTransaction(uint32_t flags)
const Layer::State& front(drawingState());
const Layer::State& temp(currentState());
- // Index of the back buffer
- const bool backbufferChanged = (front.w != temp.w) || (front.h != temp.h);
- if (backbufferChanged) {
+ if ((front.requested_w != temp.requested_w) ||
+ (front.requested_h != temp.requested_h)) {
// the size changed, we need to ask our client to request a new buffer
LOGD_IF(DEBUG_RESIZE,
"resize (layer=%p), requested (%dx%d), "
"drawing (%d,%d), (%dx%d), (%dx%d)",
- this, int(temp.w), int(temp.h),
- int(drawingState().w), int(drawingState().h),
+ this,
+ int(temp.requested_w), int(temp.requested_h),
+ int(front.requested_w), int(front.requested_h),
int(mBuffers[0]->getWidth()), int(mBuffers[0]->getHeight()),
int(mBuffers[1]->getWidth()), int(mBuffers[1]->getHeight()));
- // record the new size, form this point on, when the client request a
- // buffer, it'll get the new size.
- setDrawingSize(temp.w, temp.h);
-
// we're being resized and there is a freeze display request,
// acquire a freeze lock, so that the screen stays put
// until we've redrawn at the new size; this is to avoid
@@ -346,9 +342,16 @@ uint32_t Layer::doTransaction(uint32_t flags)
}
}
- // recompute the visible region
- flags |= Layer::eVisibleRegion;
- this->contentDirty = true;
+ // this will make sure LayerBase::doTransaction doesn't update
+ // the drawing state's size
+ Layer::State& editDraw(mDrawingState);
+ editDraw.requested_w = temp.requested_w;
+ editDraw.requested_h = temp.requested_h;
+
+ // record the new size, form this point on, when the client request a
+ // buffer, it'll get the new size.
+ setDrawingSize(temp.requested_w, temp.requested_h);
+
// all buffers need reallocation
lcblk->reallocate();
}
@@ -392,11 +395,35 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
const Region dirty(lcblk->getDirtyRegion(buf));
mPostedDirtyRegion = dirty.intersect( newFrontBuffer->getBounds() );
-
const Layer::State& front(drawingState());
- if (newFrontBuffer->getWidth() == front.w &&
- newFrontBuffer->getHeight() ==front.h) {
- mFreezeLock.clear();
+ if (newFrontBuffer->getWidth() == front.requested_w &&
+ newFrontBuffer->getHeight() == front.requested_h)
+ {
+ if ((front.w != front.requested_w) ||
+ (front.h != front.requested_h))
+ {
+ // Here we pretend the transaction happened by updating the
+ // current and drawing states. Drawing state is only accessed
+ // in this thread, no need to have it locked
+ Layer::State& editDraw(mDrawingState);
+ editDraw.w = editDraw.requested_w;
+ editDraw.h = editDraw.requested_h;
+
+ // We also need to update the current state so that we don't
+ // end-up doing too much work during the next transaction.
+ // NOTE: We actually don't need hold the transaction lock here
+ // because State::w and State::h are only accessed from
+ // this thread
+ Layer::State& editTemp(currentState());
+ editTemp.w = editDraw.w;
+ editTemp.h = editDraw.h;
+
+ // recompute visible region
+ recomputeVisibleRegions = true;
+
+ // we now have the correct size, unfreeze the screen
+ mFreezeLock.clear();
+ }
}
// FIXME: signal an event if we have more buffers waiting
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index a351253..d83c842 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -34,12 +34,6 @@
#include "DisplayHardware/DisplayHardware.h"
-// We don't honor the premultiplied alpha flags, which means that
-// premultiplied surface may be composed using a non-premultiplied
-// equation. We do this because it may be a lot faster on some hardware
-// The correct value is HONOR_PREMULTIPLIED_ALPHA = 1
-#define HONOR_PREMULTIPLIED_ALPHA 0
-
namespace android {
// ---------------------------------------------------------------------------
@@ -89,26 +83,22 @@ void LayerBase::initStates(uint32_t w, uint32_t h, uint32_t flags)
if (flags & ISurfaceComposer::eNonPremultiplied)
mPremultipliedAlpha = false;
- mCurrentState.z = 0;
- mCurrentState.w = w;
- mCurrentState.h = h;
- mCurrentState.alpha = 0xFF;
- mCurrentState.flags = layerFlags;
- mCurrentState.sequence = 0;
+ mCurrentState.z = 0;
+ mCurrentState.w = w;
+ mCurrentState.h = h;
+ mCurrentState.requested_w = w;
+ mCurrentState.requested_h = h;
+ mCurrentState.alpha = 0xFF;
+ mCurrentState.flags = layerFlags;
+ mCurrentState.sequence = 0;
mCurrentState.transform.set(0, 0);
// drawing state & current state are identical
mDrawingState = mCurrentState;
}
-void LayerBase::commitTransaction(bool skipSize) {
- const uint32_t w = mDrawingState.w;
- const uint32_t h = mDrawingState.h;
+void LayerBase::commitTransaction() {
mDrawingState = mCurrentState;
- if (skipSize) {
- mDrawingState.w = w;
- mDrawingState.h = h;
- }
}
void LayerBase::forceVisibilityTransaction() {
// this can be called without SurfaceFlinger.mStateLock, but if we
@@ -144,10 +134,10 @@ bool LayerBase::setLayer(uint32_t z) {
return true;
}
bool LayerBase::setSize(uint32_t w, uint32_t h) {
- if (mCurrentState.w == w && mCurrentState.h == h)
+ if (mCurrentState.requested_w == w && mCurrentState.requested_h == h)
return false;
- mCurrentState.w = w;
- mCurrentState.h = h;
+ mCurrentState.requested_w = w;
+ mCurrentState.requested_h = h;
requestTransaction();
return true;
}
@@ -204,13 +194,25 @@ uint32_t LayerBase::doTransaction(uint32_t flags)
const Layer::State& front(drawingState());
const Layer::State& temp(currentState());
- if (temp.sequence != front.sequence) {
+ if ((front.requested_w != temp.requested_w) ||
+ (front.requested_h != temp.requested_h)) {
+ // resize the layer, set the physical size to the requested size
+ Layer::State& editTemp(currentState());
+ editTemp.w = temp.requested_w;
+ editTemp.h = temp.requested_h;
+ }
+
+ if ((front.w != temp.w) || (front.h != temp.h)) {
// invalidate and recompute the visible regions if needed
- flags |= eVisibleRegion;
+ flags |= Layer::eVisibleRegion;
this->contentDirty = true;
}
if (temp.sequence != front.sequence) {
+ // invalidate and recompute the visible regions if needed
+ flags |= eVisibleRegion;
+ this->contentDirty = true;
+
const bool linearFiltering = mUseLinearFiltering;
mUseLinearFiltering = false;
if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
@@ -223,7 +225,7 @@ uint32_t LayerBase::doTransaction(uint32_t flags)
}
// Commit the transaction
- commitTransaction(flags & eRestartTransaction);
+ commitTransaction();
return flags;
}
diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h
index 233737d..16ee542 100644
--- a/libs/surfaceflinger/LayerBase.h
+++ b/libs/surfaceflinger/LayerBase.h
@@ -88,6 +88,8 @@ public:
struct State {
uint32_t w;
uint32_t h;
+ uint32_t requested_w;
+ uint32_t requested_h;
uint32_t z;
uint8_t alpha;
uint8_t flags;
@@ -107,7 +109,7 @@ public:
bool setTransparentRegionHint(const Region& opaque);
bool setFlags(uint8_t flags, uint8_t mask);
- void commitTransaction(bool skipSize);
+ void commitTransaction();
bool requestTransaction();
void forceVisibilityTransaction();
@@ -211,7 +213,6 @@ public:
enum { // flags for doTransaction()
eVisibleRegion = 0x00000002,
- eRestartTransaction = 0x00000008
};
diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp
index 4ee176c..eb0983a 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -594,12 +594,6 @@ void SurfaceFlinger::handleTransactionLocked(
const uint32_t flags = layer->doTransaction(0);
if (flags & Layer::eVisibleRegion)
mVisibleRegionsDirty = true;
-
- if (flags & Layer::eRestartTransaction) {
- // restart the transaction, but back-off a little
- layer->setTransactionFlags(eTransactionNeeded);
- setTransactionFlags(eTraversalNeeded, ms2ns(8));
- }
}
}
@@ -1131,7 +1125,14 @@ void SurfaceFlinger::closeGlobalTransaction()
// take effect before returning.
Mutex::Autolock _l(mStateLock);
while (mResizeTransationPending) {
- mTransactionCV.wait(mStateLock);
+ status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5));
+ if (CC_UNLIKELY(err != NO_ERROR)) {
+ // just in case something goes wrong in SF, return to the
+ // called after a few seconds.
+ LOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!");
+ mResizeTransationPending = false;
+ break;
+ }
}
}
}
diff --git a/libs/utils/BackupData.cpp b/libs/utils/BackupData.cpp
index 2535094..adb3174 100644
--- a/libs/utils/BackupData.cpp
+++ b/libs/utils/BackupData.cpp
@@ -107,7 +107,7 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize)
} else {
k = key;
}
- if (true) {
+ if (false) {
LOGD("Writing entity: prefix='%s' key='%s' dataSize=%d", m_keyPrefix.string(), key.string(),
dataSize);
}
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index f4c4586..d90871e 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -178,12 +178,14 @@ public class AudioService extends IAudioService.Stub {
if (mMediaServerOk) {
sendMsg(mAudioHandler, MSG_MEDIA_SERVER_DIED, SHARED_MSG, SENDMSG_NOOP, 0, 0,
null, 1500);
+ mMediaServerOk = false;
}
break;
case AudioSystem.AUDIO_STATUS_OK:
if (!mMediaServerOk) {
sendMsg(mAudioHandler, MSG_MEDIA_SERVER_STARTED, SHARED_MSG, SENDMSG_NOOP, 0, 0,
null, 0);
+ mMediaServerOk = true;
}
break;
default:
@@ -1282,10 +1284,13 @@ public class AudioService extends IAudioService.Stub {
break;
case MSG_MEDIA_SERVER_DIED:
- Log.e(TAG, "Media server died.");
// Force creation of new IAudioflinger interface
- mMediaServerOk = false;
- AudioSystem.isMusicActive();
+ if (!mMediaServerOk) {
+ Log.e(TAG, "Media server died.");
+ AudioSystem.isMusicActive();
+ sendMsg(mAudioHandler, MSG_MEDIA_SERVER_DIED, SHARED_MSG, SENDMSG_NOOP, 0, 0,
+ null, 500);
+ }
break;
case MSG_MEDIA_SERVER_STARTED:
@@ -1323,8 +1328,6 @@ public class AudioService extends IAudioService.Stub {
// Restore ringer mode
setRingerModeInt(getRingerMode(), false);
-
- mMediaServerOk = true;
break;
case MSG_PLAY_SOUND_EFFECT:
diff --git a/opengl/tests/gl_basic/Android.mk b/opengl/tests/gl_basic/Android.mk
new file mode 100644
index 0000000..6b6341f
--- /dev/null
+++ b/opengl/tests/gl_basic/Android.mk
@@ -0,0 +1,17 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ gl_basic.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libEGL \
+ libGLESv1_CM \
+ libui
+
+LOCAL_MODULE:= test-opengl-gl_basic
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/gl_basic/gl_basic.cpp b/opengl/tests/gl_basic/gl_basic.cpp
new file mode 100644
index 0000000..7dc2378
--- /dev/null
+++ b/opengl/tests/gl_basic/gl_basic.cpp
@@ -0,0 +1,357 @@
+// Simple OpenGL ES 1.x application showing how to initialize and draw something.
+
+#include <EGL/egl.h>
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
+#include <ui/FramebufferNativeWindow.h>
+#include <ui/EGLUtils.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+using namespace android;
+
+EGLDisplay eglDisplay;
+EGLSurface eglSurface;
+EGLContext eglContext;
+GLuint texture;
+
+#define FIXED_ONE 0x10000
+#define ITERATIONS 50
+
+int init_gl_surface(void);
+void free_gl_surface(void);
+void init_scene(void);
+void render();
+void create_texture(void);
+int readTimer(void);
+
+static void gluLookAt(float eyeX, float eyeY, float eyeZ,
+ float centerX, float centerY, float centerZ, float upX, float upY,
+ float upZ)
+{
+ // See the OpenGL GLUT documentation for gluLookAt for a description
+ // of the algorithm. We implement it in a straightforward way:
+
+ float fx = centerX - eyeX;
+ float fy = centerY - eyeY;
+ float fz = centerZ - eyeZ;
+
+ // Normalize f
+ float rlf = 1.0f / sqrtf(fx*fx + fy*fy + fz*fz);
+ fx *= rlf;
+ fy *= rlf;
+ fz *= rlf;
+
+ // Normalize up
+ float rlup = 1.0f / sqrtf(upX*upX + upY*upY + upZ*upZ);
+ upX *= rlup;
+ upY *= rlup;
+ upZ *= rlup;
+
+ // compute s = f x up (x means "cross product")
+
+ float sx = fy * upZ - fz * upY;
+ float sy = fz * upX - fx * upZ;
+ float sz = fx * upY - fy * upX;
+
+ // compute u = s x f
+ float ux = sy * fz - sz * fy;
+ float uy = sz * fx - sx * fz;
+ float uz = sx * fy - sy * fx;
+
+ float m[16] ;
+ m[0] = sx;
+ m[1] = ux;
+ m[2] = -fx;
+ m[3] = 0.0f;
+
+ m[4] = sy;
+ m[5] = uy;
+ m[6] = -fy;
+ m[7] = 0.0f;
+
+ m[8] = sz;
+ m[9] = uz;
+ m[10] = -fz;
+ m[11] = 0.0f;
+
+ m[12] = 0.0f;
+ m[13] = 0.0f;
+ m[14] = 0.0f;
+ m[15] = 1.0f;
+
+ glMultMatrixf(m);
+ glTranslatef(-eyeX, -eyeY, -eyeZ);
+}
+
+
+void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) {
+
+#define X(VAL) {VAL, #VAL}
+ struct {EGLint attribute; const char* name;} names[] = {
+ X(EGL_BUFFER_SIZE),
+ X(EGL_ALPHA_SIZE),
+ X(EGL_BLUE_SIZE),
+ X(EGL_GREEN_SIZE),
+ X(EGL_RED_SIZE),
+ X(EGL_DEPTH_SIZE),
+ X(EGL_STENCIL_SIZE),
+ X(EGL_CONFIG_CAVEAT),
+ X(EGL_CONFIG_ID),
+ X(EGL_LEVEL),
+ X(EGL_MAX_PBUFFER_HEIGHT),
+ X(EGL_MAX_PBUFFER_PIXELS),
+ X(EGL_MAX_PBUFFER_WIDTH),
+ X(EGL_NATIVE_RENDERABLE),
+ X(EGL_NATIVE_VISUAL_ID),
+ X(EGL_NATIVE_VISUAL_TYPE),
+ X(EGL_PRESERVED_RESOURCES),
+ X(EGL_SAMPLES),
+ X(EGL_SAMPLE_BUFFERS),
+ X(EGL_SURFACE_TYPE),
+ X(EGL_TRANSPARENT_TYPE),
+ X(EGL_TRANSPARENT_RED_VALUE),
+ X(EGL_TRANSPARENT_GREEN_VALUE),
+ X(EGL_TRANSPARENT_BLUE_VALUE),
+ X(EGL_BIND_TO_TEXTURE_RGB),
+ X(EGL_BIND_TO_TEXTURE_RGBA),
+ X(EGL_MIN_SWAP_INTERVAL),
+ X(EGL_MAX_SWAP_INTERVAL),
+ X(EGL_LUMINANCE_SIZE),
+ X(EGL_ALPHA_MASK_SIZE),
+ X(EGL_COLOR_BUFFER_TYPE),
+ X(EGL_RENDERABLE_TYPE),
+ X(EGL_CONFORMANT),
+ };
+#undef X
+
+ for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
+ EGLint value = -1;
+ EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
+ EGLint error = eglGetError();
+ if (returnVal && error == EGL_SUCCESS) {
+ printf(" %s: ", names[j].name);
+ printf("%d (0x%x)", value, value);
+ }
+ }
+ printf("\n");
+}
+
+static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
+ if (returnVal != EGL_TRUE) {
+ fprintf(stderr, "%s() returned %d\n", op, returnVal);
+ }
+
+ for (EGLint error = eglGetError(); error != EGL_SUCCESS; error
+ = eglGetError()) {
+ fprintf(stderr, "after %s() eglError %s (0x%x)\n", op, EGLUtils::strerror(error),
+ error);
+ }
+}
+
+int printEGLConfigurations(EGLDisplay dpy) {
+ EGLint numConfig = 0;
+ EGLint returnVal = eglGetConfigs(dpy, NULL, 0, &numConfig);
+ checkEglError("eglGetConfigs", returnVal);
+ if (!returnVal) {
+ return false;
+ }
+
+ printf("Number of EGL configurations: %d\n", numConfig);
+
+ EGLConfig* configs = (EGLConfig*) malloc(sizeof(EGLConfig) * numConfig);
+ if (! configs) {
+ printf("Could not allocate configs.\n");
+ return false;
+ }
+
+ returnVal = eglGetConfigs(dpy, configs, numConfig, &numConfig);
+ checkEglError("eglGetConfigs", returnVal);
+ if (!returnVal) {
+ free(configs);
+ return false;
+ }
+
+ for(int i = 0; i < numConfig; i++) {
+ printf("Configuration %d\n", i);
+ printEGLConfiguration(dpy, configs[i]);
+ }
+
+ free(configs);
+ return true;
+}
+
+int main(int argc, char **argv)
+{
+ int q;
+ int start, end;
+
+ printf("Initializing EGL...\n");
+
+ if(!init_gl_surface())
+ {
+ printf("GL initialisation failed - exiting\n");
+ return 0;
+ }
+
+ init_scene();
+
+ create_texture();
+
+ printf("Running...\n");
+
+ while(true) {
+ render();
+ }
+
+ free_gl_surface();
+
+ return 0;
+}
+
+int init_gl_surface(void)
+{
+ EGLint numConfigs = 1;
+ EGLConfig myConfig = {0};
+ EGLint attrib[] =
+ {
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_NONE
+ };
+
+ if ( (eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY )
+ {
+ printf("eglGetDisplay failed\n");
+ return 0;
+ }
+
+ if ( eglInitialize(eglDisplay, NULL, NULL) != EGL_TRUE )
+ {
+ printf("eglInitialize failed\n");
+ return 0;
+ }
+
+ if (! printEGLConfigurations(eglDisplay)) {
+ printf("printEGLConfigurations failed.\n");
+ return 0;
+ }
+ EGLNativeWindowType window = android_createDisplaySurface();
+ EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig);
+
+ if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig,
+ window, 0)) == EGL_NO_SURFACE )
+ {
+ printf("eglCreateWindowSurface failed\n");
+ return 0;
+ }
+
+ if ( (eglContext = eglCreateContext(eglDisplay, myConfig, 0, 0)) == EGL_NO_CONTEXT )
+ {
+ printf("eglCreateContext failed\n");
+ return 0;
+ }
+
+ if ( eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext) != EGL_TRUE )
+ {
+ printf("eglMakeCurrent failed\n");
+ return 0;
+ }
+
+ return 1;
+}
+
+void free_gl_surface(void)
+{
+ if (eglDisplay != EGL_NO_DISPLAY)
+ {
+ eglMakeCurrent( EGL_NO_DISPLAY, EGL_NO_SURFACE,
+ EGL_NO_SURFACE, EGL_NO_CONTEXT );
+ eglDestroyContext( eglDisplay, eglContext );
+ eglDestroySurface( eglDisplay, eglSurface );
+ eglTerminate( eglDisplay );
+ eglDisplay = EGL_NO_DISPLAY;
+ }
+}
+
+void init_scene(void)
+{
+ glDisable(GL_DITHER);
+ glEnable(GL_CULL_FACE);
+
+ float ratio = 320.0f / 480.0f;
+ glViewport(0, 0, 320, 480);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustumf(-ratio, ratio, -1, 1, 1, 10);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ gluLookAt(
+ 0, 0, 3, // eye
+ 0, 0, 0, // center
+ 0, 1, 0); // up
+
+ glEnable(GL_TEXTURE_2D);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+}
+
+void create_texture(void)
+{
+ const unsigned int on = 0xff0000ff;
+ const unsigned int off = 0xffffffff;
+ const unsigned int pixels[] =
+ {
+ on, off, on, off, on, off, on, off,
+ off, on, off, on, off, on, off, on,
+ on, off, on, off, on, off, on, off,
+ off, on, off, on, off, on, off, on,
+ on, off, on, off, on, off, on, off,
+ off, on, off, on, off, on, off, on,
+ on, off, on, off, on, off, on, off,
+ off, on, off, on, off, on, off, on,
+ };
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+}
+
+void render()
+{
+ int i, j;
+ int quads = 1;
+
+ const GLfloat vertices[] = {
+ -1, -1, 0,
+ 1, -1, 0,
+ 1, 1, 0,
+ -1, 1, 0
+ };
+
+ const GLfixed texCoords[] = {
+ 0, 0,
+ FIXED_ONE, 0,
+ FIXED_ONE, FIXED_ONE,
+ 0, FIXED_ONE
+ };
+
+ const GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+
+ glVertexPointer(3, GL_FLOAT, 0, vertices);
+ glTexCoordPointer(2, GL_FIXED, 0, texCoords);
+
+ glClearColor(1.0, 1.0, 1.0, 1.0);
+
+ int nelem = sizeof(indices)/sizeof(indices[0]);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
+ glDrawElements(GL_TRIANGLES, nelem, GL_UNSIGNED_SHORT, indices);
+ eglSwapBuffers(eglDisplay, eglSurface);
+}
+
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index fb5e4e6..2738efb 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -50,8 +50,7 @@ import android.util.Log;
* List of settings that are backed up are stored in the Settings.java file
*/
public class SettingsBackupAgent extends BackupHelperAgent {
- // STOPSHIP: set DEBUG to false
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
private static final String KEY_SYSTEM = "system";
private static final String KEY_SECURE = "secure";
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index 3c46954..f8b8ecc 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -816,7 +816,10 @@ class AppWidgetService extends IAppWidgetService.Stub
temp.delete();
}
- writeStateToFileLocked(temp);
+ if (!writeStateToFileLocked(temp)) {
+ Log.w(TAG, "Failed to persist new settings");
+ return;
+ }
//noinspection ResultOfMethodCallIgnored
real.delete();
@@ -824,7 +827,7 @@ class AppWidgetService extends IAppWidgetService.Stub
temp.renameTo(real);
}
- void writeStateToFileLocked(File file) {
+ boolean writeStateToFileLocked(File file) {
FileOutputStream stream = null;
int N;
@@ -877,6 +880,7 @@ class AppWidgetService extends IAppWidgetService.Stub
out.endDocument();
stream.close();
+ return true;
} catch (IOException e) {
try {
if (stream != null) {
@@ -889,6 +893,7 @@ class AppWidgetService extends IAppWidgetService.Stub
//noinspection ResultOfMethodCallIgnored
file.delete();
}
+ return false;
}
}
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index ef0cbee..82a7c1c 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -79,7 +79,7 @@ import java.util.Map;
class BackupManagerService extends IBackupManager.Stub {
private static final String TAG = "BackupManagerService";
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
// How often we perform a backup pass. Privileged external callers can
// trigger an immediate pass.
@@ -205,11 +205,9 @@ class BackupManagerService extends IBackupManager.Stub {
File mDataDir;
File mJournalDir;
File mJournal;
- RandomAccessFile mJournalStream;
// Keep a log of all the apps we've ever backed up
private File mEverStored;
- private RandomAccessFile mEverStoredStream;
HashSet<String> mEverStoredApps = new HashSet<String>();
// Persistently track the need to do a full init
@@ -257,7 +255,7 @@ class BackupManagerService extends IBackupManager.Stub {
// Set up the backup-request journaling
mJournalDir = new File(mBaseStateDir, "pending");
mJournalDir.mkdirs(); // creates mBaseStateDir along the way
- makeJournalLocked(); // okay because no other threads are running yet
+ mJournal = null; // will be created on first use
// Set up the various sorts of package tracking we do
initPackageTracking();
@@ -369,56 +367,51 @@ class BackupManagerService extends IBackupManager.Stub {
// this log, we sanity-check its contents here and reconstruct it.
mEverStored = new File(mBaseStateDir, "processed");
File tempProcessedFile = new File(mBaseStateDir, "processed.new");
- try {
- // If there are previous contents, parse them out then start a new
- // file to continue the recordkeeping.
- if (mEverStored.exists()) {
- RandomAccessFile temp = new RandomAccessFile(tempProcessedFile, "rw");
- mEverStoredStream = new RandomAccessFile(mEverStored, "r");
-
- // parse its existing contents
- mEverStoredStream.seek(0);
- temp.seek(0);
- try {
- while (true) {
- PackageInfo info;
- String pkg = mEverStoredStream.readUTF();
- try {
- info = mPackageManager.getPackageInfo(pkg, 0);
- mEverStoredApps.add(pkg);
- temp.writeUTF(pkg);
- if (DEBUG) Log.v(TAG, " + " + pkg);
- } catch (NameNotFoundException e) {
- // nope, this package was uninstalled; don't include it
- if (DEBUG) Log.v(TAG, " - " + pkg);
- }
- }
- } catch (EOFException e) {
- // now we're at EOF
- }
-
- // Once we've rewritten the backup history log, atomically replace the
- // old one with the new one then reopen the file for continuing use.
- temp.close();
- mEverStoredStream.close();
- tempProcessedFile.renameTo(mEverStored);
- }
- // This will create the file if it doesn't exist
- mEverStoredStream = new RandomAccessFile(mEverStored, "rwd");
- mEverStoredStream.seek(mEverStoredStream.length());
- } catch (IOException e) {
- Log.e(TAG, "Unable to open known-stored file!");
- mEverStoredStream = null;
- }
// If we were in the middle of removing something from the ever-backed-up
// file, there might be a transient "processed.new" file still present.
- // We've reconstructed a coherent state at this point though, so we can
- // safely discard that file now.
+ // Ignore it -- we'll validate "processed" against the current package set.
if (tempProcessedFile.exists()) {
tempProcessedFile.delete();
}
+ // If there are previous contents, parse them out then start a new
+ // file to continue the recordkeeping.
+ if (mEverStored.exists()) {
+ RandomAccessFile temp = null;
+ RandomAccessFile in = null;
+
+ try {
+ temp = new RandomAccessFile(tempProcessedFile, "rws");
+ in = new RandomAccessFile(mEverStored, "r");
+
+ while (true) {
+ PackageInfo info;
+ String pkg = in.readUTF();
+ try {
+ info = mPackageManager.getPackageInfo(pkg, 0);
+ mEverStoredApps.add(pkg);
+ temp.writeUTF(pkg);
+ if (DEBUG) Log.v(TAG, " + " + pkg);
+ } catch (NameNotFoundException e) {
+ // nope, this package was uninstalled; don't include it
+ if (DEBUG) Log.v(TAG, " - " + pkg);
+ }
+ }
+ } catch (EOFException e) {
+ // Once we've rewritten the backup history log, atomically replace the
+ // old one with the new one then reopen the file for continuing use.
+ if (!tempProcessedFile.renameTo(mEverStored)) {
+ Log.e(TAG, "Error renaming " + tempProcessedFile + " to " + mEverStored);
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "Error in processed file", e);
+ } finally {
+ try { if (temp != null) temp.close(); } catch (IOException e) {}
+ try { if (in != null) in.close(); } catch (IOException e) {}
+ }
+ }
+
// Register for broadcasts about package install, etc., so we can
// update the provider list.
IntentFilter filter = new IntentFilter();
@@ -428,41 +421,29 @@ class BackupManagerService extends IBackupManager.Stub {
mContext.registerReceiver(mBroadcastReceiver, filter);
}
- private void makeJournalLocked() {
- try {
- mJournal = File.createTempFile("journal", null, mJournalDir);
- mJournalStream = new RandomAccessFile(mJournal, "rwd");
- } catch (IOException e) {
- Log.e(TAG, "Unable to write backup journals");
- mJournal = null;
- mJournalStream = null;
- }
- }
-
private void parseLeftoverJournals() {
- if (mJournal != null) {
- File[] allJournals = mJournalDir.listFiles();
- for (File f : allJournals) {
- if (f.compareTo(mJournal) != 0) {
- // This isn't the current journal, so it must be a leftover. Read
- // out the package names mentioned there and schedule them for
- // backup.
- try {
- Log.i(TAG, "Found stale backup journal, scheduling:");
- RandomAccessFile in = new RandomAccessFile(f, "r");
- while (true) {
- String packageName = in.readUTF();
- Log.i(TAG, " + " + packageName);
- dataChanged(packageName);
- }
- } catch (EOFException e) {
- // no more data; we're done
- } catch (Exception e) {
- // can't read it or other error; just skip it
- } finally {
- // close/delete the file
- f.delete();
+ for (File f : mJournalDir.listFiles()) {
+ if (mJournal == null || f.compareTo(mJournal) != 0) {
+ // This isn't the current journal, so it must be a leftover. Read
+ // out the package names mentioned there and schedule them for
+ // backup.
+ RandomAccessFile in = null;
+ try {
+ Log.i(TAG, "Found stale backup journal, scheduling:");
+ in = new RandomAccessFile(f, "r");
+ while (true) {
+ String packageName = in.readUTF();
+ Log.i(TAG, " + " + packageName);
+ dataChanged(packageName);
}
+ } catch (EOFException e) {
+ // no more data; we're done
+ } catch (Exception e) {
+ Log.e(TAG, "Can't read " + f, e);
+ } finally {
+ // close/delete the file
+ try { if (in != null) in.close(); } catch (IOException e) {}
+ f.delete();
}
}
}
@@ -505,19 +486,8 @@ class BackupManagerService extends IBackupManager.Stub {
void resetBackupState(File stateFileDir) {
synchronized (mQueueLock) {
// Wipe the "what we've ever backed up" tracking
- try {
- // close the ever-stored journal...
- if (mEverStoredStream != null) {
- mEverStoredStream.close();
- }
- // ... so we can delete it and start over
- mEverStored.delete();
- mEverStoredStream = new RandomAccessFile(mEverStored, "rwd");
- } catch (IOException e) {
- Log.e(TAG, "Unable to open known-stored file!");
- mEverStoredStream = null;
- }
mEverStoredApps.clear();
+ mEverStored.delete();
// Remove all the state files
for (File sf : stateFileDir.listFiles()) {
@@ -533,11 +503,7 @@ class BackupManagerService extends IBackupManager.Stub {
int uid = mBackupParticipants.keyAt(i);
HashSet<ApplicationInfo> participants = mBackupParticipants.valueAt(i);
for (ApplicationInfo app: participants) {
- try {
- dataChanged(app.packageName);
- } catch (RemoteException e) {
- // can't happen; we're in the same process
- }
+ dataChanged(app.packageName);
}
}
}
@@ -652,7 +618,6 @@ class BackupManagerService extends IBackupManager.Stub {
// snapshot the pending-backup set and work on that
ArrayList<BackupRequest> queue = new ArrayList<BackupRequest>();
- File oldJournal = mJournal;
synchronized (mQueueLock) {
// Do we have any work to do?
if (mPendingBackups.size() > 0) {
@@ -663,14 +628,8 @@ class BackupManagerService extends IBackupManager.Stub {
mPendingBackups.clear();
// Start a new backup-queue journal file too
- if (mJournalStream != null) {
- try {
- mJournalStream.close();
- } catch (IOException e) {
- // don't need to do anything
- }
- makeJournalLocked();
- }
+ File oldJournal = mJournal;
+ mJournal = null;
// At this point, we have started a new journal file, and the old
// file identity is being passed to the backup processing thread.
@@ -763,11 +722,7 @@ class BackupManagerService extends IBackupManager.Stub {
if (!mEverStoredApps.contains(pkg.packageName)) {
if (DEBUG) Log.i(TAG, "New app " + pkg.packageName
+ " never backed up; scheduling");
- try {
- dataChanged(pkg.packageName);
- } catch (RemoteException e) {
- // can't happen; it's a local method call
- }
+ dataChanged(pkg.packageName);
}
}
}
@@ -871,58 +826,57 @@ class BackupManagerService extends IBackupManager.Stub {
// Called from the backup thread: record that the given app has been successfully
// backed up at least once
void logBackupComplete(String packageName) {
- if (mEverStoredStream != null && !packageName.equals(PACKAGE_MANAGER_SENTINEL)) {
- synchronized (mEverStoredApps) {
- if (mEverStoredApps.add(packageName)) {
- try {
- mEverStoredStream.writeUTF(packageName);
- } catch (IOException e) {
- Log.e(TAG, "Unable to log backup of " + packageName + ", ceasing log");
- try {
- mEverStoredStream.close();
- } catch (IOException ioe) {
- // we're dropping it; no need to handle an exception on close here
- }
- mEverStoredStream = null;
- }
- }
+ if (packageName.equals(PACKAGE_MANAGER_SENTINEL)) return;
+
+ synchronized (mEverStoredApps) {
+ if (!mEverStoredApps.add(packageName)) return;
+
+ RandomAccessFile out = null;
+ try {
+ out = new RandomAccessFile(mEverStored, "rws");
+ out.seek(out.length());
+ out.writeUTF(packageName);
+ } catch (IOException e) {
+ Log.e(TAG, "Can't log backup of " + packageName + " to " + mEverStored);
+ } finally {
+ try { if (out != null) out.close(); } catch (IOException e) {}
}
}
}
// Remove our awareness of having ever backed up the given package
void removeEverBackedUp(String packageName) {
- if (DEBUG) Log.v(TAG, "Removing backed-up knowledge of " + packageName
- + ", new set:");
-
- if (mEverStoredStream != null) {
- synchronized (mEverStoredApps) {
- // Rewrite the file and rename to overwrite. If we reboot in the middle,
- // we'll recognize on initialization time that the package no longer
- // exists and fix it up then.
- File tempKnownFile = new File(mBaseStateDir, "processed.new");
- try {
- mEverStoredStream.close();
- RandomAccessFile known = new RandomAccessFile(tempKnownFile, "rw");
- mEverStoredApps.remove(packageName);
- for (String s : mEverStoredApps) {
- known.writeUTF(s);
- if (DEBUG) Log.v(TAG, " " + s);
- }
- known.close();
- tempKnownFile.renameTo(mEverStored);
- mEverStoredStream = new RandomAccessFile(mEverStored, "rwd");
- } catch (IOException e) {
- // Bad: we couldn't create the new copy. For safety's sake we
- // abandon the whole process and remove all what's-backed-up
- // state entirely, meaning we'll force a backup pass for every
- // participant on the next boot or [re]install.
- Log.w(TAG, "Error rewriting backed-up set; halting log");
- mEverStoredStream = null;
- mEverStoredApps.clear();
- tempKnownFile.delete();
- mEverStored.delete();
+ if (DEBUG) Log.v(TAG, "Removing backed-up knowledge of " + packageName + ", new set:");
+
+ synchronized (mEverStoredApps) {
+ // Rewrite the file and rename to overwrite. If we reboot in the middle,
+ // we'll recognize on initialization time that the package no longer
+ // exists and fix it up then.
+ File tempKnownFile = new File(mBaseStateDir, "processed.new");
+ RandomAccessFile known = null;
+ try {
+ known = new RandomAccessFile(tempKnownFile, "rws");
+ mEverStoredApps.remove(packageName);
+ for (String s : mEverStoredApps) {
+ known.writeUTF(s);
+ if (DEBUG) Log.v(TAG, " " + s);
}
+ known.close();
+ known = null;
+ if (!tempKnownFile.renameTo(mEverStored)) {
+ throw new IOException("Can't rename " + tempKnownFile + " to " + mEverStored);
+ }
+ } catch (IOException e) {
+ // Bad: we couldn't create the new copy. For safety's sake we
+ // abandon the whole process and remove all what's-backed-up
+ // state entirely, meaning we'll force a backup pass for every
+ // participant on the next boot or [re]install.
+ Log.w(TAG, "Error rewriting " + mEverStored, e);
+ mEverStoredApps.clear();
+ tempKnownFile.delete();
+ mEverStored.delete();
+ } finally {
+ try { if (known != null) known.close(); } catch (IOException e) {}
}
}
}
@@ -1018,8 +972,7 @@ class BackupManagerService extends IBackupManager.Stub {
}
class ClearDataObserver extends IPackageDataObserver.Stub {
- public void onRemoveCompleted(String packageName, boolean succeeded)
- throws RemoteException {
+ public void onRemoveCompleted(String packageName, boolean succeeded) {
synchronized(mClearDataLock) {
mClearingData = false;
mClearDataLock.notifyAll();
@@ -1061,9 +1014,11 @@ class BackupManagerService extends IBackupManager.Stub {
try {
EventLog.writeEvent(BACKUP_START_EVENT, mTransport.transportDirName());
- // If we haven't stored anything yet, we need to do an init operation.
- if (status == BackupConstants.TRANSPORT_OK && mEverStoredApps.size() == 0) {
- Log.i(TAG, "Initializing (wiping) backup transport storage");
+ // If we haven't stored package manager metadata yet, we must init the transport.
+ File pmState = new File(mStateDir, PACKAGE_MANAGER_SENTINEL);
+ if (status == BackupConstants.TRANSPORT_OK && pmState.length() <= 0) {
+ Log.i(TAG, "Initializing (wiping) backup state and transport storage");
+ resetBackupState(mStateDir); // Just to make sure.
status = mTransport.initializeDevice();
if (status == BackupConstants.TRANSPORT_OK) {
EventLog.writeEvent(BACKUP_INITIALIZE_EVENT);
@@ -1107,10 +1062,9 @@ class BackupManagerService extends IBackupManager.Stub {
if (status == BackupConstants.TRANSPORT_NOT_INITIALIZED) {
// The backend reports that our dataset has been wiped. We need to
// reset all of our bookkeeping and instead run a new backup pass for
- // everything.
+ // everything. This must come after mBackupOrRestoreInProgress is cleared.
EventLog.writeEvent(BACKUP_RESET_EVENT, mTransport.transportDirName());
resetBackupState(mStateDir);
- backupNow();
}
} catch (Exception e) {
Log.e(TAG, "Error in backup thread", e);
@@ -1123,11 +1077,7 @@ class BackupManagerService extends IBackupManager.Stub {
if (status != BackupConstants.TRANSPORT_OK) {
Log.w(TAG, "Backup pass unsuccessful, restaging");
for (BackupRequest req : mQueue) {
- try {
- dataChanged(req.appInfo.packageName);
- } catch (RemoteException e) {
- // can't happen; it's a local call
- }
+ dataChanged(req.appInfo.packageName);
}
// We also want to reset the backup schedule based on whatever
@@ -1141,7 +1091,7 @@ class BackupManagerService extends IBackupManager.Stub {
// this pass's journal any more; or it failed, in which case we just
// re-enqueued all of these packages in the current active journal.
// Either way, we no longer need this pass's journal.
- if (!mJournal.delete()) {
+ if (mJournal != null && !mJournal.delete()) {
Log.e(TAG, "Unable to remove backup journal file " + mJournal);
}
@@ -1150,6 +1100,12 @@ class BackupManagerService extends IBackupManager.Stub {
synchronized (mQueueLock) {
mBackupOrRestoreInProgress = false;
}
+
+ if (status == BackupConstants.TRANSPORT_NOT_INITIALIZED) {
+ // This must come after mBackupOrRestoreInProgress is cleared.
+ backupNow();
+ }
+
mWakelock.release();
}
}
@@ -1692,13 +1648,13 @@ class BackupManagerService extends IBackupManager.Stub {
stateFile.delete();
// Tell the transport to remove all the persistent storage for the app
- // STOPSHIP TODO - need to handle failures
+ // TODO - need to handle failures
mTransport.clearBackupData(mPackage);
} catch (RemoteException e) {
// can't happen; the transport is local
} finally {
try {
- // STOPSHIP TODO - need to handle failures
+ // TODO - need to handle failures
mTransport.finishBackup();
} catch (RemoteException e) {
// can't happen; the transport is local
@@ -1782,7 +1738,7 @@ class BackupManagerService extends IBackupManager.Stub {
// ----- IBackupManager binder interface -----
- public void dataChanged(String packageName) throws RemoteException {
+ public void dataChanged(String packageName) {
// Record that we need a backup pass for the caller. Since multiple callers
// may share a uid, we need to note all candidates within that uid and schedule
// a backup pass for each of them.
@@ -1840,14 +1796,17 @@ class BackupManagerService extends IBackupManager.Stub {
}
private void writeToJournalLocked(String str) {
- if (mJournalStream != null) {
- try {
- mJournalStream.writeUTF(str);
- } catch (IOException e) {
- Log.e(TAG, "Error writing to backup journal");
- mJournalStream = null;
- mJournal = null;
- }
+ RandomAccessFile out = null;
+ try {
+ if (mJournal == null) mJournal = File.createTempFile("journal", null, mJournalDir);
+ out = new RandomAccessFile(mJournal, "rws");
+ out.seek(out.length());
+ out.writeUTF(str);
+ } catch (IOException e) {
+ Log.e(TAG, "Can't write " + str + " to backup journal", e);
+ mJournal = null;
+ } finally {
+ try { if (out != null) out.close(); } catch (IOException e) {}
}
}
@@ -1902,7 +1861,7 @@ class BackupManagerService extends IBackupManager.Stub {
// Run a backup pass immediately for any applications that have declared
// that they have pending updates.
- public void backupNow() throws RemoteException {
+ public void backupNow() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "backupNow");
if (DEBUG) Log.v(TAG, "Scheduling immediate backup pass");
@@ -2210,8 +2169,16 @@ class BackupManagerService extends IBackupManager.Stub {
pw.println("Available transports:");
for (String t : listAllTransports()) {
- String pad = (t.equals(mCurrentTransport)) ? " * " : " ";
- pw.println(pad + t);
+ pw.println((t.equals(mCurrentTransport) ? " * " : " ") + t);
+ try {
+ File dir = new File(mBaseStateDir, getTransport(t).transportDirName());
+ for (File f : dir.listFiles()) {
+ pw.println(" " + f.getName() + " - " + f.length() + " state bytes");
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error in transportDirName()", e);
+ pw.println(" Error: " + e);
+ }
}
pw.println("Pending init: " + mPendingInits.size());
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 63845e9..798bcd2 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -439,6 +439,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return tracker != null && tracker.setRadio(turnOn);
}
+ /**
+ * Used to notice when the calling process dies so we can self-expire
+ *
+ * Also used to know if the process has cleaned up after itself when
+ * our auto-expire timer goes off. The timer has a link to an object.
+ *
+ */
private class FeatureUser implements IBinder.DeathRecipient {
int mNetworkType;
String mFeature;
@@ -453,6 +460,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mBinder = binder;
mPid = getCallingPid();
mUid = getCallingUid();
+
try {
mBinder.linkToDeath(this, 0);
} catch (RemoteException e) {
@@ -467,11 +475,17 @@ public class ConnectivityService extends IConnectivityManager.Stub {
public void binderDied() {
Log.d(TAG, "ConnectivityService FeatureUser binderDied(" +
mNetworkType + ", " + mFeature + ", " + mBinder);
- stopUsingNetworkFeature(mNetworkType, mFeature, mPid, mUid);
+ stopUsingNetworkFeature(this, false);
}
+ public void expire() {
+ Log.d(TAG, "ConnectivityService FeatureUser expire(" +
+ mNetworkType + ", " + mFeature + ", " + mBinder);
+ stopUsingNetworkFeature(this, false);
+ }
}
+ // javadoc from interface
public int startUsingNetworkFeature(int networkType, String feature,
IBinder binder) {
if (DBG) {
@@ -483,9 +497,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return Phone.APN_REQUEST_FAILED;
}
- synchronized (mFeatureUsers) {
- mFeatureUsers.add(new FeatureUser(networkType, feature, binder));
- }
+ FeatureUser f = new FeatureUser(networkType, feature, binder);
// TODO - move this into the MobileDataStateTracker
int usedNetworkType = networkType;
@@ -513,10 +525,17 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return Phone.APN_TYPE_NOT_AVAILABLE;
}
- if (!mNetRequestersPids[usedNetworkType].contains(currentPid)) {
- // this gets used for per-pid dns when connected
- mNetRequestersPids[usedNetworkType].add(currentPid);
+ synchronized(this) {
+ mFeatureUsers.add(f);
+ if (!mNetRequestersPids[usedNetworkType].contains(currentPid)) {
+ // this gets used for per-pid dns when connected
+ mNetRequestersPids[usedNetworkType].add(currentPid);
+ }
}
+ mHandler.sendMessageDelayed(mHandler.obtainMessage(
+ NetworkStateTracker.EVENT_RESTORE_DEFAULT_NETWORK,
+ f), getRestoreDefaultNetworkDelay());
+
if ((ni.isConnectedOrConnecting() == true) &&
!network.isTeardownRequested()) {
@@ -533,22 +552,17 @@ public class ConnectivityService extends IConnectivityManager.Stub {
// check if the radio in play can make another contact
// assume if cannot for now
- // since we have to drop the default on this radio, setup
- // an automatic event to switch back
- if(mHandler.hasMessages(NetworkStateTracker.
- EVENT_RESTORE_DEFAULT_NETWORK, radio) ||
- radio.getNetworkInfo().isConnectedOrConnecting()) {
- mHandler.removeMessages(NetworkStateTracker.
- EVENT_RESTORE_DEFAULT_NETWORK,
- radio);
- mHandler.sendMessageDelayed(mHandler.obtainMessage(
- NetworkStateTracker.EVENT_RESTORE_DEFAULT_NETWORK,
- radio), getRestoreDefaultNetworkDelay());
- }
if (DBG) Log.d(TAG, "reconnecting to special network");
network.reconnect();
return Phone.APN_REQUEST_STARTED;
} else {
+ synchronized(this) {
+ mFeatureUsers.add(f);
+ }
+ mHandler.sendMessageDelayed(mHandler.obtainMessage(
+ NetworkStateTracker.EVENT_RESTORE_DEFAULT_NETWORK,
+ f), getRestoreDefaultNetworkDelay());
+
return network.startUsingNetworkFeature(feature,
getCallingPid(), getCallingUid());
}
@@ -556,13 +570,43 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return Phone.APN_TYPE_NOT_AVAILABLE;
}
+ // javadoc from interface
public int stopUsingNetworkFeature(int networkType, String feature) {
- return stopUsingNetworkFeature(networkType, feature, getCallingPid(),
- getCallingUid());
+ int pid = getCallingPid();
+ int uid = getCallingUid();
+
+ FeatureUser u = null;
+ boolean found = false;
+
+ synchronized(this) {
+ for (int i = 0; i < mFeatureUsers.size() ; i++) {
+ u = (FeatureUser)mFeatureUsers.get(i);
+ if (uid == u.mUid && pid == u.mPid &&
+ networkType == u.mNetworkType &&
+ TextUtils.equals(feature, u.mFeature)) {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (found && u != null) {
+ // stop regardless of how many other time this proc had called start
+ return stopUsingNetworkFeature(u, true);
+ } else {
+ // none found!
+ return 1;
+ }
}
- private int stopUsingNetworkFeature(int networkType, String feature,
- int pid, int uid) {
+ private int stopUsingNetworkFeature(FeatureUser u, boolean ignoreDups) {
+ int networkType = u.mNetworkType;
+ String feature = u.mFeature;
+ int pid = u.mPid;
+ int uid = u.mUid;
+
+ NetworkStateTracker tracker = null;
+ boolean callTeardown = false; // used to carry our decision outside of sync block
+
if (DBG) {
Log.d(TAG, "stopUsingNetworkFeature for net " + networkType +
": " + feature);
@@ -572,55 +616,65 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return -1;
}
- synchronized (mFeatureUsers) {
- for (int i=0; i < mFeatureUsers.size(); i++) {
- FeatureUser u = (FeatureUser)mFeatureUsers.get(i);
- if (uid == u.mUid && pid == u.mPid &&
- networkType == u.mNetworkType &&
- TextUtils.equals(feature, u.mFeature)) {
- u.unlinkDeathRecipient();
- mFeatureUsers.remove(i);
- break;
+ // need to link the mFeatureUsers list with the mNetRequestersPids state in this
+ // sync block
+ synchronized(this) {
+ // check if this process still has an outstanding start request
+ if (!mFeatureUsers.contains(u)) {
+ return 1;
+ }
+ u.unlinkDeathRecipient();
+ mFeatureUsers.remove(mFeatureUsers.indexOf(u));
+ // If we care about duplicate requests, check for that here.
+ //
+ // This is done to support the extension of a request - the app
+ // can request we start the network feature again and renew the
+ // auto-shutoff delay. Normal "stop" calls from the app though
+ // do not pay attention to duplicate requests - in effect the
+ // API does not refcount and a single stop will counter multiple starts.
+ if (ignoreDups == false) {
+ for (int i = 0; i < mFeatureUsers.size() ; i++) {
+ FeatureUser x = (FeatureUser)mFeatureUsers.get(i);
+ if (x.mUid == u.mUid && x.mPid == u.mPid &&
+ x.mNetworkType == u.mNetworkType &&
+ TextUtils.equals(x.mFeature, u.mFeature)) {
+ return 1;
+ }
}
}
- }
- // TODO - move to MobileDataStateTracker
- int usedNetworkType = networkType;
- if (networkType == ConnectivityManager.TYPE_MOBILE) {
- if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_MMS)) {
- usedNetworkType = ConnectivityManager.TYPE_MOBILE_MMS;
- } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_SUPL)) {
- usedNetworkType = ConnectivityManager.TYPE_MOBILE_SUPL;
- } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_DUN)) {
- usedNetworkType = ConnectivityManager.TYPE_MOBILE_DUN;
- } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_HIPRI)) {
- usedNetworkType = ConnectivityManager.TYPE_MOBILE_HIPRI;
+ // TODO - move to MobileDataStateTracker
+ int usedNetworkType = networkType;
+ if (networkType == ConnectivityManager.TYPE_MOBILE) {
+ if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_MMS)) {
+ usedNetworkType = ConnectivityManager.TYPE_MOBILE_MMS;
+ } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_SUPL)) {
+ usedNetworkType = ConnectivityManager.TYPE_MOBILE_SUPL;
+ } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_DUN)) {
+ usedNetworkType = ConnectivityManager.TYPE_MOBILE_DUN;
+ } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_HIPRI)) {
+ usedNetworkType = ConnectivityManager.TYPE_MOBILE_HIPRI;
+ }
}
- }
- NetworkStateTracker tracker = mNetTrackers[usedNetworkType];
- if(usedNetworkType != networkType) {
- Integer currentPid = new Integer(pid);
- if (mNetRequestersPids[usedNetworkType].remove(currentPid)) {
+ tracker = mNetTrackers[usedNetworkType];
+ if(usedNetworkType != networkType) {
+ Integer currentPid = new Integer(pid);
reassessPidDns(pid, true);
+ mNetRequestersPids[usedNetworkType].remove(currentPid);
+ if (mNetRequestersPids[usedNetworkType].size() != 0) {
+ if (DBG) Log.d(TAG, "not tearing down special network - " +
+ "others still using it");
+ return 1;
+ }
+ callTeardown = true;
}
- if (mNetRequestersPids[usedNetworkType].size() != 0) {
- if (DBG) Log.d(TAG, "not tearing down special network - " +
- "others still using it");
- return 1;
- }
+ }
+ if (callTeardown) {
tracker.teardown();
- NetworkStateTracker radio = mNetTrackers[networkType];
- // Check if we want to revert to the default
- if (mHandler.hasMessages(NetworkStateTracker.
- EVENT_RESTORE_DEFAULT_NETWORK, radio)) {
- mHandler.removeMessages(NetworkStateTracker.
- EVENT_RESTORE_DEFAULT_NETWORK, radio);
- radio.reconnect();
- }
return 1;
} else {
+ // do it the old fashioned way
return tracker.stopUsingNetworkFeature(feature, pid, uid);
}
}
@@ -1231,17 +1285,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
// fill me in
break;
case NetworkStateTracker.EVENT_RESTORE_DEFAULT_NETWORK:
- for (NetworkStateTracker net : mNetTrackers) {
- NetworkInfo i = net.getNetworkInfo();
- if (i.isConnected() &&
- !mNetAttributes[i.getType()].isDefault()) {
- if (DBG) {
- Log.d(TAG, "tearing down " + i +
- " to restore the default network");
- }
- teardown(net);
- }
- }
+ FeatureUser u = (FeatureUser)msg.obj;
+ u.expire();
break;
}
}
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index f85d931..204389e 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -313,7 +313,7 @@ class MountService extends IMountService.Stub {
setMediaStorageNotification(
com.android.internal.R.string.ext_media_safe_unmount_notification_title,
com.android.internal.R.string.ext_media_safe_unmount_notification_message,
- com.android.internal.R.drawable.stat_notify_sim_toolkit,
+ com.android.internal.R.drawable.stat_notify_sdcard,
true, true, null);
mShowSafeUnmountNotificationWhenUnmounted = false;
} else {
@@ -333,7 +333,7 @@ class MountService extends IMountService.Stub {
setMediaStorageNotification(
com.android.internal.R.string.ext_media_checking_notification_title,
com.android.internal.R.string.ext_media_checking_notification_message,
- com.android.internal.R.drawable.stat_notify_sim_toolkit,
+ com.android.internal.R.drawable.stat_notify_sdcard_prepare,
true, false, null);
updateUsbMassStorageNotification(true, false);
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 867f215..5eb78c3 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -178,6 +178,7 @@ class PackageManagerService extends IPackageManager.Stub {
final File mFrameworkDir;
final File mSystemAppDir;
final File mAppInstallDir;
+ final File mDalvikCacheDir;
// Directory containing the private parts (e.g. code and non-resource assets) of forward-locked
// apps.
@@ -438,8 +439,11 @@ class PackageManagerService extends IPackageManager.Stub {
final HashSet<String> libFiles = new HashSet<String>();
mFrameworkDir = new File(Environment.getRootDirectory(), "framework");
+ mDalvikCacheDir = new File(dataDir, "dalvik-cache");
if (mInstaller != null) {
+ boolean didDexOpt = false;
+
/**
* Out of paranoia, ensure that everything in the boot class
* path has been dexed.
@@ -452,6 +456,7 @@ class PackageManagerService extends IPackageManager.Stub {
if (dalvik.system.DexFile.isDexOptNeeded(paths[i])) {
libFiles.add(paths[i]);
mInstaller.dexopt(paths[i], Process.SYSTEM_UID, true);
+ didDexOpt = true;
}
} catch (FileNotFoundException e) {
Log.w(TAG, "Boot class path not found: " + paths[i]);
@@ -474,6 +479,7 @@ class PackageManagerService extends IPackageManager.Stub {
if (dalvik.system.DexFile.isDexOptNeeded(lib)) {
libFiles.add(lib);
mInstaller.dexopt(lib, Process.SYSTEM_UID, true);
+ didDexOpt = true;
}
} catch (FileNotFoundException e) {
Log.w(TAG, "Library not found: " + lib);
@@ -493,7 +499,7 @@ class PackageManagerService extends IPackageManager.Stub {
* run from a non-root shell.
*/
String[] frameworkFiles = mFrameworkDir.list();
- if (frameworkFiles != null && mInstaller != null) {
+ if (frameworkFiles != null) {
for (int i=0; i<frameworkFiles.length; i++) {
File libPath = new File(mFrameworkDir, frameworkFiles[i]);
String path = libPath.getPath();
@@ -508,6 +514,7 @@ class PackageManagerService extends IPackageManager.Stub {
try {
if (dalvik.system.DexFile.isDexOptNeeded(path)) {
mInstaller.dexopt(path, Process.SYSTEM_UID, true);
+ didDexOpt = true;
}
} catch (FileNotFoundException e) {
Log.w(TAG, "Jar not found: " + path);
@@ -516,6 +523,25 @@ class PackageManagerService extends IPackageManager.Stub {
}
}
}
+
+ if (didDexOpt) {
+ // If we had to do a dexopt of one of the previous
+ // things, then something on the system has changed.
+ // Consider this significant, and wipe away all other
+ // existing dexopt files to ensure we don't leave any
+ // dangling around.
+ String[] files = mDalvikCacheDir.list();
+ if (files != null) {
+ for (int i=0; i<files.length; i++) {
+ String fn = files[i];
+ if (fn.startsWith("data@app@")
+ || fn.startsWith("data@app-private@")) {
+ Log.i(TAG, "Pruning dalvik file: " + fn);
+ (new File(mDalvikCacheDir, fn)).delete();
+ }
+ }
+ }
+ }
}
mFrameworkInstallObserver = new AppDirObserver(
@@ -641,6 +667,27 @@ class PackageManagerService extends IPackageManager.Stub {
final File permFile = new File(Environment.getRootDirectory(),
"etc/permissions/platform.xml");
readPermissionsFromXml(permFile);
+
+ StringBuilder sb = new StringBuilder(128);
+ sb.append("Libs:");
+ Iterator<String> it = mSharedLibraries.keySet().iterator();
+ while (it.hasNext()) {
+ sb.append(' ');
+ String name = it.next();
+ sb.append(name);
+ sb.append(':');
+ sb.append(mSharedLibraries.get(name));
+ }
+ Log.i(TAG, sb.toString());
+
+ sb.setLength(0);
+ sb.append("Features:");
+ it = mAvailableFeatures.keySet().iterator();
+ while (it.hasNext()) {
+ sb.append(' ');
+ sb.append(it.next());
+ }
+ Log.i(TAG, sb.toString());
}
private void readPermissionsFromXml(File permFile) {
@@ -730,7 +777,7 @@ class PackageManagerService extends IPackageManager.Stub {
Log.w(TAG, "<library> without file at "
+ parser.getPositionDescription());
} else {
- Log.i(TAG, "Got library " + lname + " in " + lfile);
+ //Log.i(TAG, "Got library " + lname + " in " + lfile);
mSharedLibraries.put(lname, lfile);
}
XmlUtils.skipCurrentTag(parser);
@@ -742,7 +789,7 @@ class PackageManagerService extends IPackageManager.Stub {
Log.w(TAG, "<feature> without name at "
+ parser.getPositionDescription());
} else {
- Log.i(TAG, "Got feature " + fname);
+ //Log.i(TAG, "Got feature " + fname);
FeatureInfo fi = new FeatureInfo();
fi.name = fname;
mAvailableFeatures.put(fname, fi);
@@ -1974,27 +2021,25 @@ class PackageManagerService extends IPackageManager.Stub {
}
if ((parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0) {
// Check for updated system applications here
- if (updatedPkg != null) {
- if ((ps != null) && (!ps.codePath.getPath().equals(scanFile.getPath()))) {
- if (pkg.mVersionCode <= ps.versionCode) {
- // The system package has been updated and the code path does not match
- // Ignore entry. Just return
- Log.w(TAG, "Package:" + pkg.packageName +
- " has been updated. Ignoring the one from path:"+scanFile);
- mLastScanError = PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
- return null;
- } else {
- // Delete the older apk pointed to by ps
- // At this point, its safely assumed that package installation for
- // apps in system partition will go through. If not there won't be a working
- // version of the app
- synchronized (mPackages) {
- // Just remove the loaded entries from package lists.
- mPackages.remove(ps.name);
- }
- deletePackageResourcesLI(ps.name, ps.codePathString, ps.resourcePathString);
- mSettings.enableSystemPackageLP(ps.name);
+ if ((ps != null) && (!ps.codePath.equals(scanFile))) {
+ if (pkg.mVersionCode < ps.versionCode) {
+ // The system package has been updated and the code path does not match
+ // Ignore entry. Just return
+ Log.w(TAG, "Package:" + pkg.packageName +
+ " has been updated. Ignoring the one from path:"+scanFile);
+ mLastScanError = PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
+ return null;
+ } else {
+ // Delete the older apk pointed to by ps
+ // At this point, its safely assumed that package installation for
+ // apps in system partition will go through. If not there won't be a working
+ // version of the app
+ synchronized (mPackages) {
+ // Just remove the loaded entries from package lists.
+ mPackages.remove(ps.name);
}
+ deletePackageResourcesLI(ps.name, ps.codePathString, ps.resourcePathString);
+ mSettings.enableSystemPackageLP(ps.name);
}
}
}
@@ -2004,7 +2049,7 @@ class PackageManagerService extends IPackageManager.Stub {
scanMode |= SCAN_FORWARD_LOCKED;
}
File resFile = destResourceFile;
- if ((scanMode & SCAN_FORWARD_LOCKED) != 0) {
+ if (ps != null && ((scanMode & SCAN_FORWARD_LOCKED) != 0)) {
resFile = getFwdLockedResource(ps.name);
}
// Note that we invoke the following method only if we are about to unpack an application
@@ -3814,14 +3859,13 @@ class PackageManagerService extends IPackageManager.Stub {
final ApplicationInfo deletedPackageAppInfo = deletedPackage.applicationInfo;
final ApplicationInfo installedPackageAppInfo =
newPackage.applicationInfo;
- if (!deletedPackageAppInfo.sourceDir
- .equals(installedPackageAppInfo.sourceDir)) {
- new File(deletedPackageAppInfo.sourceDir).delete();
- }
- if (!deletedPackageAppInfo.publicSourceDir
- .equals(installedPackageAppInfo.publicSourceDir)) {
- new File(deletedPackageAppInfo.publicSourceDir).delete();
- }
+ deletePackageResourcesLI(pkgName,
+ !deletedPackageAppInfo.sourceDir
+ .equals(installedPackageAppInfo.sourceDir)
+ ? deletedPackageAppInfo.sourceDir : null,
+ !deletedPackageAppInfo.publicSourceDir
+ .equals(installedPackageAppInfo.publicSourceDir)
+ ? deletedPackageAppInfo.publicSourceDir : null);
//update signature on the new package setting
//this should always succeed, since we checked the
//signature earlier.
@@ -4504,22 +4548,30 @@ class PackageManagerService extends IPackageManager.Stub {
private void deletePackageResourcesLI(String packageName,
String sourceDir, String publicSourceDir) {
- File sourceFile = new File(sourceDir);
- if (!sourceFile.exists()) {
- Log.w(TAG, "Package source " + sourceDir + " does not exist.");
- }
- // Delete application's code and resources
- sourceFile.delete();
- final File publicSourceFile = new File(publicSourceDir);
- if (publicSourceFile.exists()) {
- publicSourceFile.delete();
+ if (sourceDir != null) {
+ File sourceFile = new File(sourceDir);
+ if (!sourceFile.exists()) {
+ Log.w(TAG, "Package source " + sourceDir + " does not exist.");
+ }
+ // Delete application's code and resources
+ sourceFile.delete();
+ if (mInstaller != null) {
+ int retCode = mInstaller.rmdex(sourceFile.toString());
+ if (retCode < 0) {
+ Log.w(TAG, "Couldn't remove dex file for package: "
+ + packageName + " at location "
+ + sourceFile.toString() + ", retcode=" + retCode);
+ // we don't consider this to be a failure of the core package deletion
+ }
+ }
}
- if (mInstaller != null) {
- int retCode = mInstaller.rmdex(sourceFile.toString());
- if (retCode < 0) {
- Log.w(TAG, "Couldn't remove dex file for package: "
- + packageName + " at location " + sourceFile.toString() + ", retcode=" + retCode);
- // we don't consider this to be a failure of the core package deletion
+ if (publicSourceDir != null && !publicSourceDir.equals(sourceDir)) {
+ final File publicSourceFile = new File(publicSourceDir);
+ if (!publicSourceFile.exists()) {
+ Log.w(TAG, "Package public source " + publicSourceFile + " does not exist.");
+ }
+ if (publicSourceFile.exists()) {
+ publicSourceFile.delete();
}
}
}
@@ -5725,7 +5777,7 @@ class PackageManagerService extends IPackageManager.Stub {
}
static class GrantedPermissions {
- final int pkgFlags;
+ int pkgFlags;
HashSet<String> grantedPermissions = new HashSet<String>();
int[] gids;
@@ -6143,10 +6195,10 @@ class PackageManagerService extends IPackageManager.Stub {
// Let the app continue with previous uid if code path changes.
reportSettingsProblem(Log.WARN,
"Package " + name + " codePath changed from " + p.codePath
- + " to " + codePath + "; Retaining data and using new code from " +
- codePath);
+ + " to " + codePath + "; Retaining data and using new");
}
- } else if (p.sharedUser != sharedUser) {
+ }
+ if (p.sharedUser != sharedUser) {
reportSettingsProblem(Log.WARN,
"Package " + name + " shared user changed from "
+ (p.sharedUser != null ? p.sharedUser.name : "<nothing>")
@@ -6154,6 +6206,13 @@ class PackageManagerService extends IPackageManager.Stub {
+ (sharedUser != null ? sharedUser.name : "<nothing>")
+ "; replacing with new");
p = null;
+ } else {
+ if ((pkgFlags&ApplicationInfo.FLAG_SYSTEM) != 0) {
+ // If what we are scanning is a system package, then
+ // make it so, regardless of whether it was previously
+ // installed only in the data partition.
+ p.pkgFlags |= ApplicationInfo.FLAG_SYSTEM;
+ }
}
}
if (p == null) {
@@ -6214,14 +6273,14 @@ class PackageManagerService extends IPackageManager.Stub {
// Update code path if needed
if (!codePath.toString().equalsIgnoreCase(p.codePathString)) {
Log.w(TAG, "Code path for pkg : " + p.pkg.packageName +
- " changing form " + p.codePathString + " to " + codePath);
+ " changing from " + p.codePathString + " to " + codePath);
p.codePath = codePath;
p.codePathString = codePath.toString();
}
//Update resource path if needed
if (!resourcePath.toString().equalsIgnoreCase(p.resourcePathString)) {
Log.w(TAG, "Resource path for pkg : " + p.pkg.packageName +
- " changing form " + p.resourcePathString + " to " + resourcePath);
+ " changing from " + p.resourcePathString + " to " + resourcePath);
p.resourcePath = resourcePath;
p.resourcePathString = resourcePath.toString();
}
@@ -6470,15 +6529,19 @@ class PackageManagerService extends IPackageManager.Stub {
|FileUtils.S_IRGRP|FileUtils.S_IWGRP
|FileUtils.S_IROTH,
-1, -1);
+ return;
} catch(XmlPullParserException e) {
Log.w(TAG, "Unable to write package manager settings, current changes will be lost at reboot", e);
-
} catch(java.io.IOException e) {
Log.w(TAG, "Unable to write package manager settings, current changes will be lost at reboot", e);
-
}
-
+ // Clean up partially written file
+ if (mSettingsFilename.exists()) {
+ if (!mSettingsFilename.delete()) {
+ Log.i(TAG, "Failed to clean up mangled file: " + mSettingsFilename);
+ }
+ }
//Debug.stopMethodTracing();
}
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 84ed3ed..e5b6720 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -233,8 +233,8 @@ public class WindowManagerService extends IWindowManager.Stub
mPolicy.enableKeyguard(false);
}
public void released() {
+ mPolicy.enableKeyguard(true);
synchronized (mKeyguardDisabled) {
- mPolicy.enableKeyguard(true);
mWaitingUntilKeyguardReenabled = false;
mKeyguardDisabled.notifyAll();
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index d917d17..c62444d 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -140,7 +140,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
static final boolean DEBUG_PROVIDER = localLOGV || false;
static final boolean DEBUG_USER_LEAVING = localLOGV || false;
static final boolean DEBUG_RESULTS = localLOGV || false;
- static final boolean DEBUG_BACKUP = localLOGV || true;
+ static final boolean DEBUG_BACKUP = localLOGV || false;
+ static final boolean DEBUG_CONFIGURATION = localLOGV || false;
static final boolean VALIDATE_TOKENS = false;
static final boolean SHOW_ACTIVITY_START_TIME = true;
@@ -2251,7 +2252,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
mHandler.sendMessage(msg);
}
- reportResumedActivity(next);
+ reportResumedActivityLocked(next);
next.thumbnail = null;
setFocusedActivityLocked(next);
@@ -2524,7 +2525,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
}
}
- private void reportResumedActivity(HistoryRecord r) {
+ private void reportResumedActivityLocked(HistoryRecord r) {
//Log.i(TAG, "**** REPORT RESUME: " + r);
final int identHash = System.identityHashCode(r);
@@ -5295,6 +5296,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
if (app.instrumentationClass != null) {
ensurePackageDexOpt(app.instrumentationClass.getPackageName());
}
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Binding proc "
+ + processName + " with config " + mConfiguration);
thread.bindApplication(processName, app.instrumentationInfo != null
? app.instrumentationInfo : app.info, providers,
app.instrumentationClass, app.instrumentationProfileFile,
@@ -8326,6 +8329,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// This happens before any activities are started, so we can
// change mConfiguration in-place.
mConfiguration.updateFrom(configuration);
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Initial config: " + mConfiguration);
}
}
@@ -10336,9 +10340,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
try {
if (DEBUG_SERVICE) Log.v(TAG, "Scheduling start service: "
+ r.name + " " + r.intent);
+ mStringBuilder.setLength(0);
+ r.intent.getIntent().toShortString(mStringBuilder, false, true);
EventLog.writeEvent(LOG_AM_CREATE_SERVICE,
System.identityHashCode(r), r.shortName,
- r.intent.getIntent().toString(), r.app.pid);
+ mStringBuilder.toString(), r.app.pid);
synchronized (r.stats.getBatteryStats()) {
r.stats.startLaunchedLocked();
}
@@ -11368,8 +11374,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
try {
proc.thread.scheduleCreateBackupAgent(app, backupMode);
} catch (RemoteException e) {
- // !!! TODO: notify the backup manager that we crashed, or rely on
- // death notices, or...?
+ // Will time out on the backup manager side
}
} else {
if (DEBUG_BACKUP) Log.v(TAG, "Agent proc not running, waiting for attach");
@@ -12713,7 +12718,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
Configuration newConfig = new Configuration(mConfiguration);
changes = newConfig.updateFrom(values);
if (changes != 0) {
- if (DEBUG_SWITCH) {
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) {
Log.i(TAG, "Updating configuration to: " + values);
}
@@ -12737,6 +12742,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
ProcessRecord app = mLRUProcesses.get(i);
try {
if (app.thread != null) {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Sending to proc "
+ + app.processName + " new config " + mConfiguration);
app.thread.scheduleConfigurationChanged(mConfiguration);
}
} catch (Exception e) {
@@ -12806,6 +12813,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
if (andResume) {
r.results = null;
r.newIntents = null;
+ reportResumedActivityLocked(r);
}
return true;
@@ -12820,19 +12828,21 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
*/
private final boolean ensureActivityConfigurationLocked(HistoryRecord r,
int globalChanges) {
- if (DEBUG_SWITCH) Log.i(TAG, "Ensuring correct configuration: " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Ensuring correct configuration: " + r);
// Short circuit: if the two configurations are the exact same
// object (the common case), then there is nothing to do.
Configuration newConfig = mConfiguration;
if (r.configuration == newConfig) {
- if (DEBUG_SWITCH) Log.i(TAG, "Configuration unchanged in " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Configuration unchanged in " + r);
return true;
}
// We don't worry about activities that are finishing.
if (r.finishing) {
- if (DEBUG_SWITCH) Log.i(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
"Configuration doesn't matter in finishing " + r);
r.stopFreezingScreenLocked(false);
return true;
@@ -12846,7 +12856,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// If the activity isn't currently running, just leave the new
// configuration and it will pick that up next time it starts.
if (r.app == null || r.app.thread == null) {
- if (DEBUG_SWITCH) Log.i(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
"Configuration doesn't matter not running " + r);
r.stopFreezingScreenLocked(false);
return true;
@@ -12858,22 +12868,26 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// Figure out what has changed between the two configurations.
int changes = oldConfig.diff(newConfig);
- if (DEBUG_SWITCH) {
- Log.i(TAG, "Checking to restart " + r.info.name + ": changed=0x"
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) {
+ Log.v(TAG, "Checking to restart " + r.info.name + ": changed=0x"
+ Integer.toHexString(changes) + ", handles=0x"
- + Integer.toHexString(r.info.configChanges));
+ + Integer.toHexString(r.info.configChanges)
+ + ", newConfig=" + newConfig);
}
if ((changes&(~r.info.configChanges)) != 0) {
// Aha, the activity isn't handling the change, so DIE DIE DIE.
r.configChangeFlags |= changes;
r.startFreezingScreenLocked(r.app, globalChanges);
if (r.app == null || r.app.thread == null) {
- if (DEBUG_SWITCH) Log.i(TAG, "Switch is destroying non-running " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Switch is destroying non-running " + r);
destroyActivityLocked(r, true);
} else if (r.state == ActivityState.PAUSING) {
// A little annoying: we are waiting for this activity to
// finish pausing. Let's not do anything now, but just
// flag that it needs to be restarted when done pausing.
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Switch is skipping already pausing " + r);
r.configDestroy = true;
return true;
} else if (r.state == ActivityState.RESUMED) {
@@ -12881,11 +12895,13 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// and we need to restart the top, resumed activity.
// Instead of doing the normal handshaking, just say
// "restart!".
- if (DEBUG_SWITCH) Log.i(TAG, "Switch is restarting resumed " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Switch is restarting resumed " + r);
relaunchActivityLocked(r, r.configChangeFlags, true);
r.configChangeFlags = 0;
} else {
- if (DEBUG_SWITCH) Log.i(TAG, "Switch is restarting non-resumed " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Switch is restarting non-resumed " + r);
relaunchActivityLocked(r, r.configChangeFlags, false);
r.configChangeFlags = 0;
}
@@ -12903,6 +12919,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// it last got.
if (r.app != null && r.app.thread != null) {
try {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Sending new config to " + r);
r.app.thread.scheduleActivityConfigurationChanged(r);
} catch (RemoteException e) {
// If process died, whatever.
diff --git a/services/java/com/android/server/am/UsageStatsService.java b/services/java/com/android/server/am/UsageStatsService.java
index 66868a3..373b44e 100644
--- a/services/java/com/android/server/am/UsageStatsService.java
+++ b/services/java/com/android/server/am/UsageStatsService.java
@@ -381,7 +381,10 @@ public final class UsageStatsService extends IUsageStats.Stub {
mFileLeaf = getCurrentDateStr(FILE_PREFIX);
// Copy current file to back up
File backupFile = new File(mFile.getPath() + ".bak");
- mFile.renameTo(backupFile);
+ if (!mFile.renameTo(backupFile)) {
+ Log.w(TAG, "Failed to persist new stats");
+ return;
+ }
try {
// Write mStats to file
writeStatsFLOCK();
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 1f0e5a5..52c8b1f 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -100,6 +100,7 @@ public abstract class DataConnectionTracker extends Handler {
public static final int EVENT_CLEAN_UP_CONNECTION = 34;
protected static final int EVENT_CDMA_OTA_PROVISION = 35;
protected static final int EVENT_RESTART_RADIO = 36;
+ protected static final int EVENT_SET_MASTER_DATA_ENABLE = 37;
/***** Constants *****/
@@ -111,8 +112,11 @@ public abstract class DataConnectionTracker extends Handler {
protected static final int APN_HIPRI_ID = 4;
protected static final int APN_NUM_TYPES = 5;
- protected static final int APN_DISABLED = 0;
- protected static final int APN_ENABLED = 1;
+ protected static final int DISABLED = 0;
+ protected static final int ENABLED = 1;
+
+ // responds to the setDataEnabled call - used independently from the APN requests
+ protected boolean mMasterDataEnabled = true;
protected boolean[] dataEnabled = new boolean[APN_NUM_TYPES];
protected int enabledCount = 0;
@@ -322,6 +326,11 @@ public abstract class DataConnectionTracker extends Handler {
onCleanUpConnection(tearDown, (String)msg.obj);
break;
+ case EVENT_SET_MASTER_DATA_ENABLE:
+ boolean enabled = (msg.arg1 == ENABLED) ? true : false;
+ onSetDataEnabled(enabled);
+ break;
+
default:
Log.e("DATA", "Unidentified event = " + msg.what);
break;
@@ -486,7 +495,7 @@ public abstract class DataConnectionTracker extends Handler {
Message msg = obtainMessage(EVENT_ENABLE_NEW_APN);
msg.arg1 = id;
- msg.arg2 = (enable ? APN_ENABLED : APN_DISABLED);
+ msg.arg2 = (enable ? ENABLED : DISABLED);
sendMessage(msg);
}
@@ -497,7 +506,7 @@ public abstract class DataConnectionTracker extends Handler {
", enabledCount = " + enabledCount +
", isApnTypeActive = " + isApnTypeActive(apnIdToType(apnId)));
}
- if (enabled == APN_ENABLED) {
+ if (enabled == ENABLED) {
if (!dataEnabled[apnId]) {
dataEnabled[apnId] = true;
enabledCount++;
@@ -545,8 +554,24 @@ public abstract class DataConnectionTracker extends Handler {
*/
public boolean setDataEnabled(boolean enable) {
if (DBG) Log.d(LOG_TAG, "setDataEnabled(" + enable + ")");
- setEnabled(APN_DEFAULT_ID, enable);
+
+ Message msg = obtainMessage(EVENT_SET_MASTER_DATA_ENABLE);
+ msg.arg1 = (enable ? ENABLED : DISABLED);
+ sendMessage(msg);
return true;
}
+ protected void onSetDataEnabled(boolean enable) {
+ if (mMasterDataEnabled != enable) {
+ mMasterDataEnabled = enable;
+ if (enable) {
+ mRetryMgr.resetRetryCount();
+ onTrySetupData(Phone.REASON_DATA_ENABLED);
+ } else {
+ onCleanUpConnection(true, Phone.REASON_DATA_DISABLED);
+ }
+ }
+ }
+
+
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
index 9fe2038..1005d20 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
@@ -1039,8 +1039,8 @@ public final class CdmaCallTracker extends CallTracker {
private void disableDataCallInEmergencyCall(String dialString) {
if (PhoneNumberUtils.isEmergencyNumber(dialString)) {
if (Phone.DEBUG_PHONE) log("disableDataCallInEmergencyCall");
- phone.disableDataConnectivity();
mIsInEmergencyCall = true;
+ phone.disableDataConnectivity();
}
}
@@ -1050,15 +1050,16 @@ public final class CdmaCallTracker extends CallTracker {
*/
private void checkAndEnableDataCallAfterEmergencyCallDropped() {
if (mIsInEmergencyCall) {
+ mIsInEmergencyCall = false;
String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
if (Phone.DEBUG_PHONE) {
log("checkAndEnableDataCallAfterEmergencyCallDropped,inEcm=" + inEcm);
}
if (inEcm.compareTo("false") == 0) {
// Re-initiate data connection
+ // TODO - can this be changed to phone.enableDataConnectivity();
phone.mDataConnection.setDataEnabled(true);
}
- mIsInEmergencyCall = false;
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index d0a9337..c695dd7 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -302,7 +302,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
private boolean isDataAllowed() {
boolean roaming = phone.getServiceState().getRoaming();
- return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
+ return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled()) && mMasterDataEnabled;
}
private boolean trySetupData(String reason) {
@@ -347,7 +347,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
" roaming=" + roaming +
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
" desiredPowerState=" + desiredPowerState +
- " PendingRestartRadio=" + mPendingRestartRadio);
+ " PendingRestartRadio=" + mPendingRestartRadio +
+ " MasterDataEnabled=" + mMasterDataEnabled);
}
return false;
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index 5bdf09f..ffd6dd3 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -391,7 +391,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
private boolean isDataAllowed() {
boolean roaming = phone.getServiceState().getRoaming();
- return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
+ return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled()) &&
+ mMasterDataEnabled;
}
//****** Called from ServiceStateTracker
@@ -475,7 +476,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
" roaming=" + phone.getServiceState().getRoaming() +
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
" ps restricted=" + mIsPsRestricted +
- " desiredPowerState=" + desiredPowerState);
+ " desiredPowerState=" + desiredPowerState +
+ " MasterDataEnabled=" + mMasterDataEnabled);
return false;
}
}
@@ -1039,7 +1041,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
// if no more retries on a secondary APN attempt, tell the world and revert.
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
- onEnableApn(apnTypeToId(mRequestedApnType), APN_DISABLED);
+ onEnableApn(apnTypeToId(mRequestedApnType), DISABLED);
return;
}
if (mReregisterOnReconnectFailure) {
@@ -1203,7 +1205,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
notifyNoData(cause);
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
- onEnableApn(apnTypeToId(mRequestedApnType), APN_DISABLED);
+ onEnableApn(apnTypeToId(mRequestedApnType), DISABLED);
}
return;
}
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 5638480..2c0d0f1 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -1237,9 +1237,9 @@ public class WifiStateTracker extends NetworkStateTracker {
/*
* Reset connection depends on both the interface and the IP assigned,
* so it should be done before any chance of the IP being lost.
- */
+ */
NetworkUtils.resetConnections(mInterfaceName);
-
+
// Stop DHCP
if (mDhcpTarget != null) {
mDhcpTarget.setCancelCallback(true);
@@ -1248,11 +1248,10 @@ public class WifiStateTracker extends NetworkStateTracker {
if (!NetworkUtils.stopDhcp(mInterfaceName)) {
Log.e(TAG, "Could not stop DHCP");
}
-
+
NetworkUtils.disableInterface(mInterfaceName);
- if (reenable) {
- NetworkUtils.enableInterface(mInterfaceName);
- }
+ // we no longer net to start the interface (driver does this for us)
+ // and it led to problems - removed.
}
/**