diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/appwidget/AppWidgetHostView.java | 55 | ||||
-rw-r--r-- | core/java/android/net/wimax/WimaxManagerConstants.java | 104 | ||||
-rw-r--r-- | core/java/android/provider/Settings.java | 19 | ||||
-rwxr-xr-x | core/java/android/provider/Telephony.java | 10 | ||||
-rwxr-xr-x | core/java/android/speech/tts/TextToSpeech.java | 1 | ||||
-rw-r--r-- | core/java/android/speech/tts/TextToSpeechService.java | 9 | ||||
-rw-r--r-- | core/java/android/webkit/BrowserFrame.java | 7 | ||||
-rw-r--r-- | core/java/android/webkit/JWebCoreJavaBridge.java | 2 | ||||
-rw-r--r-- | core/java/android/webkit/LoadListener.java | 4 | ||||
-rw-r--r-- | core/java/android/webkit/PerfChecker.java | 49 | ||||
-rw-r--r-- | core/java/android/webkit/WebView.java | 57 | ||||
-rw-r--r-- | core/java/android/widget/Spinner.java | 18 | ||||
-rw-r--r-- | core/java/android/widget/TextView.java | 81 | ||||
-rw-r--r-- | core/java/com/android/internal/widget/LockPatternUtils.java | 29 |
14 files changed, 232 insertions, 213 deletions
diff --git a/core/java/android/appwidget/AppWidgetHostView.java b/core/java/android/appwidget/AppWidgetHostView.java index 761c7eb..61a9dce 100644 --- a/core/java/android/appwidget/AppWidgetHostView.java +++ b/core/java/android/appwidget/AppWidgetHostView.java @@ -26,6 +26,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Rect; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; @@ -41,8 +42,8 @@ import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.FrameLayout; import android.widget.RemoteViews; -import android.widget.TextView; import android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback; +import android.widget.TextView; /** * Provides the glue to show AppWidget views. This class offers automatic animation @@ -106,7 +107,9 @@ public class AppWidgetHostView extends FrameLayout { } /** - * Set the AppWidget that will be displayed by this view. + * Set the AppWidget that will be displayed by this view. This method also adds default padding + * to widgets, as described in {@link #getDefaultPaddingForWidget(Context, ComponentName, Rect)} + * and can be overridden in order to add custom padding. */ public void setAppWidget(int appWidgetId, AppWidgetProviderInfo info) { mAppWidgetId = appWidgetId; @@ -116,49 +119,57 @@ public class AppWidgetHostView extends FrameLayout { // a widget, eg. for some widgets in safe mode. if (info != null) { // We add padding to the AppWidgetHostView if necessary - Padding padding = getPaddingForWidget(info.provider); + Rect padding = getDefaultPaddingForWidget(mContext, info.provider, null); setPadding(padding.left, padding.top, padding.right, padding.bottom); } } - private static class Padding { - int left = 0; - int right = 0; - int top = 0; - int bottom = 0; - } - /** * As of ICE_CREAM_SANDWICH we are automatically adding padding to widgets targeting * ICE_CREAM_SANDWICH and higher. The new widget design guidelines strongly recommend * that widget developers do not add extra padding to their widgets. This will help * achieve consistency among widgets. + * + * Note: this method is only needed by developers of AppWidgetHosts. The method is provided in + * order for the AppWidgetHost to account for the automatic padding when computing the number + * of cells to allocate to a particular widget. + * + * @param context the current context + * @param component the component name of the widget + * @param padding Rect in which to place the output, if null, a new Rect will be allocated and + * returned + * @return default padding for this widget */ - private Padding getPaddingForWidget(ComponentName component) { - PackageManager packageManager = mContext.getPackageManager(); - Padding p = new Padding(); + public static Rect getDefaultPaddingForWidget(Context context, ComponentName component, + Rect padding) { + PackageManager packageManager = context.getPackageManager(); ApplicationInfo appInfo; + if (padding == null) { + padding = new Rect(0, 0, 0, 0); + } else { + padding.set(0, 0, 0, 0); + } + try { appInfo = packageManager.getApplicationInfo(component.getPackageName(), 0); - } catch (Exception e) { + } catch (NameNotFoundException e) { // if we can't find the package, return 0 padding - return p; + return padding; } if (appInfo.targetSdkVersion >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - Resources r = getResources(); - p.left = r.getDimensionPixelSize(com.android.internal. + Resources r = context.getResources(); + padding.left = r.getDimensionPixelSize(com.android.internal. R.dimen.default_app_widget_padding_left); - p.right = r.getDimensionPixelSize(com.android.internal. + padding.right = r.getDimensionPixelSize(com.android.internal. R.dimen.default_app_widget_padding_right); - p.top = r.getDimensionPixelSize(com.android.internal. + padding.top = r.getDimensionPixelSize(com.android.internal. R.dimen.default_app_widget_padding_top); - p.bottom = r.getDimensionPixelSize(com.android.internal. + padding.bottom = r.getDimensionPixelSize(com.android.internal. R.dimen.default_app_widget_padding_bottom); } - - return p; + return padding; } public int getAppWidgetId() { diff --git a/core/java/android/net/wimax/WimaxManagerConstants.java b/core/java/android/net/wimax/WimaxManagerConstants.java new file mode 100644 index 0000000..b4aaf5b --- /dev/null +++ b/core/java/android/net/wimax/WimaxManagerConstants.java @@ -0,0 +1,104 @@ +package android.net.wimax; + +/** + * {@hide} + */ +public class WimaxManagerConstants +{ + + /** + * Used by android.net.wimax.WimaxManager for handling management of + * Wimax access. + */ + public static final String WIMAX_SERVICE = "WiMax"; + + /** + * Broadcast intent action indicating that Wimax has been enabled, disabled, + * enabling, disabling, or unknown. One extra provides this state as an int. + * Another extra provides the previous state, if available. + */ + public static final String NET_4G_STATE_CHANGED_ACTION = + "android.net.fourG.NET_4G_STATE_CHANGED"; + + /** + * The lookup key for an int that indicates whether Wimax is enabled, + * disabled, enabling, disabling, or unknown. + */ + public static final String EXTRA_WIMAX_STATUS = "wimax_status"; + + /** + * Broadcast intent action indicating that Wimax state has been changed + * state could be scanning, connecting, connected, disconnecting, disconnected + * initializing, initialized, unknown and ready. One extra provides this state as an int. + * Another extra provides the previous state, if available. + */ + public static final String WIMAX_NETWORK_STATE_CHANGED_ACTION = + "android.net.fourG.wimax.WIMAX_NETWORK_STATE_CHANGED"; + + /** + * Broadcast intent action indicating that Wimax signal level has been changed. + * Level varies from 0 to 3. + */ + public static final String SIGNAL_LEVEL_CHANGED_ACTION = + "android.net.wimax.SIGNAL_LEVEL_CHANGED"; + + /** + * The lookup key for an int that indicates whether Wimax state is + * scanning, connecting, connected, disconnecting, disconnected + * initializing, initialized, unknown and ready. + */ + public static final String EXTRA_WIMAX_STATE = "WimaxState"; + public static final String EXTRA_4G_STATE = "4g_state"; + public static final String EXTRA_WIMAX_STATE_INT = "WimaxStateInt"; + /** + * The lookup key for an int that indicates whether state of Wimax + * is idle. + */ + public static final String EXTRA_WIMAX_STATE_DETAIL = "WimaxStateDetail"; + + /** + * The lookup key for an int that indicates Wimax signal level. + */ + public static final String EXTRA_NEW_SIGNAL_LEVEL = "newSignalLevel"; + + /** + * Indicatates Wimax is disabled. + */ + public static final int NET_4G_STATE_DISABLED = 1; + + /** + * Indicatates Wimax is enabled. + */ + public static final int NET_4G_STATE_ENABLED = 3; + + /** + * Indicatates Wimax status is known. + */ + public static final int NET_4G_STATE_UNKNOWN = 4; + + /** + * Indicatates Wimax is in idle state. + */ + public static final int WIMAX_IDLE = 6; + + /** + * Indicatates Wimax is being deregistered. + */ + public static final int WIMAX_DEREGISTRATION = 8; + + /** + * Indicatates wimax state is unknown. + */ + public static final int WIMAX_STATE_UNKNOWN = 0; + + /** + * Indicatates wimax state is connected. + */ + public static final int WIMAX_STATE_CONNECTED = 7; + + /** + * Indicatates wimax state is disconnected. + */ + public static final int WIMAX_STATE_DISCONNECTED = 9; + +} diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index a0652f7..769776e 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1183,6 +1183,10 @@ public final class Settings { public static final String RADIO_WIFI = "wifi"; /** + * {@hide} + */ + public static final String RADIO_WIMAX = "wimax"; + /** * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio. */ public static final String RADIO_CELL = "cell"; @@ -2899,6 +2903,11 @@ public final class Settings { */ public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on"; + /** + * {@hide} + */ + public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON = + "wimax_networks_available_notification_on"; /** * Delay (in seconds) before repeating the Wi-Fi networks available notification. @@ -4068,6 +4077,13 @@ public final class Settings { "contacts_preauth_uri_expiration"; /** + * Whether the Messaging app posts notifications. + * 0=disabled. 1=enabled. + */ + public static final String MESSAGING_APP_NOTIFICATIONS = "messaging_app_notifications"; + + + /** * This are the settings to be backed up. * * NOTE: Settings are backed up and restored in the order they appear @@ -4104,7 +4120,8 @@ public final class Settings { MOUNT_UMS_NOTIFY_ENABLED, UI_NIGHT_MODE, LOCK_SCREEN_OWNER_INFO, - LOCK_SCREEN_OWNER_INFO_ENABLED + LOCK_SCREEN_OWNER_INFO_ENABLED, + MESSAGING_APP_NOTIFICATIONS }; /** diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 0e6d07d..8eb9da1 100755 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -1838,5 +1838,15 @@ public final class Telephony { public static final String EXTRA_PLMN = "plmn"; public static final String EXTRA_SHOW_SPN = "showSpn"; public static final String EXTRA_SPN = "spn"; + + /** + * Activity Action: Shows a dialog to turn off Messaging app notification. + * <p>Input: Nothing. + * <p>Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_MESSAGING_APP_NOTIFICATIONS = + "android.provider.Telephony.MESSAGING_APP_NOTIFICATIONS"; + } } diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 954a6fe..fdc2570 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -1089,6 +1089,7 @@ public class TextToSpeech { // Copy feature strings defined by the framework. copyStringParam(bundle, params, Engine.KEY_FEATURE_NETWORK_SYNTHESIS); + copyStringParam(bundle, params, Engine.KEY_FEATURE_EMBEDDED_SYNTHESIS); // Copy over all parameters that start with the name of the // engine that we are currently connected to. The engine is diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java index 245271d..83b6d4c 100644 --- a/core/java/android/speech/tts/TextToSpeechService.java +++ b/core/java/android/speech/tts/TextToSpeechService.java @@ -792,8 +792,13 @@ public abstract class TextToSpeechService extends Service { public String[] getFeaturesForLanguage(String lang, String country, String variant) { Set<String> features = onGetFeaturesForLanguage(lang, country, variant); - String[] featuresArray = new String[features.size()]; - features.toArray(featuresArray); + String[] featuresArray = null; + if (features != null) { + featuresArray = new String[features.size()]; + features.toArray(featuresArray); + } else { + featuresArray = new String[0]; + } return featuresArray; } diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java index 2cc928f..388920c 100644 --- a/core/java/android/webkit/BrowserFrame.java +++ b/core/java/android/webkit/BrowserFrame.java @@ -813,8 +813,6 @@ class BrowserFrame extends Handler { boolean synchronous, String username, String password) { - PerfChecker checker = new PerfChecker(); - if (mSettings.getCacheMode() != WebSettings.LOAD_DEFAULT) { cacheMode = mSettings.getCacheMode(); } @@ -872,11 +870,6 @@ class BrowserFrame extends Handler { || headers.containsKey("If-None-Match") ? WebSettings.LOAD_NO_CACHE : cacheMode); // Set referrer to current URL? - if (!loader.executeLoad()) { - checker.responseAlert("startLoadingResource fail"); - } - checker.responseAlert("startLoadingResource succeed"); - return !synchronous ? loadListener : null; } diff --git a/core/java/android/webkit/JWebCoreJavaBridge.java b/core/java/android/webkit/JWebCoreJavaBridge.java index 5b78586..b498435 100644 --- a/core/java/android/webkit/JWebCoreJavaBridge.java +++ b/core/java/android/webkit/JWebCoreJavaBridge.java @@ -87,11 +87,9 @@ final class JWebCoreJavaBridge extends Handler { * Call native timer callbacks. */ private void fireSharedTimer() { - PerfChecker checker = new PerfChecker(); // clear the flag so that sharedTimerFired() can set a new timer mHasInstantTimer = false; sharedTimerFired(); - checker.responseAlert("sharedTimer"); } /** diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java index 04af738..37e8bc0 100644 --- a/core/java/android/webkit/LoadListener.java +++ b/core/java/android/webkit/LoadListener.java @@ -1136,7 +1136,6 @@ class LoadListener extends Handler implements EventHandler { // Give the data to WebKit now. We don't have to synchronize on // mDataBuilder here because pulling each chunk removes it from the // internal list so it cannot be modified. - PerfChecker checker = new PerfChecker(); ByteArrayBuilder.Chunk c; while (true) { c = mDataBuilder.getFirstChunk(); @@ -1152,7 +1151,6 @@ class LoadListener extends Handler implements EventHandler { } else { c.release(); } - checker.responseAlert("res nativeAddData"); } } @@ -1173,13 +1171,11 @@ class LoadListener extends Handler implements EventHandler { WebViewWorker.MSG_REMOVE_CACHE, this).sendToTarget(); } if (mNativeLoader != 0) { - PerfChecker checker = new PerfChecker(); if (!mSetNativeResponse) { setNativeResponse(); } nativeFinished(); - checker.responseAlert("res nativeFinished"); clearNativeLoader(); } } diff --git a/core/java/android/webkit/PerfChecker.java b/core/java/android/webkit/PerfChecker.java deleted file mode 100644 index 8c5f86e..0000000 --- a/core/java/android/webkit/PerfChecker.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.webkit; - -import android.os.SystemClock; -import android.util.Log; - -class PerfChecker { - - private long mTime; - private static final long mResponseThreshold = 2000; // 2s - - public PerfChecker() { - if (false) { - mTime = SystemClock.uptimeMillis(); - } - } - - /** - * @param what log string - * Logs given string if mResponseThreshold time passed between either - * instantiation or previous responseAlert call - */ - public void responseAlert(String what) { - if (false) { - long upTime = SystemClock.uptimeMillis(); - long time = upTime - mTime; - if (time > mResponseThreshold) { - Log.w("webkit", what + " used " + time + " ms"); - } - // Reset mTime, to permit reuse - mTime = upTime; - } - } -} diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index f0dc732..55f345f 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -683,7 +683,6 @@ public class WebView extends AbsoluteLayout private static final int SWITCH_TO_LONGPRESS = 4; private static final int RELEASE_SINGLE_TAP = 5; private static final int REQUEST_FORM_DATA = 6; - private static final int RESUME_WEBCORE_PRIORITY = 7; private static final int DRAG_HELD_MOTIONLESS = 8; private static final int AWAKEN_SCROLL_BARS = 9; private static final int PREVENT_DEFAULT_TIMEOUT = 10; @@ -2850,46 +2849,47 @@ public class WebView extends AbsoluteLayout // Used to avoid sending many visible rect messages. private Rect mLastVisibleRectSent; private Rect mLastGlobalRect; + private Rect mVisibleRect = new Rect(); + private Rect mGlobalVisibleRect = new Rect(); + private Point mScrollOffset = new Point(); Rect sendOurVisibleRect() { if (mZoomManager.isPreventingWebkitUpdates()) return mLastVisibleRectSent; - Rect rect = new Rect(); - calcOurContentVisibleRect(rect); + calcOurContentVisibleRect(mVisibleRect); // Rect.equals() checks for null input. - if (!rect.equals(mLastVisibleRectSent)) { + if (!mVisibleRect.equals(mLastVisibleRectSent)) { if (!mBlockWebkitViewMessages) { - Point pos = new Point(rect.left, rect.top); + mScrollOffset.set(mVisibleRect.left, mVisibleRect.top); mWebViewCore.removeMessages(EventHub.SET_SCROLL_OFFSET); mWebViewCore.sendMessage(EventHub.SET_SCROLL_OFFSET, - nativeMoveGeneration(), mSendScrollEvent ? 1 : 0, pos); + nativeMoveGeneration(), mSendScrollEvent ? 1 : 0, mScrollOffset); } - mLastVisibleRectSent = rect; + mLastVisibleRectSent = mVisibleRect; mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS); } - Rect globalRect = new Rect(); - if (getGlobalVisibleRect(globalRect) - && !globalRect.equals(mLastGlobalRect)) { + if (getGlobalVisibleRect(mGlobalVisibleRect) + && !mGlobalVisibleRect.equals(mLastGlobalRect)) { if (DebugFlags.WEB_VIEW) { - Log.v(LOGTAG, "sendOurVisibleRect=(" + globalRect.left + "," - + globalRect.top + ",r=" + globalRect.right + ",b=" - + globalRect.bottom); + Log.v(LOGTAG, "sendOurVisibleRect=(" + mGlobalVisibleRect.left + "," + + mGlobalVisibleRect.top + ",r=" + mGlobalVisibleRect.right + ",b=" + + mGlobalVisibleRect.bottom); } // TODO: the global offset is only used by windowRect() // in ChromeClientAndroid ; other clients such as touch // and mouse events could return view + screen relative points. if (!mBlockWebkitViewMessages) { - mWebViewCore.sendMessage(EventHub.SET_GLOBAL_BOUNDS, globalRect); + mWebViewCore.sendMessage(EventHub.SET_GLOBAL_BOUNDS, mGlobalVisibleRect); } - mLastGlobalRect = globalRect; + mLastGlobalRect = mGlobalVisibleRect; } - return rect; + return mVisibleRect; } + private Point mGlobalVisibleOffset = new Point(); // Sets r to be the visible rectangle of our webview in view coordinates private void calcOurVisibleRect(Rect r) { - Point p = new Point(); - getGlobalVisibleRect(r, p); - r.offset(-p.x, -p.y); + getGlobalVisibleRect(r, mGlobalVisibleOffset); + r.offset(-mGlobalVisibleOffset.x, -mGlobalVisibleOffset.y); } // Sets r to be our visible rectangle in content coordinates @@ -2905,21 +2905,21 @@ public class WebView extends AbsoluteLayout r.bottom = viewToContentY(r.bottom); } + private Rect mContentVisibleRect = new Rect(); // Sets r to be our visible rectangle in content coordinates. We use this // method on the native side to compute the position of the fixed layers. // Uses floating coordinates (necessary to correctly place elements when // the scale factor is not 1) private void calcOurContentVisibleRectF(RectF r) { - Rect ri = new Rect(0,0,0,0); - calcOurVisibleRect(ri); - r.left = viewToContentXf(ri.left); + calcOurVisibleRect(mContentVisibleRect); + r.left = viewToContentXf(mContentVisibleRect.left); // viewToContentY will remove the total height of the title bar. Add // the visible height back in to account for the fact that if the title // bar is partially visible, the part of the visible rect which is // displaying our content is displaced by that amount. - r.top = viewToContentYf(ri.top + getVisibleTitleHeightImpl()); - r.right = viewToContentXf(ri.right); - r.bottom = viewToContentYf(ri.bottom); + r.top = viewToContentYf(mContentVisibleRect.top + getVisibleTitleHeightImpl()); + r.right = viewToContentXf(mContentVisibleRect.right); + r.bottom = viewToContentYf(mContentVisibleRect.bottom); } static class ViewSizeData { @@ -3569,7 +3569,6 @@ public class WebView extends AbsoluteLayout mScrollingLayerRect.top = y; } abortAnimation(); - mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY); nativeSetIsScrolling(false); if (!mBlockWebkitViewMessages) { WebViewCore.resumePriority(); @@ -5992,7 +5991,6 @@ public class WebView extends AbsoluteLayout mScroller.abortAnimation(); mTouchMode = TOUCH_DRAG_START_MODE; mConfirmMove = true; - mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY); nativeSetIsScrolling(false); } else if (mPrivateHandler.hasMessages(RELEASE_SINGLE_TAP)) { mPrivateHandler.removeMessages(RELEASE_SINGLE_TAP); @@ -7329,7 +7327,6 @@ public class WebView extends AbsoluteLayout mLastTouchTime = eventTime; if (!mScroller.isFinished()) { abortAnimation(); - mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY); } mSnapScrollMode = SNAP_NONE; mVelocityTracker = VelocityTracker.obtain(); @@ -8461,10 +8458,6 @@ public class WebView extends AbsoluteLayout mWebTextView.setAdapterCustom(adapter); } break; - case RESUME_WEBCORE_PRIORITY: - WebViewCore.resumePriority(); - WebViewCore.resumeUpdatePicture(mWebViewCore); - break; case LONG_PRESS_CENTER: // as this is shared by keydown and trackballdown, reset all diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java index 27d44bf..ec3790e 100644 --- a/core/java/android/widget/Spinner.java +++ b/core/java/android/widget/Spinner.java @@ -68,6 +68,7 @@ public class Spinner extends AbsSpinner implements OnClickListener { int mDropDownWidth; private int mGravity; + private boolean mDisableChildrenWhenDisabled; private Rect mTempRect = new Rect(); @@ -186,6 +187,9 @@ public class Spinner extends AbsSpinner implements OnClickListener { mPopup.setPromptText(a.getString(com.android.internal.R.styleable.Spinner_prompt)); + mDisableChildrenWhenDisabled = a.getBoolean( + com.android.internal.R.styleable.Spinner_disableChildrenWhenDisabled, false); + a.recycle(); // Base constructor can call setAdapter before we initialize mPopup. @@ -196,6 +200,17 @@ public class Spinner extends AbsSpinner implements OnClickListener { } } + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + if (mDisableChildrenWhenDisabled) { + final int count = getChildCount(); + for (int i = 0; i < count; i++) { + getChildAt(i).setEnabled(enabled); + } + } + } + /** * Describes how the selected item view is positioned. Currently only the horizontal component * is used. The default is determined by the current theme. @@ -398,6 +413,9 @@ public class Spinner extends AbsSpinner implements OnClickListener { addViewInLayout(child, 0, lp); child.setSelected(hasFocus()); + if (mDisableChildrenWhenDisabled) { + child.setEnabled(isEnabled()); + } // Get measure specs int childHeightSpec = ViewGroup.getChildMeasureSpec(mHeightMeasureSpec, diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index a8680d4..5833afd 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -9059,51 +9059,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener sendAccessibilityEventUnchecked(event); } - @Override - protected void onCreateContextMenu(ContextMenu menu) { - super.onCreateContextMenu(menu); - boolean added = false; - mContextMenuTriggeredByKey = mDPadCenterIsDown || mEnterKeyIsDown; - // Problem with context menu on long press: the menu appears while the key in down and when - // the key is released, the view does not receive the key_up event. - // We need two layers of flags: mDPadCenterIsDown and mEnterKeyIsDown are set in key down/up - // events. We cannot simply clear these flags in onTextContextMenuItem since - // it may not be called (if the user/ discards the context menu with the back key). - // We clear these flags here and mContextMenuTriggeredByKey saves that state so that it is - // available in onTextContextMenuItem. - mDPadCenterIsDown = mEnterKeyIsDown = false; - - MenuHandler handler = new MenuHandler(); - - if (mText instanceof Spanned && hasSelectionController()) { - long lastTouchOffset = getLastTouchOffsets(); - final int selStart = extractRangeStartFromLong(lastTouchOffset); - final int selEnd = extractRangeEndFromLong(lastTouchOffset); - - URLSpan[] urls = ((Spanned) mText).getSpans(selStart, selEnd, URLSpan.class); - if (urls.length > 0) { - menu.add(0, ID_COPY_URL, 0, com.android.internal.R.string.copyUrl). - setOnMenuItemClickListener(handler); - - added = true; - } - } - - // The context menu is not empty, which will prevent the selection mode from starting. - // Add a entry to start it in the context menu. - // TODO Does not handle the case where a subclass does not call super.thisMethod or - // populates the menu AFTER this call. - if (menu.size() > 0) { - menu.add(0, ID_SELECTION_MODE, 0, com.android.internal.R.string.selectTextMode). - setOnMenuItemClickListener(handler); - added = true; - } - - if (added) { - menu.setHeaderTitle(com.android.internal.R.string.editTextMenuTitle); - } - } - /** * Returns whether this text view is a current input method target. The * default implementation just checks with {@link InputMethodManager}. @@ -9118,9 +9073,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private static final int ID_CUT = android.R.id.cut; private static final int ID_COPY = android.R.id.copy; private static final int ID_PASTE = android.R.id.paste; - // Context menu entries - private static final int ID_COPY_URL = android.R.id.copyUrl; - private static final int ID_SELECTION_MODE = android.R.id.selectTextMode; private class MenuHandler implements MenuItem.OnMenuItemClickListener { public boolean onMenuItemClick(MenuItem item) { @@ -9130,9 +9082,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener /** * Called when a context menu option for the text view is selected. Currently - * this will be {@link android.R.id#copyUrl}, {@link android.R.id#selectTextMode}, - * {@link android.R.id#selectAll}, {@link android.R.id#paste}, {@link android.R.id#cut} - * or {@link android.R.id#copy}. + * this will be one of {@link android.R.id#selectAll}, {@link android.R.id#cut}, + * {@link android.R.id#copy} or {@link android.R.id#paste}. * * @return true if the context menu item action was performed. */ @@ -9149,34 +9100,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } switch (id) { - case ID_COPY_URL: - URLSpan[] urls = ((Spanned) mText).getSpans(min, max, URLSpan.class); - if (urls.length >= 1) { - ClipData clip = null; - for (int i=0; i<urls.length; i++) { - Uri uri = Uri.parse(urls[0].getURL()); - if (clip == null) { - clip = ClipData.newRawUri(null, uri); - } else { - clip.addItem(new ClipData.Item(uri)); - } - } - if (clip != null) { - setPrimaryClip(clip); - } - } - stopSelectionActionMode(); - return true; - - case ID_SELECTION_MODE: - if (mSelectionActionMode != null) { - // Selection mode is already started, simply change selected part. - selectCurrentWord(); - } else { - startSelectionActionMode(); - } - return true; - case ID_SELECT_ALL: // This does not enter text selection mode. Text is highlighted, so that it can be // bulk edited, like selectAllOnFocus does. Returns true even if text is empty. diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index d5450e4..17b8acf 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -439,17 +439,6 @@ public class LockPatternUtils { } /** - * Calls back SetupFaceLock to save the temporary gallery file if this is the backup lock. - * This doesn't have to verify that biometric is enabled because it's only called in that case - */ - void moveTempGallery() { - Intent intent = new Intent().setClassName("com.android.facelock", - "com.android.facelock.SetupFaceLock"); - intent.putExtra("moveTempGallery", true); - mContext.startActivity(intent); - } - - /** * Calls back SetupFaceLock to delete the temporary gallery file */ public void deleteTempGallery() { @@ -501,8 +490,7 @@ public class LockPatternUtils { setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK); setLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); - setBoolean(BIOMETRIC_WEAK_EVER_CHOSEN_KEY, true); - moveTempGallery(); + finishBiometricWeak(); } dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, pattern .size(), 0, 0, 0, 0, 0, 0); @@ -619,8 +607,7 @@ public class LockPatternUtils { } else { setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK); setLong(PASSWORD_TYPE_ALTERNATE_KEY, Math.max(quality, computedQuality)); - setBoolean(BIOMETRIC_WEAK_EVER_CHOSEN_KEY, true); - moveTempGallery(); + finishBiometricWeak(); } if (computedQuality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) { int letters = 0; @@ -1087,4 +1074,16 @@ public class LockPatternUtils { } return false; } + + private void finishBiometricWeak() { + setBoolean(BIOMETRIC_WEAK_EVER_CHOSEN_KEY, true); + + // Launch intent to show final screen, this also + // moves the temporary gallery to the actual gallery + Intent intent = new Intent(); + intent.setClassName("com.android.facelock", + "com.android.facelock.SetupEndScreen"); + mContext.startActivity(intent); + } + } |