diff options
19 files changed, 83 insertions, 132 deletions
diff --git a/api/16.txt b/api/16.txt index 4cdff10880fd..25885fb8af54 100644 --- a/api/16.txt +++ b/api/16.txt @@ -18,6 +18,7 @@ package android { field public static final java.lang.String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL"; field public static final java.lang.String AUTHENTICATE_ACCOUNTS = "android.permission.AUTHENTICATE_ACCOUNTS"; field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS"; + field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE"; field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET"; field public static final java.lang.String BIND_DEVICE_ADMIN = "android.permission.BIND_DEVICE_ADMIN"; field public static final java.lang.String BIND_INPUT_METHOD = "android.permission.BIND_INPUT_METHOD"; diff --git a/api/current.txt b/api/current.txt index a416e30858de..3beaaa5fbd7f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -18,6 +18,7 @@ package android { field public static final java.lang.String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL"; field public static final java.lang.String AUTHENTICATE_ACCOUNTS = "android.permission.AUTHENTICATE_ACCOUNTS"; field public static final java.lang.String BATTERY_STATS = "android.permission.BATTERY_STATS"; + field public static final java.lang.String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE"; field public static final java.lang.String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET"; field public static final java.lang.String BIND_DEVICE_ADMIN = "android.permission.BIND_DEVICE_ADMIN"; field public static final java.lang.String BIND_INPUT_METHOD = "android.permission.BIND_INPUT_METHOD"; diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index ebe2b98d7da8..b6001ebeedd2 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -59,8 +59,9 @@ import com.android.internal.os.HandlerCaller; * An accessibility is declared as any other service in an AndroidManifest.xml but it * must also specify that it handles the "android.accessibilityservice.AccessibilityService" * {@link android.content.Intent}. Failure to declare this intent will cause the system to - * ignore the accessibility service. Additionally an accessibility service must request - * "android.permission.BIND_ACCESSIBILITY_SERVICE" permission to ensure that only the system + * ignore the accessibility service. Additionally an accessibility service must request the + * {@link android.Manifest.permission#BIND_ACCESSIBILITY_SERVICE} permission to ensure + * that only the system * can bind to it. Failure to declare this intent will cause the system to ignore the * accessibility service. Following is an example declaration: * </p> diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 2d5b6253fc4d..8ec0c6902b79 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -375,10 +375,39 @@ public class Build { * <p>Applications targeting this or a later release will get these * new changes in behavior:</p> * <ul> + * <li> You must explicitly request the {@link android.Manifest.permission#READ_CALL_LOG} + * and/or {@link android.Manifest.permission#WRITE_CALL_LOG} permissions; + * access to the call log is no longer implicitly provided through + * {@link android.Manifest.permission#READ_CONTACTS} and + * {@link android.Manifest.permission#WRITE_CONTACTS}. + * <li> {@link android.widget.RemoteViews} will throw an exception if + * setting an onClick handler for views being generated by a + * {@link android.widget.RemoteViewsService} for a collection container; + * previously this just resulted in a warning log message. + * <li> New {@link android.app.ActionBar} policy for embedded tabs: + * embedded tabs are now always stacked in the action bar when in portrait + * mode, regardless of the size of the screen. + * <li> {@link android.webkit.WebSettings#setAllowFileAccessFromFileURLs(boolean) + * WebSettings.setAllowFileAccessFromFileURLs} and + * {@link android.webkit.WebSettings#setAllowUniversalAccessFromFileURLs(boolean) + * WebSettings.setAllowUniversalAccessFromFileURLs} default to false. * <li> Calls to {@link android.content.pm.PackageManager#setComponentEnabledSetting * PackageManager.setComponentEnabledSetting} will now throw an * IllegalArgumentException if the given component class name does not * exist in the application's manifest. + * <li> {@link android.nfc.NfcAdapter#setNdefPushMessage + * NfcAdapter.setNdefPushMessage}, + * {@link android.nfc.NfcAdapter#setNdefPushMessageCallback + * NfcAdapter.setNdefPushMessageCallback} and + * {@link android.nfc.NfcAdapter#setOnNdefPushCompleteCallback + * NfcAdapter.setOnNdefPushCompleteCallback} will throw + * IllegalStateException if called after the Activity has been destroyed. + * <li> Accessibility services must require the new + * {@link android.Manifest.permission#BIND_ACCESSIBILITY_SERVICE} permission or + * they will not be available for use. + * <li> {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_INCLUDE_NOT_IMPORTANT_VIEWS + * AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS} must be set + * for unimportant views to be included in queries. * </ul> */ public static final int JELLY_BEAN = 16; diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 7c6a7c520b52..0a2b76c5aeb2 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6311,13 +6311,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal private void requestAccessibilityFocusFromHover() { if (includeForAccessibility() && isActionableForAccessibility()) { requestAccessibilityFocus(); - requestFocusNoSearch(View.FOCUS_DOWN, null); } else { if (mParent != null) { View nextFocus = mParent.findViewToTakeAccessibilityFocusFromHover(this, this); if (nextFocus != null) { nextFocus.requestAccessibilityFocus(); - nextFocus.requestFocusNoSearch(View.FOCUS_DOWN, null); } } } diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index 19857928a58a..ad4d7423fa10 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -492,7 +492,7 @@ public class RemoteViews implements Parcelable, Filter { // If the view is an AdapterView, setting a PendingIntent on click doesn't make much // sense, do they mean to set a PendingIntent template for the AdapterView's children? if (mIsWidgetCollectionChild) { - Log.e("RemoteViews", "Cannot setOnClickPendingIntent for collection item " + + Log.w("RemoteViews", "Cannot setOnClickPendingIntent for collection item " + "(id: " + viewId + ")"); ApplicationInfo appInfo = root.getContext().getApplicationInfo(); diff --git a/core/java/com/android/internal/os/ProcessStats.java b/core/java/com/android/internal/os/ProcessStats.java index e0e9a29714d1..1923b86b28d8 100644 --- a/core/java/com/android/internal/os/ProcessStats.java +++ b/core/java/com/android/internal/os/ProcessStats.java @@ -619,8 +619,11 @@ public class ProcessStats { } final public float getTotalCpuPercent() { - return ((float)(mRelUserTime+mRelSystemTime+mRelIrqTime)*100) - / (mRelUserTime+mRelSystemTime+mRelIrqTime+mRelIdleTime); + int denom = mRelUserTime+mRelSystemTime+mRelIrqTime+mRelIdleTime; + if (denom <= 0) { + return 0; + } + return ((float)(mRelUserTime+mRelSystemTime+mRelIrqTime)*100) / denom; } final void buildWorkingProcs() { @@ -699,7 +702,7 @@ public class ProcessStats { long sampleTime = mCurrentSampleTime - mLastSampleTime; long sampleRealTime = mCurrentSampleRealTime - mLastSampleRealTime; - long percAwake = (sampleTime*100) / sampleRealTime; + long percAwake = sampleRealTime > 0 ? ((sampleTime*100) / sampleRealTime) : 0; if (percAwake != 100) { pw.print(" with "); pw.print(percAwake); diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index d9d87c1bcc85..969801851b91 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1271,8 +1271,7 @@ android:protectionLevel="signature" /> <!-- Must be required by an {@link android.accessibilityservice.AccessibilityService}, - to ensure that only the system can bind to it. - @hide --> + to ensure that only the system can bind to it. --> <permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" android:label="@string/permlab_bindAccessibilityService" android:description="@string/permdesc_bindAccessibilityService" diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 3be8dcc2ac48..48d5b31f5ec8 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -812,13 +812,6 @@ <java-symbol type="string" name="sms_control_title" /> <java-symbol type="string" name="sms_control_no" /> <java-symbol type="string" name="sms_control_yes" /> - <java-symbol type="string" name="sms_premium_short_code_confirm_message" /> - <java-symbol type="string" name="sms_premium_short_code_confirm_title" /> - <java-symbol type="string" name="sms_short_code_confirm_allow" /> - <java-symbol type="string" name="sms_short_code_confirm_deny" /> - <java-symbol type="string" name="sms_short_code_confirm_message" /> - <java-symbol type="string" name="sms_short_code_confirm_report" /> - <java-symbol type="string" name="sms_short_code_confirm_title" /> <java-symbol type="string" name="submit" /> <java-symbol type="string" name="sync_binding_label" /> <java-symbol type="string" name="sync_do_nothing" /> diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index a2c20fd03270..5da30bd6fa4a 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -135,8 +135,10 @@ public class AudioService extends IAudioService.Stub implements OnFinished { private static final int MSG_RCDISPLAY_UPDATE = 13; private static final int MSG_SET_ALL_VOLUMES = 14; private static final int MSG_PERSIST_MASTER_VOLUME_MUTE = 15; - private static final int MSG_SET_WIRED_DEVICE_CONNECTION_STATE = 16;//handled under wakelock - private static final int MSG_SET_A2DP_CONNECTION_STATE = 17; //handled under wakelock + // messages handled under wakelock, can only be queued, i.e. sent with queueMsgUnderWakeLock(), + // and not with sendMsg(..., ..., SENDMSG_QUEUE, ...) + private static final int MSG_SET_WIRED_DEVICE_CONNECTION_STATE = 16; + private static final int MSG_SET_A2DP_CONNECTION_STATE = 17; // flags for MSG_PERSIST_VOLUME indicating if current and/or last audible volume should be @@ -1962,9 +1964,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished { int delay = checkSendBecomingNoisyIntent( AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, (state == BluetoothA2dp.STATE_CONNECTED) ? 1 : 0); - sendMsg(mAudioHandler, + queueMsgUnderWakeLock(mAudioHandler, MSG_SET_A2DP_CONNECTION_STATE, - SENDMSG_QUEUE, state, 0, btDevice, diff --git a/packages/SystemUI/res/drawable-hdpi/notification_header_bg.9.png b/packages/SystemUI/res/drawable-hdpi/notification_header_bg.9.png Binary files differnew file mode 100644 index 000000000000..74448892dc74 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/notification_header_bg.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/notification_header_bg.9.png b/packages/SystemUI/res/drawable-mdpi/notification_header_bg.9.png Binary files differnew file mode 100644 index 000000000000..5002f97417a8 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/notification_header_bg.9.png diff --git a/packages/SystemUI/res/drawable-xhdpi/notification_header_bg.9.png b/packages/SystemUI/res/drawable-xhdpi/notification_header_bg.9.png Binary files differnew file mode 100644 index 000000000000..15008d27f86b --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/notification_header_bg.9.png diff --git a/packages/SystemUI/res/layout/status_bar_expanded_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml index cb4e6a988b6a..7f598b67fb0c 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml @@ -20,7 +20,6 @@ xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="@dimen/notification_panel_header_padding_top" android:background="@drawable/notification_header_bg" android:orientation="horizontal" android:gravity="center_vertical" diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index ac2779faa5ca..9bbfc91f7e62 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -24,7 +24,6 @@ <drawable name="status_bar_recents_app_thumbnail_background">#88000000</drawable> <color name="status_bar_recents_app_label_color">#ffffffff</color> <drawable name="status_bar_notification_row_background_color">#ff090909</drawable> - <drawable name="notification_header_bg">#FF000000</drawable> <color name="notification_list_shadow_top">#80000000</color> <drawable name="recents_callout_line">#99ffffff</drawable> <drawable name="notification_item_background_legacy_color">#ffaaaaaa</drawable> diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java index e1abb237394f..f85007e29424 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java @@ -41,7 +41,8 @@ import com.android.systemui.R; import com.android.systemui.SwipeHelper; import com.android.systemui.recent.RecentsPanelView.TaskDescriptionAdapter; -import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; public class RecentsHorizontalScrollView extends HorizontalScrollView implements SwipeHelper.Callback, RecentsPanelView.RecentsScrollView { @@ -53,7 +54,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView protected int mLastScrollPosition; private SwipeHelper mSwipeHelper; private RecentsScrollViewPerformanceHelper mPerformanceHelper; - private ArrayList<View> mRecycledViews; + private HashSet<View> mRecycledViews; private int mNumItemsInOneScreenful; public RecentsHorizontalScrollView(Context context, AttributeSet attrs) { @@ -62,7 +63,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop(); mSwipeHelper = new SwipeHelper(SwipeHelper.Y, this, densityScale, pagingTouchSlop); mPerformanceHelper = RecentsScrollViewPerformanceHelper.create(context, attrs, this, false); - mRecycledViews = new ArrayList<View>(); + mRecycledViews = new HashSet<View>(); } public void setMinSwipeAlpha(float minAlpha) { @@ -89,16 +90,12 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView setLayoutTransition(null); mLinearLayout.removeAllViews(); - for (int i = 0; i < mRecycledViews.size(); i++) { - View child = mRecycledViews.get(i); - if (child.getParent() != null) { - throw new RuntimeException("Recycled child has a parent"); - } - } + Iterator<View> recycledViews = mRecycledViews.iterator(); for (int i = 0; i < mAdapter.getCount(); i++) { View old = null; - if (mRecycledViews.size() != 0) { - old = mRecycledViews.remove(mRecycledViews.size() - 1); + if (recycledViews.hasNext()) { + old = recycledViews.next(); + recycledViews.remove(); old.setVisibility(VISIBLE); } @@ -195,9 +192,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView public void onChildDismissed(View v) { addToRecycledViews(v); mLinearLayout.removeView(v); - if (v.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } mCallback.handleSwipe(v); // Restore the alpha/translation parameters to what they were before swiping // (for when these items are recycled) @@ -369,15 +363,9 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView mNumItemsInOneScreenful = (int) FloatMath.ceil(dm.widthPixels / (float) child.getMeasuredWidth()); addToRecycledViews(child); - if (child.getParent() != null) { - throw new RuntimeException("First recycled child has parent"); - } for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) { addToRecycledViews(mAdapter.createView(mLinearLayout)); - if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } } } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index a1e36fb64066..d387515451e3 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -41,7 +41,8 @@ import com.android.systemui.R; import com.android.systemui.SwipeHelper; import com.android.systemui.recent.RecentsPanelView.TaskDescriptionAdapter; -import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper.Callback, RecentsPanelView.RecentsScrollView { @@ -53,7 +54,7 @@ public class RecentsVerticalScrollView extends ScrollView protected int mLastScrollPosition; private SwipeHelper mSwipeHelper; private RecentsScrollViewPerformanceHelper mPerformanceHelper; - private ArrayList<View> mRecycledViews; + private HashSet<View> mRecycledViews; private int mNumItemsInOneScreenful; public RecentsVerticalScrollView(Context context, AttributeSet attrs) { @@ -63,7 +64,7 @@ public class RecentsVerticalScrollView extends ScrollView mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop); mPerformanceHelper = RecentsScrollViewPerformanceHelper.create(context, attrs, this, true); - mRecycledViews = new ArrayList<View>(); + mRecycledViews = new HashSet<View>(); } public void setMinSwipeAlpha(float minAlpha) { @@ -93,19 +94,16 @@ public class RecentsVerticalScrollView extends ScrollView setLayoutTransition(null); mLinearLayout.removeAllViews(); - for (int i = 0; i < mRecycledViews.size(); i++) { - View child = mRecycledViews.get(i); - if (child.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } - } + // Once we can clear the data associated with individual item views, // we can get rid of the removeAllViews() and the code below will // recycle them. + Iterator<View> recycledViews = mRecycledViews.iterator(); for (int i = 0; i < mAdapter.getCount(); i++) { View old = null; - if (mRecycledViews.size() != 0) { - old = mRecycledViews.remove(mRecycledViews.size() - 1); + if (recycledViews.hasNext()) { + old = recycledViews.next(); + recycledViews.remove(); old.setVisibility(VISIBLE); if (old.getParent() != null) { throw new RuntimeException("Recycled child has parent (i: " + i + ", recycled i: " + mRecycledViews.size()); @@ -150,9 +148,6 @@ public class RecentsVerticalScrollView extends ScrollView thumbnailView.setClickable(true); thumbnailView.setOnClickListener(launchAppListener); thumbnailView.setOnLongClickListener(longClickListener); - if (view.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } // We don't want to dismiss recents if a user clicks on the app title // (we also don't want to launch the app either, though, because the @@ -162,9 +157,6 @@ public class RecentsVerticalScrollView extends ScrollView appTitle.setOnTouchListener(noOpListener); final View calloutLine = view.findViewById(R.id.recents_callout_line); calloutLine.setOnTouchListener(noOpListener); - if (view.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } mLinearLayout.addView(view); } @@ -213,9 +205,6 @@ public class RecentsVerticalScrollView extends ScrollView public void onChildDismissed(View v) { addToRecycledViews(v); mLinearLayout.removeView(v); - if (v.getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } mCallback.handleSwipe(v); // Restore the alpha/translation parameters to what they were before swiping // (for when these items are recycled) @@ -389,15 +378,9 @@ public class RecentsVerticalScrollView extends ScrollView mNumItemsInOneScreenful = (int) FloatMath.ceil(dm.heightPixels / (float) child.getMeasuredHeight()); addToRecycledViews(child); - if (child.getParent() != null) { - throw new RuntimeException("First recycled child has parent"); - } for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) { addToRecycledViews(mAdapter.createView(mLinearLayout)); - if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) { - throw new RuntimeException("Recycled child has parent"); - } } } diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index 250a198365fa..0280425f9d3f 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -245,6 +245,7 @@ public class PowerManagerService extends IPowerManager.Stub private Handler mHandler; private final TimeoutTask mTimeoutTask = new TimeoutTask(); private ScreenBrightnessAnimator mScreenBrightnessAnimator; + private boolean mWaitingForFirstLightSensor = false; private boolean mStillNeedSleepNotification; private boolean mIsPowered = false; private IActivityManager mActivityService; @@ -1756,7 +1757,11 @@ public class PowerManagerService extends IPowerManager.Stub mLastScreenOnTime = (on ? SystemClock.elapsedRealtime() : 0); if (mUseSoftwareAutoBrightness) { enableLightSensorLocked(on); - if (!on) { + if (on) { + // If AutoBrightness is enabled, set the brightness immediately after the + // next sensor value is received. + mWaitingForFirstLightSensor = mAutoBrightessEnabled; + } else { // make sure button and key backlights are off too mButtonLight.turnOff(); mKeyboardLight.turnOff(); @@ -2637,7 +2642,7 @@ public class PowerManagerService extends IPowerManager.Stub private void lightSensorChangedLocked(int value, boolean immediate) { if (mDebugLightSensor) { - Slog.d(TAG, "lightSensorChangedLocked " + value); + Slog.d(TAG, "lightSensorChangedLocked value=" + value + " immediate=" + immediate); } // Don't do anything if the screen is off. @@ -3213,7 +3218,9 @@ public class PowerManagerService extends IPowerManager.Stub private void enableLightSensorLocked(boolean enable) { if (mDebugLightSensor) { Slog.d(TAG, "enableLightSensorLocked enable=" + enable - + " mAutoBrightessEnabled=" + mAutoBrightessEnabled); + + " mLightSensorEnabled=" + mLightSensorEnabled + + " mAutoBrightessEnabled=" + mAutoBrightessEnabled + + " mWaitingForFirstLightSensor=" + mWaitingForFirstLightSensor); } if (!mAutoBrightessEnabled) { enable = false; @@ -3227,8 +3234,8 @@ public class PowerManagerService extends IPowerManager.Stub // reset our highest value when reenabling mHighestLightSensorValue = -1; // force recompute of backlight values - if (mLightSensorValue >= 0) { - int value = (int)mLightSensorValue; + final int value = (int)mLightSensorValue; + if (value >= 0) { mLightSensorValue = -1; handleLightSensorValue(value, true); } @@ -3292,8 +3299,9 @@ public class PowerManagerService extends IPowerManager.Stub private void handleLightSensorValue(int value, boolean immediate) { long milliseconds = SystemClock.elapsedRealtime(); - if (mLightSensorValue == -1 || - milliseconds < mLastScreenOnTime + mLightSensorWarmupTime) { + if (mLightSensorValue == -1 + || milliseconds < mLastScreenOnTime + mLightSensorWarmupTime + || mWaitingForFirstLightSensor) { // process the value immediately if screen has just turned on mHandler.removeCallbacks(mAutoBrightnessTask); mLightSensorPendingDecrease = false; @@ -3328,7 +3336,10 @@ public class PowerManagerService extends IPowerManager.Stub if (isScreenTurningOffLocked()) { return; } - handleLightSensorValue((int)event.values[0], false); + handleLightSensorValue((int)event.values[0], mWaitingForFirstLightSensor); + if (mWaitingForFirstLightSensor) { + mWaitingForFirstLightSensor = false; + } } } diff --git a/telephony/java/com/android/internal/telephony/SMSDispatcher.java b/telephony/java/com/android/internal/telephony/SMSDispatcher.java index 6ba8b9e65436..07d733eda9cf 100644 --- a/telephony/java/com/android/internal/telephony/SMSDispatcher.java +++ b/telephony/java/com/android/internal/telephony/SMSDispatcher.java @@ -116,12 +116,6 @@ public abstract class SMSDispatcher extends Handler { /** Don't send SMS (user did not confirm). */ static final int EVENT_STOP_SENDING = 7; // accessed from inner class - /** Confirmation required for third-party apps sending to an SMS short code. */ - private static final int EVENT_CONFIRM_SEND_TO_POSSIBLE_PREMIUM_SHORT_CODE = 8; - - /** Confirmation required for third-party apps sending to an SMS short code. */ - private static final int EVENT_CONFIRM_SEND_TO_PREMIUM_SHORT_CODE = 9; - protected final Phone mPhone; protected final Context mContext; protected final ContentResolver mResolver; @@ -294,14 +288,6 @@ public abstract class SMSDispatcher extends Handler { handleReachSentLimit((SmsTracker)(msg.obj)); break; - case EVENT_CONFIRM_SEND_TO_POSSIBLE_PREMIUM_SHORT_CODE: - handleConfirmShortCode(false, (SmsTracker)(msg.obj)); - break; - - case EVENT_CONFIRM_SEND_TO_PREMIUM_SHORT_CODE: - handleConfirmShortCode(true, (SmsTracker)(msg.obj)); - break; - case EVENT_SEND_CONFIRMED_SMS: { SmsTracker tracker = (SmsTracker) msg.obj; @@ -1000,47 +986,6 @@ public abstract class SMSDispatcher extends Handler { } /** - * Post an alert for user confirmation when sending to a potential short code. - * @param isPremium true if the destination is known to be a premium short code - * @param tracker the SmsTracker for the current message. - */ - protected void handleConfirmShortCode(boolean isPremium, SmsTracker tracker) { - if (denyIfQueueLimitReached(tracker)) { - return; // queue limit reached; error was returned to caller - } - - int messageId; - int titleId; - if (isPremium) { - messageId = R.string.sms_premium_short_code_confirm_message; - titleId = R.string.sms_premium_short_code_confirm_title; - } else { - messageId = R.string.sms_short_code_confirm_message; - titleId = R.string.sms_short_code_confirm_title; - } - - CharSequence appLabel = getAppLabel(tracker.mAppPackage); - Resources r = Resources.getSystem(); - Spanned messageText = Html.fromHtml(r.getString(messageId, appLabel, tracker.mDestAddress)); - - ConfirmDialogListener listener = new ConfirmDialogListener(tracker); - - AlertDialog d = new AlertDialog.Builder(mContext) - .setTitle(titleId) - .setIcon(R.drawable.stat_sys_warning) - .setMessage(messageText) - .setPositiveButton(r.getString(R.string.sms_short_code_confirm_allow), listener) - .setNegativeButton(r.getString(R.string.sms_short_code_confirm_deny), listener) -// TODO: add third button for "Report malicious app" feature -// .setNeutralButton(r.getString(R.string.sms_short_code_confirm_report), listener) - .setOnCancelListener(listener) - .create(); - - d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); - d.show(); - } - - /** * Send the message along to the radio. * * @param tracker holds the SMS message to send |