diff options
41 files changed, 110 insertions, 116 deletions
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java index 6256303cfacc..00d8ae3ec7b0 100644 --- a/core/java/android/app/DownloadManager.java +++ b/core/java/android/app/DownloadManager.java @@ -28,6 +28,7 @@ import android.os.Environment; import android.os.ParcelFileDescriptor; import android.provider.BaseColumns; import android.provider.Downloads; +import android.util.Log; import android.util.Pair; import java.io.File; @@ -53,6 +54,8 @@ import java.util.Set; * download in a notification or from the downloads UI. */ public class DownloadManager { + private static final String TAG = "DownloadManager"; + /** * An identifier for a particular download, unique across the system. Clients use this ID to * make subsequent calls related to the download. @@ -748,20 +751,11 @@ public class DownloadManager { * @return the number of downloads actually removed */ public int remove(long... ids) { - StringBuilder whereClause = new StringBuilder(); - String[] whereArgs = new String[ids.length]; - - whereClause.append(Downloads.Impl._ID + " IN ("); - for (int i = 0; i < ids.length; i++) { - if (i > 0) { - whereClause.append(","); - } - whereClause.append("?"); - whereArgs[i] = Long.toString(ids[i]); + if (ids == null || ids.length == 0) { + // called with nothing to remove! + throw new IllegalArgumentException("input param 'ids' can't be null"); } - whereClause.append(")"); - - return mResolver.delete(mBaseUri, whereClause.toString(), whereArgs); + return mResolver.delete(mBaseUri, getWhereClauseForIds(ids), getWhereArgsForIds(ids)); } /** @@ -828,12 +822,13 @@ public class DownloadManager { */ static String getWhereClauseForIds(long[] ids) { StringBuilder whereClause = new StringBuilder(); - whereClause.append(Downloads.Impl._ID + " IN ("); + whereClause.append("("); for (int i = 0; i < ids.length; i++) { if (i > 0) { - whereClause.append(","); + whereClause.append("OR "); } - whereClause.append("?"); + whereClause.append(Downloads.Impl._ID); + whereClause.append(" = ? "); } whereClause.append(")"); return whereClause.toString(); diff --git a/core/java/android/content/SharedPreferences.java b/core/java/android/content/SharedPreferences.java index 1484204fb5bd..3221afa97b9e 100644 --- a/core/java/android/content/SharedPreferences.java +++ b/core/java/android/content/SharedPreferences.java @@ -186,9 +186,21 @@ public interface SharedPreferences { * {@link #commit} will block until all async commits are * completed as well as the commit itself. * - * <p>If you call this from an {@link android.app.Activity}, - * the base class will wait for any async commits to finish in - * its {@link android.app.Activity#onPause}.</p> + * <p>As {@link SharedPreferences} instances are singletons within + * a process, it's safe to replace any instance of {@link #commit} with + * {@link #apply} if you were already ignoring the return value. + * + * <p>You don't need to worry about Android component + * lifecycles and their interaction with <code>apply()</code> + * writing to disk. The framework makes sure in-flight disk + * writes from <code>apply()</code> complete before switching + * states. + * + * <p class='note'>The SharedPreferences.Editor interface + * isn't expected to be implemented directly. However, if you + * previously did implement it and are now getting errors + * about missing <code>apply()</code>, you can simply call + * {@link #commit} from <code>apply()</code>. */ void apply(); } diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java index dde6493fb331..36d676a32725 100644 --- a/core/java/android/preference/Preference.java +++ b/core/java/android/preference/Preference.java @@ -1195,7 +1195,14 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis private void tryCommit(SharedPreferences.Editor editor) { if (mPreferenceManager.shouldCommit()) { - editor.apply(); + try { + editor.apply(); + } catch (AbstractMethodError unused) { + // The app injected its own pre-Gingerbread + // SharedPreferences.Editor implementation without + // an apply method. + editor.commit(); + } } } diff --git a/core/java/android/preference/PreferenceManager.java b/core/java/android/preference/PreferenceManager.java index fa838976fed9..e44a0907d209 100644 --- a/core/java/android/preference/PreferenceManager.java +++ b/core/java/android/preference/PreferenceManager.java @@ -443,7 +443,16 @@ public class PreferenceManager { pm.setSharedPreferencesMode(sharedPreferencesMode); pm.inflateFromResource(context, resId, null); - defaultValueSp.edit().putBoolean(KEY_HAS_SET_DEFAULT_VALUES, true).apply(); + SharedPreferences.Editor editor = + defaultValueSp.edit().putBoolean(KEY_HAS_SET_DEFAULT_VALUES, true); + try { + editor.apply(); + } catch (AbstractMethodError unused) { + // The app injected its own pre-Gingerbread + // SharedPreferences.Editor implementation without + // an apply method. + editor.commit(); + } } } @@ -478,15 +487,21 @@ public class PreferenceManager { boolean shouldCommit() { return !mNoCommit; } - + private void setNoCommit(boolean noCommit) { if (!noCommit && mEditor != null) { - mEditor.apply(); + try { + mEditor.apply(); + } catch (AbstractMethodError unused) { + // The app injected its own pre-Gingerbread + // SharedPreferences.Editor implementation without + // an apply method. + mEditor.commit(); + } } - mNoCommit = noCommit; } - + /** * Returns the activity that shows the preferences. This is useful for doing * managed queries, but in most cases the use of {@link #getContext()} is diff --git a/core/java/android/widget/AppSecurityPermissions.java b/core/java/android/widget/AppSecurityPermissions.java index aa14c81fb250..d3aa42f9a19b 100755 --- a/core/java/android/widget/AppSecurityPermissions.java +++ b/core/java/android/widget/AppSecurityPermissions.java @@ -17,14 +17,14 @@ package android.widget; import com.android.internal.R; + import android.content.Context; -import android.content.res.Resources; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageParser; import android.content.pm.PermissionGroupInfo; import android.content.pm.PermissionInfo; -import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.drawable.Drawable; import android.util.Log; import android.view.LayoutInflater; @@ -329,11 +329,6 @@ public class AppSecurityPermissions implements View.OnClickListener { TextView permGrpView = (TextView) permView.findViewById(R.id.permission_group); TextView permDescView = (TextView) permView.findViewById(R.id.permission_list); - if (dangerous) { - final Resources resources = context.getResources(); - permGrpView.setTextColor(resources.getColor(R.color.perms_dangerous_grp_color)); - permDescView.setTextColor(resources.getColor(R.color.perms_dangerous_perm_color)); - } ImageView imgView = (ImageView)permView.findViewById(R.id.perm_icon); imgView.setImageDrawable(icon); diff --git a/core/res/res/drawable-hdpi/btn_code_lock_touched.png b/core/res/res/drawable-hdpi/btn_code_lock_touched.png Binary files differindex b90508c0759a..0410dd3c8242 100644 --- a/core/res/res/drawable-hdpi/btn_code_lock_touched.png +++ b/core/res/res/drawable-hdpi/btn_code_lock_touched.png diff --git a/core/res/res/drawable-hdpi/btn_media_player.9.png b/core/res/res/drawable-hdpi/btn_media_player.9.png Binary files differindex bf163153f035..c23cfb6ec073 100644 --- a/core/res/res/drawable-hdpi/btn_media_player.9.png +++ b/core/res/res/drawable-hdpi/btn_media_player.9.png diff --git a/core/res/res/drawable-hdpi/btn_media_player_disabled.9.png b/core/res/res/drawable-hdpi/btn_media_player_disabled.9.png Binary files differindex d7b8ed5d98e8..45228f1aaaed 100644 --- a/core/res/res/drawable-hdpi/btn_media_player_disabled.9.png +++ b/core/res/res/drawable-hdpi/btn_media_player_disabled.9.png diff --git a/core/res/res/drawable-hdpi/btn_media_player_disabled_selected.9.png b/core/res/res/drawable-hdpi/btn_media_player_disabled_selected.9.png Binary files differindex 1a35c31f64d1..27e4e1da828b 100644 --- a/core/res/res/drawable-hdpi/btn_media_player_disabled_selected.9.png +++ b/core/res/res/drawable-hdpi/btn_media_player_disabled_selected.9.png diff --git a/core/res/res/drawable-hdpi/btn_media_player_pressed.9.png b/core/res/res/drawable-hdpi/btn_media_player_pressed.9.png Binary files differindex 17dd3fccad96..0b985072b56d 100644 --- a/core/res/res/drawable-hdpi/btn_media_player_pressed.9.png +++ b/core/res/res/drawable-hdpi/btn_media_player_pressed.9.png diff --git a/core/res/res/drawable-hdpi/btn_media_player_selected.9.png b/core/res/res/drawable-hdpi/btn_media_player_selected.9.png Binary files differindex a146d8f55863..e43fa8a76648 100644 --- a/core/res/res/drawable-hdpi/btn_media_player_selected.9.png +++ b/core/res/res/drawable-hdpi/btn_media_player_selected.9.png diff --git a/core/res/res/drawable-hdpi/checkbox_off_background.png b/core/res/res/drawable-hdpi/checkbox_off_background.png Binary files differindex a8e4785cdb23..275cba689d84 100644 --- a/core/res/res/drawable-hdpi/checkbox_off_background.png +++ b/core/res/res/drawable-hdpi/checkbox_off_background.png diff --git a/core/res/res/drawable-hdpi/checkbox_on_background.png b/core/res/res/drawable-hdpi/checkbox_on_background.png Binary files differindex 800d3d5541d8..a390814c19d5 100644 --- a/core/res/res/drawable-hdpi/checkbox_on_background.png +++ b/core/res/res/drawable-hdpi/checkbox_on_background.png diff --git a/core/res/res/drawable-hdpi/ic_bullet_key_permission.png b/core/res/res/drawable-hdpi/ic_bullet_key_permission.png Binary files differindex 98d95dcd6806..b6b840a4ae3f 100644 --- a/core/res/res/drawable-hdpi/ic_bullet_key_permission.png +++ b/core/res/res/drawable-hdpi/ic_bullet_key_permission.png diff --git a/core/res/res/drawable-hdpi/indicator_code_lock_point_area_default.png b/core/res/res/drawable-hdpi/indicator_code_lock_point_area_default.png Binary files differindex 467a0135292e..c45b956cfd32 100644 --- a/core/res/res/drawable-hdpi/indicator_code_lock_point_area_default.png +++ b/core/res/res/drawable-hdpi/indicator_code_lock_point_area_default.png diff --git a/core/res/res/drawable-hdpi/indicator_code_lock_point_area_green.png b/core/res/res/drawable-hdpi/indicator_code_lock_point_area_green.png Binary files differindex c21b24e096f1..4f95d507a36f 100644 --- a/core/res/res/drawable-hdpi/indicator_code_lock_point_area_green.png +++ b/core/res/res/drawable-hdpi/indicator_code_lock_point_area_green.png diff --git a/core/res/res/drawable-hdpi/indicator_code_lock_point_area_red.png b/core/res/res/drawable-hdpi/indicator_code_lock_point_area_red.png Binary files differindex 87007a3078f9..10a37b7aed16 100644 --- a/core/res/res/drawable-hdpi/indicator_code_lock_point_area_red.png +++ b/core/res/res/drawable-hdpi/indicator_code_lock_point_area_red.png diff --git a/core/res/res/drawable-hdpi/jog_tab_bar_left_end_normal.9.png b/core/res/res/drawable-hdpi/jog_tab_bar_left_end_normal.9.png Binary files differindex 109be428b438..b9ec2374af62 100644 --- a/core/res/res/drawable-hdpi/jog_tab_bar_left_end_normal.9.png +++ b/core/res/res/drawable-hdpi/jog_tab_bar_left_end_normal.9.png diff --git a/core/res/res/drawable-hdpi/jog_tab_bar_right_end_normal.9.png b/core/res/res/drawable-hdpi/jog_tab_bar_right_end_normal.9.png Binary files differindex 030c9e9d0008..30fcda5fafef 100644 --- a/core/res/res/drawable-hdpi/jog_tab_bar_right_end_normal.9.png +++ b/core/res/res/drawable-hdpi/jog_tab_bar_right_end_normal.9.png diff --git a/core/res/res/drawable-hdpi/jog_tab_left_normal.png b/core/res/res/drawable-hdpi/jog_tab_left_normal.png Binary files differindex 8b895382ed55..d43c5e212eb1 100755..100644 --- a/core/res/res/drawable-hdpi/jog_tab_left_normal.png +++ b/core/res/res/drawable-hdpi/jog_tab_left_normal.png diff --git a/core/res/res/drawable-hdpi/jog_tab_right_normal.png b/core/res/res/drawable-hdpi/jog_tab_right_normal.png Binary files differindex 01bba0bb78c2..1eb4234394d2 100755..100644 --- a/core/res/res/drawable-hdpi/jog_tab_right_normal.png +++ b/core/res/res/drawable-hdpi/jog_tab_right_normal.png diff --git a/core/res/res/drawable-hdpi/panel_background.9.png b/core/res/res/drawable-hdpi/panel_background.9.png Binary files differindex bfe57136f063..03175d44f0c0 100644 --- a/core/res/res/drawable-hdpi/panel_background.9.png +++ b/core/res/res/drawable-hdpi/panel_background.9.png diff --git a/core/res/res/drawable-hdpi/stat_notify_call_mute.png b/core/res/res/drawable-hdpi/stat_notify_call_mute.png Binary files differindex 0cf5ef57bb9f..b0f7990ce592 100755 --- a/core/res/res/drawable-hdpi/stat_notify_call_mute.png +++ b/core/res/res/drawable-hdpi/stat_notify_call_mute.png diff --git a/core/res/res/drawable-hdpi/stat_notify_wifi_in_range.png b/core/res/res/drawable-hdpi/stat_notify_wifi_in_range.png Binary files differindex 0458124bd3fa..76034e5053ad 100644 --- a/core/res/res/drawable-hdpi/stat_notify_wifi_in_range.png +++ b/core/res/res/drawable-hdpi/stat_notify_wifi_in_range.png diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_0.png b/core/res/res/drawable-hdpi/stat_sys_battery_0.png Binary files differindex 3ed0105778bb..82f2509228f6 100644 --- a/core/res/res/drawable-hdpi/stat_sys_battery_0.png +++ b/core/res/res/drawable-hdpi/stat_sys_battery_0.png diff --git a/core/res/res/drawable-mdpi/btn_media_player.9.png b/core/res/res/drawable-mdpi/btn_media_player.9.png Binary files differindex 3ec3f6839848..c479e33e4731 100755 --- a/core/res/res/drawable-mdpi/btn_media_player.9.png +++ b/core/res/res/drawable-mdpi/btn_media_player.9.png diff --git a/core/res/res/drawable-mdpi/btn_media_player_disabled.9.png b/core/res/res/drawable-mdpi/btn_media_player_disabled.9.png Binary files differindex e74335bfe885..8f9d8b42f320 100755 --- a/core/res/res/drawable-mdpi/btn_media_player_disabled.9.png +++ b/core/res/res/drawable-mdpi/btn_media_player_disabled.9.png diff --git a/core/res/res/drawable-mdpi/btn_media_player_disabled_selected.9.png b/core/res/res/drawable-mdpi/btn_media_player_disabled_selected.9.png Binary files differindex 2c6517fdb896..0ba6794b3969 100755 --- a/core/res/res/drawable-mdpi/btn_media_player_disabled_selected.9.png +++ b/core/res/res/drawable-mdpi/btn_media_player_disabled_selected.9.png diff --git a/core/res/res/drawable-mdpi/btn_media_player_pressed.9.png b/core/res/res/drawable-mdpi/btn_media_player_pressed.9.png Binary files differindex 40bee47092e1..f3414702c888 100755 --- a/core/res/res/drawable-mdpi/btn_media_player_pressed.9.png +++ b/core/res/res/drawable-mdpi/btn_media_player_pressed.9.png diff --git a/core/res/res/drawable-mdpi/btn_media_player_selected.9.png b/core/res/res/drawable-mdpi/btn_media_player_selected.9.png Binary files differindex 28d809fe11f6..09f4c992273d 100755 --- a/core/res/res/drawable-mdpi/btn_media_player_selected.9.png +++ b/core/res/res/drawable-mdpi/btn_media_player_selected.9.png diff --git a/core/res/res/drawable-mdpi/checkbox_off_background.png b/core/res/res/drawable-mdpi/checkbox_off_background.png Binary files differindex 6b2124f7ee83..e9471e585845 100644 --- a/core/res/res/drawable-mdpi/checkbox_off_background.png +++ b/core/res/res/drawable-mdpi/checkbox_off_background.png diff --git a/core/res/res/drawable-mdpi/checkbox_on_background.png b/core/res/res/drawable-mdpi/checkbox_on_background.png Binary files differindex 56495fc1a7e0..c247069ac7da 100644 --- a/core/res/res/drawable-mdpi/checkbox_on_background.png +++ b/core/res/res/drawable-mdpi/checkbox_on_background.png diff --git a/core/res/res/drawable-mdpi/panel_background.9.png b/core/res/res/drawable-mdpi/panel_background.9.png Binary files differindex 2305be4648c6..822b6c632637 100644 --- a/core/res/res/drawable-mdpi/panel_background.9.png +++ b/core/res/res/drawable-mdpi/panel_background.9.png diff --git a/core/res/res/drawable-mdpi/stat_notify_call_mute.png b/core/res/res/drawable-mdpi/stat_notify_call_mute.png Binary files differindex 6da83137ed52..4a3b057c248d 100644 --- a/core/res/res/drawable-mdpi/stat_notify_call_mute.png +++ b/core/res/res/drawable-mdpi/stat_notify_call_mute.png diff --git a/core/res/res/drawable-mdpi/stat_sys_battery_0.png b/core/res/res/drawable-mdpi/stat_sys_battery_0.png Binary files differindex 4a5e99e75cc6..a7068b2a223c 100644 --- a/core/res/res/drawable-mdpi/stat_sys_battery_0.png +++ b/core/res/res/drawable-mdpi/stat_sys_battery_0.png diff --git a/core/res/res/layout/app_perms_summary.xml b/core/res/res/layout/app_perms_summary.xml index 716074317987..bdbbfcb3b089 100755 --- a/core/res/res/layout/app_perms_summary.xml +++ b/core/res/res/layout/app_perms_summary.xml @@ -65,21 +65,23 @@ android:layout_marginLeft="16dip" android:duplicateParentState="true"> - <ImageView - android:id="@+id/show_more_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - <TextView android:id="@+id/show_more_text" android:textAppearance="?android:attr/textAppearanceMedium" android:duplicateParentState="true" - android:layout_alignTop="@id/show_more_icon" + android:layout_alignTop="@+id/show_more_icon" android:layout_gravity="center_vertical" - android:paddingLeft="6dip" - android:layout_width="match_parent" + android:paddingLeft="36dip" + android:layout_weight="1" + android:layout_width="wrap_content" android:layout_height="wrap_content" /> + <ImageView + android:id="@id/show_more_icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginRight="12dip" /> + </LinearLayout> <View diff --git a/services/jni/com_android_server_location_GpsLocationProvider.cpp b/services/jni/com_android_server_location_GpsLocationProvider.cpp index b312fb19aa26..bd722d73b679 100755 --- a/services/jni/com_android_server_location_GpsLocationProvider.cpp +++ b/services/jni/com_android_server_location_GpsLocationProvider.cpp @@ -238,7 +238,11 @@ static const GpsInterface* get_gps_interface() { return interface; } -static const GpsInterface* GetGpsInterface() { +static const GpsInterface* GetGpsInterface(JNIEnv* env, jobject obj) { + // this must be set before calling into the HAL library + if (!mCallbacksObj) + mCallbacksObj = env->NewGlobalRef(obj); + if (!sGpsInterface) { sGpsInterface = get_gps_interface(); if (!sGpsInterface || sGpsInterface->init(&sGpsCallbacks) != 0) { @@ -249,9 +253,9 @@ static const GpsInterface* GetGpsInterface() { return sGpsInterface; } -static const AGpsInterface* GetAGpsInterface() +static const AGpsInterface* GetAGpsInterface(JNIEnv* env, jobject obj) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (!interface) return NULL; @@ -263,9 +267,9 @@ static const AGpsInterface* GetAGpsInterface() return sAGpsInterface; } -static const GpsNiInterface* GetNiInterface() +static const GpsNiInterface* GetNiInterface(JNIEnv* env, jobject obj) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (!interface) return NULL; @@ -277,9 +281,9 @@ static const GpsNiInterface* GetNiInterface() return sGpsNiInterface; } -static const AGpsRilInterface* GetAGpsRilInterface() +static const AGpsRilInterface* GetAGpsRilInterface(JNIEnv* env, jobject obj) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (!interface) return NULL; @@ -310,11 +314,7 @@ static jboolean android_location_GpsLocationProvider_is_supported(JNIEnv* env, j static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject obj) { - // this must be set before calling into the HAL library - if (!mCallbacksObj) - mCallbacksObj = env->NewGlobalRef(obj); - - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (!interface) return false; @@ -326,7 +326,7 @@ static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject o static void android_location_GpsLocationProvider_cleanup(JNIEnv* env, jobject obj) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (interface) interface->cleanup(); } @@ -334,7 +334,7 @@ static void android_location_GpsLocationProvider_cleanup(JNIEnv* env, jobject ob static jboolean android_location_GpsLocationProvider_set_position_mode(JNIEnv* env, jobject obj, jint mode, jint recurrence, jint min_interval, jint preferred_accuracy, jint preferred_time) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (interface) return (interface->set_position_mode(mode, recurrence, min_interval, preferred_accuracy, preferred_time) == 0); @@ -344,7 +344,7 @@ static jboolean android_location_GpsLocationProvider_set_position_mode(JNIEnv* e static jboolean android_location_GpsLocationProvider_start(JNIEnv* env, jobject obj) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (interface) return (interface->start() == 0); else @@ -353,7 +353,7 @@ static jboolean android_location_GpsLocationProvider_start(JNIEnv* env, jobject static jboolean android_location_GpsLocationProvider_stop(JNIEnv* env, jobject obj) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (interface) return (interface->stop() == 0); else @@ -362,7 +362,7 @@ static jboolean android_location_GpsLocationProvider_stop(JNIEnv* env, jobject o static void android_location_GpsLocationProvider_delete_aiding_data(JNIEnv* env, jobject obj, jint flags) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (interface) interface->delete_aiding_data(flags); } @@ -402,7 +402,7 @@ static void android_location_GpsLocationProvider_agps_set_reference_location_cel jobject obj, jint type, jint mcc, jint mnc, jint lac, jint cid) { AGpsRefLocation location; - const AGpsRilInterface* interface = GetAGpsRilInterface(); + const AGpsRilInterface* interface = GetAGpsRilInterface(env, obj); if (!interface) { LOGE("no AGPS RIL interface in agps_set_reference_location_cellid"); return; @@ -429,7 +429,7 @@ static void android_location_GpsLocationProvider_agps_send_ni_message(JNIEnv* en jobject obj, jbyteArray ni_msg, jint size) { size_t sz; - const AGpsRilInterface* interface = GetAGpsRilInterface(); + const AGpsRilInterface* interface = GetAGpsRilInterface(env, obj); if (!interface) { LOGE("no AGPS RIL interface in send_ni_message"); return; @@ -445,7 +445,7 @@ static void android_location_GpsLocationProvider_agps_send_ni_message(JNIEnv* en static void android_location_GpsLocationProvider_agps_set_id(JNIEnv *env, jobject obj, jint type, jstring setid_string) { - const AGpsRilInterface* interface = GetAGpsRilInterface(); + const AGpsRilInterface* interface = GetAGpsRilInterface(env, obj); if (!interface) { LOGE("no AGPS RIL interface in agps_set_id"); return; @@ -472,7 +472,7 @@ static jint android_location_GpsLocationProvider_read_nmea(JNIEnv* env, jobject static void android_location_GpsLocationProvider_inject_time(JNIEnv* env, jobject obj, jlong time, jlong timeReference, jint uncertainty) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (interface) interface->inject_time(time, timeReference, uncertainty); } @@ -480,7 +480,7 @@ static void android_location_GpsLocationProvider_inject_time(JNIEnv* env, jobjec static void android_location_GpsLocationProvider_inject_location(JNIEnv* env, jobject obj, jdouble latitude, jdouble longitude, jfloat accuracy) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (interface) interface->inject_location(latitude, longitude, accuracy); } @@ -488,7 +488,7 @@ static void android_location_GpsLocationProvider_inject_location(JNIEnv* env, jo static jboolean android_location_GpsLocationProvider_supports_xtra(JNIEnv* env, jobject obj) { if (!sGpsXtraInterface) { - const GpsInterface* interface = GetGpsInterface(); + const GpsInterface* interface = GetGpsInterface(env, obj); if (!interface) return false; sGpsXtraInterface = (const GpsXtraInterface*)interface->get_extension(GPS_XTRA_INTERFACE); @@ -513,7 +513,7 @@ static void android_location_GpsLocationProvider_inject_xtra_data(JNIEnv* env, j static void android_location_GpsLocationProvider_agps_data_conn_open(JNIEnv* env, jobject obj, jstring apn) { - const AGpsInterface* interface = GetAGpsInterface(); + const AGpsInterface* interface = GetAGpsInterface(env, obj); if (!interface) { LOGE("no AGPS interface in agps_data_conn_open"); return; @@ -529,7 +529,7 @@ static void android_location_GpsLocationProvider_agps_data_conn_open(JNIEnv* env static void android_location_GpsLocationProvider_agps_data_conn_closed(JNIEnv* env, jobject obj) { - const AGpsInterface* interface = GetAGpsInterface(); + const AGpsInterface* interface = GetAGpsInterface(env, obj); if (!interface) { LOGE("no AGPS interface in agps_data_conn_open"); return; @@ -539,7 +539,7 @@ static void android_location_GpsLocationProvider_agps_data_conn_closed(JNIEnv* e static void android_location_GpsLocationProvider_agps_data_conn_failed(JNIEnv* env, jobject obj) { - const AGpsInterface* interface = GetAGpsInterface(); + const AGpsInterface* interface = GetAGpsInterface(env, obj); if (!interface) { LOGE("no AGPS interface in agps_data_conn_open"); return; @@ -550,7 +550,7 @@ static void android_location_GpsLocationProvider_agps_data_conn_failed(JNIEnv* e static void android_location_GpsLocationProvider_set_agps_server(JNIEnv* env, jobject obj, jint type, jstring hostname, jint port) { - const AGpsInterface* interface = GetAGpsInterface(); + const AGpsInterface* interface = GetAGpsInterface(env, obj); if (!interface) { LOGE("no AGPS interface in agps_data_conn_open"); return; @@ -563,7 +563,7 @@ static void android_location_GpsLocationProvider_set_agps_server(JNIEnv* env, jo static void android_location_GpsLocationProvider_send_ni_response(JNIEnv* env, jobject obj, jint notifId, jint response) { - const GpsNiInterface* interface = GetNiInterface(); + const GpsNiInterface* interface = GetNiInterface(env, obj); if (!interface) { LOGE("no NI interface in send_ni_response"); return; diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index b4a3c953bc50..5542c42c3b6c 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1649,12 +1649,19 @@ public class PhoneNumberUtils } /** + * Determines if the specified number is actually a URI + * (i.e. a SIP address) rather than a regular PSTN phone number, + * based on whether or not the number contains an "@" character. + * * @hide * @param number * @return true if number contains @ */ public static boolean isUriNumber(String number) { - return number != null && number.contains("@"); + // Note we allow either "@" or "%40" to indicate a URI, in case + // the passed-in string is URI-escaped. (Neither "@" nor "%40" + // will ever be found in a legal PSTN number.) + return number != null && (number.contains("@") || number.contains("%40")); } /** diff --git a/telephony/java/com/android/internal/telephony/sip/SipPhone.java b/telephony/java/com/android/internal/telephony/sip/SipPhone.java index 02af0ed9d441..67f13bd56f85 100755 --- a/telephony/java/com/android/internal/telephony/sip/SipPhone.java +++ b/telephony/java/com/android/internal/telephony/sip/SipPhone.java @@ -18,7 +18,6 @@ package com.android.internal.telephony.sip; import android.content.Context; import android.net.rtp.AudioGroup; -import android.net.rtp.AudioStream; import android.net.sip.SipAudioCall; import android.net.sip.SipErrorCode; import android.net.sip.SipException; @@ -29,11 +28,9 @@ import android.os.AsyncResult; import android.os.Message; import android.telephony.PhoneNumberUtils; import android.telephony.ServiceState; -import android.text.TextUtils; import android.util.Log; import com.android.internal.telephony.Call; -import com.android.internal.telephony.CallerInfo; import com.android.internal.telephony.CallStateException; import com.android.internal.telephony.Connection; import com.android.internal.telephony.Phone; @@ -382,40 +379,6 @@ public class SipPhone extends SipPhoneBase { } } - private CallerInfo createCallerInfo(String number, SipProfile callee) { - SipProfile p = callee; - String name = p.getDisplayName(); - if (TextUtils.isEmpty(name)) name = p.getUserName(); - CallerInfo info = new CallerInfo(); - info.name = name; - info.phoneNumber = number; - if (DEBUG) { - Log.d(LOG_TAG, "create caller info from scratch:"); - Log.d(LOG_TAG, " name: " + info.name); - Log.d(LOG_TAG, " numb: " + info.phoneNumber); - } - return info; - } - - // from contacts - private CallerInfo findCallerInfo(String number) { - CallerInfo info = CallerInfo.getCallerInfo(mContext, number); - if ((info == null) || (info.name == null)) return null; - if (DEBUG) { - Log.d(LOG_TAG, "got caller info from contact:"); - Log.d(LOG_TAG, " name: " + info.name); - Log.d(LOG_TAG, " numb: " + info.phoneNumber); - Log.d(LOG_TAG, " pres: " + info.numberPresentation); - } - return info; - } - - private CallerInfo getCallerInfo(String number, SipProfile callee) { - CallerInfo info = findCallerInfo(number); - if (info == null) info = createCallerInfo(number, callee); - return info; - } - Connection dial(String originalNumber) throws SipException { String calleeSipUri = originalNumber; if (!calleeSipUri.contains("@")) { @@ -424,8 +387,7 @@ public class SipPhone extends SipPhoneBase { try { SipProfile callee = new SipProfile.Builder(calleeSipUri).build(); - CallerInfo info = getCallerInfo(originalNumber, callee); - SipConnection c = new SipConnection(this, callee, info); + SipConnection c = new SipConnection(this, callee); connections.add(c); c.dial(); setState(Call.State.DIALING); @@ -461,10 +423,7 @@ public class SipPhone extends SipPhoneBase { void initIncomingCall(SipAudioCall sipAudioCall, boolean makeCallWait) { SipProfile callee = sipAudioCall.getPeerProfile(); - CallerInfo info = findCallerInfo(getUriString(callee)); - if (info == null) info = findCallerInfo(callee.getUserName()); - if (info == null) info = findCallerInfo(callee.getDisplayName()); - SipConnection c = new SipConnection(this, callee, info); + SipConnection c = new SipConnection(this, callee); connections.add(c); Call.State newState = makeCallWait ? State.WAITING : State.INCOMING; @@ -700,12 +659,10 @@ public class SipPhone extends SipPhoneBase { } }; - public SipConnection(SipCall owner, SipProfile callee, - CallerInfo info) { + public SipConnection(SipCall owner, SipProfile callee) { super(getUriString(callee)); mOwner = owner; mPeer = callee; - setUserData(info); } void initIncomingCall(SipAudioCall sipAudioCall, Call.State newState) { diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 9c5fcda2bcf0..c8ba9048f867 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -835,7 +835,9 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets) bool hasErrors = false; if (drawables != NULL) { - err = preProcessImages(bundle, assets, drawables); + if (bundle->getOutputAPKFile() != NULL) { + err = preProcessImages(bundle, assets, drawables); + } if (err == NO_ERROR) { err = makeFileResources(bundle, assets, &table, drawables, "drawable"); if (err != NO_ERROR) { diff --git a/voip/java/com/android/server/sip/SipHelper.java b/voip/java/com/android/server/sip/SipHelper.java index 050eddc4cb89..25142621c71c 100644 --- a/voip/java/com/android/server/sip/SipHelper.java +++ b/voip/java/com/android/server/sip/SipHelper.java @@ -238,6 +238,8 @@ class SipHelper { ClientTransaction tid = responseEvent.getClientTransaction(); ClientTransaction ct = authenticationHelper.handleChallenge( responseEvent.getResponse(), tid, mSipProvider, 5); + if (DEBUG) Log.d(TAG, "send request with challenge response: " + + ct.getRequest()); ct.sendRequest(); return ct; } |