summaryrefslogtreecommitdiffstats
path: root/core/java/com/android/internal
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-02-13 14:24:59 +0000
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-02-15 00:30:09 +0000
commit4815d6e5a658bb1b301f7724c8e8fff6bc764bba (patch)
tree66f6e6484d239545197d73bcca8ad2505246c981 /core/java/com/android/internal
parenteaa7d1835c8691dd656fea99ae3d61b039ebe1b7 (diff)
parent763ef60466ac752a3031719fb86b08486c9946b1 (diff)
downloadframeworks_base-4815d6e5a658bb1b301f7724c8e8fff6bc764bba.zip
frameworks_base-4815d6e5a658bb1b301f7724c8e8fff6bc764bba.tar.gz
frameworks_base-4815d6e5a658bb1b301f7724c8e8fff6bc764bba.tar.bz2
Merge commit 'android-4.2.2_r1' into mr1.1-staging
Conflicts: core/java/android/os/Trace.java core/java/android/widget/Toast.java core/res/res/values-cs/strings.xml core/res/res/values-el/strings.xml core/res/res/values-iw/strings.xml core/res/res/values/config.xml core/res/res/values/symbols.xml media/java/android/media/AudioService.java packages/SystemUI/res/values-sv/strings.xml packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java policy/src/com/android/internal/policy/impl/keyguard/KeyguardMessageArea.java policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java services/java/com/android/server/NotificationManagerService.java services/java/com/android/server/power/ElectronBeam.java Change-Id: I60b8ddf20a1d7bcf9dc7b1a4ed841aaa4d953294
Diffstat (limited to 'core/java/com/android/internal')
-rw-r--r--core/java/com/android/internal/annotations/GuardedBy.java32
-rw-r--r--core/java/com/android/internal/annotations/Immutable.java30
-rw-r--r--core/java/com/android/internal/annotations/VisibleForTesting.java50
-rw-r--r--core/java/com/android/internal/app/ActionBarImpl.java5
-rw-r--r--core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java25
-rw-r--r--core/java/com/android/internal/appwidget/IAppWidgetService.aidl10
-rw-r--r--core/java/com/android/internal/content/PackageHelper.java2
-rw-r--r--core/java/com/android/internal/net/NetworkStatsFactory.java3
-rw-r--r--core/java/com/android/internal/util/LocalLog.java66
-rw-r--r--core/java/com/android/internal/widget/ActionBarView.java193
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java13
11 files changed, 334 insertions, 95 deletions
diff --git a/core/java/com/android/internal/annotations/GuardedBy.java b/core/java/com/android/internal/annotations/GuardedBy.java
new file mode 100644
index 0000000..fc61945
--- /dev/null
+++ b/core/java/com/android/internal/annotations/GuardedBy.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2012 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 com.android.internal.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation type used to mark a method or field that can only be accessed when
+ * holding the referenced lock.
+ */
+@Target({ ElementType.FIELD, ElementType.METHOD })
+@Retention(RetentionPolicy.CLASS)
+public @interface GuardedBy {
+ String value();
+}
diff --git a/core/java/com/android/internal/annotations/Immutable.java b/core/java/com/android/internal/annotations/Immutable.java
new file mode 100644
index 0000000..b424275
--- /dev/null
+++ b/core/java/com/android/internal/annotations/Immutable.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2012 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 com.android.internal.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation type used to mark a class which is immutable.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.CLASS)
+public @interface Immutable {
+}
diff --git a/core/java/com/android/internal/annotations/VisibleForTesting.java b/core/java/com/android/internal/annotations/VisibleForTesting.java
new file mode 100644
index 0000000..bc3121c
--- /dev/null
+++ b/core/java/com/android/internal/annotations/VisibleForTesting.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 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 com.android.internal.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Denotes that the class, method or field has its visibility relaxed so
+ * that unit tests can access it.
+ * <p/>
+ * The <code>visibility</code> argument can be used to specific what the original
+ * visibility should have been if it had not been made public or package-private for testing.
+ * The default is to consider the element private.
+ */
+@Retention(RetentionPolicy.SOURCE)
+public @interface VisibleForTesting {
+ /**
+ * Intended visibility if the element had not been made public or package-private for
+ * testing.
+ */
+ enum Visibility {
+ /** The element should be considered protected. */
+ PROTECTED,
+ /** The element should be considered package-private. */
+ PACKAGE,
+ /** The element should be considered private. */
+ PRIVATE
+ }
+
+ /**
+ * Intended visibility if the element had not been made public or package-private for testing.
+ * If not specified, one should assume the element originally intended to be private.
+ */
+ Visibility visibility() default Visibility.PRIVATE;
+}
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index 46478ca..f041f07 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -801,6 +801,11 @@ public class ActionBarImpl extends ActionBar {
return mThemedContext;
}
+ @Override
+ public boolean isTitleTruncated() {
+ return mActionView != null && mActionView.isTitleTruncated();
+ }
+
/**
* @hide
*/
diff --git a/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java b/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java
index 386f387..2bc80ff 100644
--- a/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java
+++ b/core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java
@@ -136,13 +136,14 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
if (mRouter == null) return;
final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes);
- mVolumeIcon.setImageResource(
+ mVolumeIcon.setImageResource(selectedRoute == null ||
selectedRoute.getPlaybackType() == RouteInfo.PLAYBACK_TYPE_LOCAL ?
R.drawable.ic_audio_vol : R.drawable.ic_media_route_on_holo_dark);
mIgnoreSliderVolumeChanges = true;
- if (selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_FIXED) {
+ if (selectedRoute == null ||
+ selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_FIXED) {
// Disable the slider and show it at max volume.
mVolumeSlider.setMax(1);
mVolumeSlider.setProgress(1);
@@ -160,7 +161,8 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
if (mIgnoreSliderVolumeChanges) return;
final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes);
- if (selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_VARIABLE) {
+ if (selectedRoute != null &&
+ selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_VARIABLE) {
final int maxVolume = selectedRoute.getVolumeMax();
newValue = Math.max(0, Math.min(newValue, maxVolume));
selectedRoute.requestSetVolume(newValue);
@@ -652,14 +654,19 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN && mVolumeSlider.isEnabled()) {
- mRouter.getSelectedRoute(mRouteTypes).requestUpdateVolume(-1);
- return true;
+ final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes);
+ if (selectedRoute != null) {
+ selectedRoute.requestUpdateVolume(-1);
+ return true;
+ }
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && mVolumeSlider.isEnabled()) {
- mRouter.getSelectedRoute(mRouteTypes).requestUpdateVolume(1);
- return true;
- } else {
- return super.onKeyDown(keyCode, event);
+ final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes);
+ if (selectedRoute != null) {
+ mRouter.getSelectedRoute(mRouteTypes).requestUpdateVolume(1);
+ return true;
+ }
}
+ return super.onKeyDown(keyCode, event);
}
public boolean onKeyUp(int keyCode, KeyEvent event) {
diff --git a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl
index cfb16fa..e685e63 100644
--- a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl
+++ b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl
@@ -32,12 +32,16 @@ interface IAppWidgetService {
//
int[] startListening(IAppWidgetHost host, String packageName, int hostId,
out List<RemoteViews> updatedViews);
+ int[] startListeningAsUser(IAppWidgetHost host, String packageName, int hostId,
+ out List<RemoteViews> updatedViews, int userId);
void stopListening(int hostId);
+ void stopListeningAsUser(int hostId, int userId);
int allocateAppWidgetId(String packageName, int hostId);
void deleteAppWidgetId(int appWidgetId);
void deleteHost(int hostId);
void deleteAllHosts();
RemoteViews getAppWidgetViews(int appWidgetId);
+ int[] getAppWidgetIdsForHost(int hostId);
//
// for AppWidgetManager
@@ -48,15 +52,15 @@ interface IAppWidgetService {
void partiallyUpdateAppWidgetIds(in int[] appWidgetIds, in RemoteViews views);
void updateAppWidgetProvider(in ComponentName provider, in RemoteViews views);
void notifyAppWidgetViewDataChanged(in int[] appWidgetIds, int viewId);
- List<AppWidgetProviderInfo> getInstalledProviders();
+ List<AppWidgetProviderInfo> getInstalledProviders(int categoryFilter);
AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId);
boolean hasBindAppWidgetPermission(in String packageName);
void setBindAppWidgetPermission(in String packageName, in boolean permission);
void bindAppWidgetId(int appWidgetId, in ComponentName provider, in Bundle options);
boolean bindAppWidgetIdIfAllowed(
in String packageName, int appWidgetId, in ComponentName provider, in Bundle options);
- void bindRemoteViewsService(int appWidgetId, in Intent intent, in IBinder connection);
- void unbindRemoteViewsService(int appWidgetId, in Intent intent);
+ void bindRemoteViewsService(int appWidgetId, in Intent intent, in IBinder connection, int userId);
+ void unbindRemoteViewsService(int appWidgetId, in Intent intent, int userId);
int[] getAppWidgetIds(in ComponentName provider);
}
diff --git a/core/java/com/android/internal/content/PackageHelper.java b/core/java/com/android/internal/content/PackageHelper.java
index c5e7d9d..1a4835b 100644
--- a/core/java/com/android/internal/content/PackageHelper.java
+++ b/core/java/com/android/internal/content/PackageHelper.java
@@ -51,7 +51,7 @@ public class PackageHelper {
public static final int RECOMMEND_FAILED_INVALID_URI = -6;
public static final int RECOMMEND_FAILED_VERSION_DOWNGRADE = -7;
- private static final boolean localLOGV = true;
+ private static final boolean localLOGV = false;
private static final String TAG = "PackageHelper";
// App installation location settings values
public static final int APP_INSTALL_AUTO = 0;
diff --git a/core/java/com/android/internal/net/NetworkStatsFactory.java b/core/java/com/android/internal/net/NetworkStatsFactory.java
index 8b222f0..c517a68 100644
--- a/core/java/com/android/internal/net/NetworkStatsFactory.java
+++ b/core/java/com/android/internal/net/NetworkStatsFactory.java
@@ -25,6 +25,7 @@ import android.net.NetworkStats;
import android.os.StrictMode;
import android.os.SystemClock;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ProcFileReader;
import java.io.File;
@@ -53,7 +54,7 @@ public class NetworkStatsFactory {
this(new File("/proc/"));
}
- // @VisibleForTesting
+ @VisibleForTesting
public NetworkStatsFactory(File procRoot) {
mStatsXtIfaceAll = new File(procRoot, "net/xt_qtaguid/iface_stat_all");
mStatsXtIfaceFmt = new File(procRoot, "net/xt_qtaguid/iface_stat_fmt");
diff --git a/core/java/com/android/internal/util/LocalLog.java b/core/java/com/android/internal/util/LocalLog.java
new file mode 100644
index 0000000..f0e6171
--- /dev/null
+++ b/core/java/com/android/internal/util/LocalLog.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 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 com.android.internal.util;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+import android.util.Slog;
+
+/**
+ * Helper class for logging serious issues, which also keeps a small
+ * snapshot of the logged events that can be printed later, such as part
+ * of a system service's dumpsys output.
+ * @hide
+ */
+public class LocalLog {
+ private final String mTag;
+ private final int mMaxLines = 20;
+ private final ArrayList<String> mLines = new ArrayList<String>(mMaxLines);
+
+ public LocalLog(String tag) {
+ mTag = tag;
+ }
+
+ public void w(String msg) {
+ synchronized (mLines) {
+ Slog.w(mTag, msg);
+ if (mLines.size() >= mMaxLines) {
+ mLines.remove(0);
+ }
+ mLines.add(msg);
+ }
+ }
+
+ public boolean dump(PrintWriter pw, String header, String prefix) {
+ synchronized (mLines) {
+ if (mLines.size() <= 0) {
+ return false;
+ }
+ if (header != null) {
+ pw.println(header);
+ }
+ for (int i=0; i<mLines.size(); i++) {
+ if (prefix != null) {
+ pw.print(prefix);
+ }
+ pw.println(mLines.get(i));
+ }
+ return true;
+ }
+ }
+}
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 6fb459c..0f964b9 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -40,6 +40,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
+import android.text.Layout;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -49,7 +50,6 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
-import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
@@ -83,7 +83,8 @@ public class ActionBarView extends AbsActionBarView {
ActionBar.DISPLAY_USE_LOGO |
ActionBar.DISPLAY_HOME_AS_UP |
ActionBar.DISPLAY_SHOW_CUSTOM |
- ActionBar.DISPLAY_SHOW_TITLE;
+ ActionBar.DISPLAY_SHOW_TITLE |
+ ActionBar.DISPLAY_TITLE_MULTIPLE_LINES;
private static final int DEFAULT_CUSTOM_GRAVITY = Gravity.START | Gravity.CENTER_VERTICAL;
@@ -100,6 +101,7 @@ public class ActionBarView extends AbsActionBarView {
private TextView mTitleView;
private TextView mSubtitleView;
private View mTitleUpView;
+ private ViewGroup mUpGoerFive;
private Spinner mSpinner;
private LinearLayout mListNavLayout;
@@ -120,6 +122,7 @@ public class ActionBarView extends AbsActionBarView {
private boolean mIncludeTabs;
private boolean mIsCollapsable;
private boolean mIsCollapsed;
+ private boolean mWasHomeEnabled; // Was it enabled before action view expansion?
private MenuBuilder mOptionsMenu;
@@ -137,10 +140,6 @@ public class ActionBarView extends AbsActionBarView {
Window.Callback mWindowCallback;
- private final Rect mTempRect = new Rect();
- private int mMaxHomeSlop;
- private static final int MAX_HOME_SLOP = 32; // dp
-
private final AdapterView.OnItemSelectedListener mNavItemSelectedListener =
new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView parent, View view, int position, long id) {
@@ -219,14 +218,25 @@ public class ActionBarView extends AbsActionBarView {
com.android.internal.R.styleable.ActionBar_homeLayout,
com.android.internal.R.layout.action_bar_home);
- mHomeLayout = (HomeView) inflater.inflate(homeResId, this, false);
+ mUpGoerFive = (ViewGroup) inflater.inflate(
+ com.android.internal.R.layout.action_bar_up_container, this, false);
+ mHomeLayout = (HomeView) inflater.inflate(homeResId, mUpGoerFive, false);
- mExpandedHomeLayout = (HomeView) inflater.inflate(homeResId, this, false);
+ mExpandedHomeLayout = (HomeView) inflater.inflate(homeResId, mUpGoerFive, false);
mExpandedHomeLayout.setUp(true);
mExpandedHomeLayout.setOnClickListener(mExpandedActionViewUpListener);
mExpandedHomeLayout.setContentDescription(getResources().getText(
R.string.action_bar_up_description));
+ // This needs to highlight/be focusable on its own.
+ // TODO: Clean up the handoff between expanded/normal.
+ final Drawable upBackground = mUpGoerFive.getBackground();
+ if (upBackground != null) {
+ mExpandedHomeLayout.setBackground(upBackground.getConstantState().newDrawable());
+ }
+ mExpandedHomeLayout.setEnabled(true);
+ mExpandedHomeLayout.setFocusable(true);
+
mTitleStyleRes = a.getResourceId(R.styleable.ActionBar_titleTextStyle, 0);
mSubtitleStyleRes = a.getResourceId(R.styleable.ActionBar_subtitleTextStyle, 0);
mProgressStyle = a.getResourceId(R.styleable.ActionBar_progressBarStyle, 0);
@@ -250,16 +260,14 @@ public class ActionBarView extends AbsActionBarView {
a.recycle();
mLogoNavItem = new ActionMenuItem(context, 0, android.R.id.home, 0, 0, mTitle);
- mHomeLayout.setOnClickListener(mUpClickListener);
- mHomeLayout.setClickable(true);
- mHomeLayout.setFocusable(true);
+
+ mUpGoerFive.setOnClickListener(mUpClickListener);
+ mUpGoerFive.setClickable(true);
+ mUpGoerFive.setFocusable(true);
if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
-
- mMaxHomeSlop =
- (int) (MAX_HOME_SLOP * context.getResources().getDisplayMetrics().density + 0.5f);
}
@Override
@@ -269,8 +277,8 @@ public class ActionBarView extends AbsActionBarView {
mTitleView = null;
mSubtitleView = null;
mTitleUpView = null;
- if (mTitleLayout != null && mTitleLayout.getParent() == this) {
- removeView(mTitleLayout);
+ if (mTitleLayout != null && mTitleLayout.getParent() == mUpGoerFive) {
+ mUpGoerFive.removeView(mTitleLayout);
}
mTitleLayout = null;
if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
@@ -551,19 +559,34 @@ public class ActionBarView extends AbsActionBarView {
}
public void setHomeButtonEnabled(boolean enable) {
- mHomeLayout.setEnabled(enable);
- mHomeLayout.setFocusable(enable);
+ setHomeButtonEnabled(enable, true);
+ }
+
+ private void setHomeButtonEnabled(boolean enable, boolean recordState) {
+ if (recordState) {
+ mWasHomeEnabled = enable;
+ }
+
+ if (mExpandedActionView != null) {
+ // There's an action view currently showing and we want to keep the state
+ // configured for the action view at the moment. If we needed to record the
+ // new state for later we will have done so above.
+ return;
+ }
+
+ mUpGoerFive.setEnabled(enable);
+ mUpGoerFive.setFocusable(enable);
// Make sure the home button has an accurate content description for accessibility.
if (!enable) {
- mHomeLayout.setContentDescription(null);
- mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
+ mUpGoerFive.setContentDescription(null);
+ mUpGoerFive.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
} else {
- mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO);
+ mUpGoerFive.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO);
if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
- mHomeLayout.setContentDescription(mContext.getResources().getText(
+ mUpGoerFive.setContentDescription(mContext.getResources().getText(
R.string.action_bar_up_description));
} else {
- mHomeLayout.setContentDescription(mContext.getResources().getText(
+ mUpGoerFive.setContentDescription(mContext.getResources().getText(
R.string.action_bar_home_description));
}
}
@@ -600,7 +623,7 @@ public class ActionBarView extends AbsActionBarView {
if ((options & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
initTitle();
} else {
- removeView(mTitleLayout);
+ mUpGoerFive.removeView(mTitleLayout);
}
}
@@ -608,8 +631,6 @@ public class ActionBarView extends AbsActionBarView {
(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME)) != 0) {
final boolean homeAsUp = (mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0;
mTitleUpView.setVisibility(!showHome ? (homeAsUp ? VISIBLE : INVISIBLE) : GONE);
- mTitleLayout.setEnabled(!showHome && homeAsUp);
- mTitleLayout.setClickable(!showHome && homeAsUp);
}
if ((flagsChanged & ActionBar.DISPLAY_SHOW_CUSTOM) != 0 && mCustomNavView != null) {
@@ -620,6 +641,17 @@ public class ActionBarView extends AbsActionBarView {
}
}
+ if (mTitleLayout != null &&
+ (flagsChanged & ActionBar.DISPLAY_TITLE_MULTIPLE_LINES) != 0) {
+ if ((options & ActionBar.DISPLAY_TITLE_MULTIPLE_LINES) != 0) {
+ mTitleView.setSingleLine(false);
+ mTitleView.setMaxLines(2);
+ } else {
+ mTitleView.setMaxLines(1);
+ mTitleView.setSingleLine(true);
+ }
+ }
+
requestLayout();
} else {
invalidate();
@@ -753,7 +785,8 @@ public class ActionBarView extends AbsActionBarView {
protected void onFinishInflate() {
super.onFinishInflate();
- addView(mHomeLayout);
+ mUpGoerFive.addView(mHomeLayout, 0);
+ addView(mUpGoerFive);
if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
final ViewParent parent = mCustomNavView.getParent();
@@ -775,8 +808,6 @@ public class ActionBarView extends AbsActionBarView {
mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_subtitle);
mTitleUpView = (View) mTitleLayout.findViewById(R.id.up);
- mTitleLayout.setOnClickListener(mUpClickListener);
-
if (mTitleStyleRes != 0) {
mTitleView.setTextAppearance(mContext, mTitleStyleRes);
}
@@ -796,11 +827,9 @@ public class ActionBarView extends AbsActionBarView {
final boolean showHome = (mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0;
final boolean showTitleUp = !showHome;
mTitleUpView.setVisibility(showTitleUp ? (homeAsUp ? VISIBLE : INVISIBLE) : GONE);
- mTitleLayout.setEnabled(homeAsUp && showTitleUp);
- mTitleLayout.setClickable(homeAsUp && showTitleUp);
}
- addView(mTitleLayout);
+ mUpGoerFive.addView(mTitleLayout);
if (mExpandedActionView != null ||
(TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle))) {
// Don't show while in expanded mode or with empty text
@@ -820,6 +849,28 @@ public class ActionBarView extends AbsActionBarView {
return mIsCollapsed;
}
+ /**
+ * @return True if any characters in the title were truncated
+ */
+ public boolean isTitleTruncated() {
+ if (mTitleView == null) {
+ return false;
+ }
+
+ final Layout titleLayout = mTitleView.getLayout();
+ if (titleLayout == null) {
+ return false;
+ }
+
+ final int lineCount = titleLayout.getLineCount();
+ for (int i = 0; i < lineCount; i++) {
+ if (titleLayout.getEllipsisCount(i) > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int childCount = getChildCount();
@@ -828,7 +879,16 @@ public class ActionBarView extends AbsActionBarView {
for (int i = 0; i < childCount; i++) {
final View child = getChildAt(i);
if (child.getVisibility() != GONE &&
- !(child == mMenuView && mMenuView.getChildCount() == 0)) {
+ !(child == mMenuView && mMenuView.getChildCount() == 0) &&
+ child != mUpGoerFive) {
+ visibleChildren++;
+ }
+ }
+
+ final int upChildCount = mUpGoerFive.getChildCount();
+ for (int i = 0; i < upChildCount; i++) {
+ final View child = mUpGoerFive.getChildAt(i);
+ if (child.getVisibility() != GONE) {
visibleChildren++;
}
}
@@ -872,7 +932,8 @@ public class ActionBarView extends AbsActionBarView {
HomeView homeLayout = mExpandedActionView != null ? mExpandedHomeLayout : mHomeLayout;
- if (homeLayout.getVisibility() != GONE) {
+ int homeWidth = 0;
+ if (homeLayout.getVisibility() != GONE && homeLayout.getParent() == mUpGoerFive) {
final ViewGroup.LayoutParams lp = homeLayout.getLayoutParams();
int homeWidthSpec;
if (lp.width < 0) {
@@ -880,10 +941,18 @@ public class ActionBarView extends AbsActionBarView {
} else {
homeWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
}
+
+ /*
+ * This is a little weird.
+ * We're only measuring the *home* affordance within the Up container here
+ * on purpose, because we want to give the available space to all other views before
+ * the title text. We'll remeasure the whole up container again later.
+ */
homeLayout.measure(homeWidthSpec, exactHeightSpec);
- final int homeWidth = homeLayout.getMeasuredWidth() + homeLayout.getStartOffset();
- availableWidth = Math.max(0, availableWidth - homeWidth);
- leftOfCenter = Math.max(0, availableWidth - homeWidth);
+ homeWidth = homeLayout.getMeasuredWidth();
+ final int homeOffsetWidth = homeWidth + homeLayout.getStartOffset();
+ availableWidth = Math.max(0, availableWidth - homeOffsetWidth);
+ leftOfCenter = Math.max(0, availableWidth - homeOffsetWidth);
}
if (mMenuView != null && mMenuView.getParent() == this) {
@@ -985,9 +1054,13 @@ public class ActionBarView extends AbsActionBarView {
availableWidth -= horizontalMargin + customView.getMeasuredWidth();
}
- if (mExpandedActionView == null && showTitle) {
- availableWidth = measureChildView(mTitleLayout, availableWidth,
- MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.EXACTLY), 0);
+ /*
+ * Measure the whole up container now, allowing for the full home+title sections.
+ * (This will re-measure the home view.)
+ */
+ availableWidth = measureChildView(mUpGoerFive, availableWidth + homeWidth,
+ MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.EXACTLY), 0);
+ if (mTitleLayout != null) {
leftOfCenter = Math.max(0, leftOfCenter - mTitleLayout.getMeasuredWidth());
}
@@ -1034,24 +1107,17 @@ public class ActionBarView extends AbsActionBarView {
final int y = getPaddingTop();
HomeView homeLayout = mExpandedActionView != null ? mExpandedHomeLayout : mHomeLayout;
- boolean needsTouchDelegate = false;
- int homeSlop = mMaxHomeSlop;
- int homeRight = 0;
- if (homeLayout.getVisibility() != GONE) {
- final int startOffset = homeLayout.getStartOffset();
- x += positionChild(homeLayout,
- next(x, startOffset, isLayoutRtl), y, contentHeight, isLayoutRtl);
- x = next(x, startOffset, isLayoutRtl);
- needsTouchDelegate = homeLayout == mHomeLayout;
- homeRight = x;
- }
+ final int startOffset = homeLayout.getVisibility() != GONE &&
+ homeLayout.getParent() == mUpGoerFive ? homeLayout.getStartOffset() : 0;
+
+ // Position the up container based on where the edge of the home layout should go.
+ x += positionChild(mUpGoerFive,
+ next(x, startOffset, isLayoutRtl), y, contentHeight, isLayoutRtl);
+ x = next(x, startOffset, isLayoutRtl);
if (mExpandedActionView == null) {
final boolean showTitle = mTitleLayout != null && mTitleLayout.getVisibility() != GONE &&
(mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0;
- if (showTitle) {
- x += positionChild(mTitleLayout, x, y, contentHeight, isLayoutRtl);
- }
switch (mNavigationMode) {
case ActionBar.NAVIGATION_MODE_STANDARD:
@@ -1061,7 +1127,6 @@ public class ActionBarView extends AbsActionBarView {
if (showTitle) {
x = next(x, mItemPadding, isLayoutRtl);
}
- homeSlop = Math.min(homeSlop, Math.max(x - homeRight, 0));
x += positionChild(mListNavLayout, x, y, contentHeight, isLayoutRtl);
x = next(x, mItemPadding, isLayoutRtl);
}
@@ -1069,7 +1134,6 @@ public class ActionBarView extends AbsActionBarView {
case ActionBar.NAVIGATION_MODE_TABS:
if (mTabScrollView != null) {
if (showTitle) x = next(x, mItemPadding, isLayoutRtl);
- homeSlop = Math.min(homeSlop, Math.max(x - homeRight, 0));
x += positionChild(mTabScrollView, x, y, contentHeight, isLayoutRtl);
x = next(x, mItemPadding, isLayoutRtl);
}
@@ -1174,7 +1238,6 @@ public class ActionBarView extends AbsActionBarView {
final int customWidth = customView.getMeasuredWidth();
customView.layout(xpos, ypos, xpos + customWidth,
ypos + customView.getMeasuredHeight());
- homeSlop = Math.min(homeSlop, Math.max(xpos - homeRight, 0));
x = next(x, customWidth, isLayoutRtl);
}
@@ -1184,14 +1247,6 @@ public class ActionBarView extends AbsActionBarView {
mProgressView.layout(mProgressBarPadding, -halfProgressHeight,
mProgressBarPadding + mProgressView.getMeasuredWidth(), halfProgressHeight);
}
-
- if (needsTouchDelegate) {
- mTempRect.set(homeLayout.getLeft(), homeLayout.getTop(),
- homeLayout.getRight() + homeSlop, homeLayout.getBottom());
- setTouchDelegate(new TouchDelegate(mTempRect, homeLayout));
- } else {
- setTouchDelegate(null);
- }
}
@Override
@@ -1491,14 +1546,15 @@ public class ActionBarView extends AbsActionBarView {
if (mExpandedActionView.getParent() != ActionBarView.this) {
addView(mExpandedActionView);
}
- if (mExpandedHomeLayout.getParent() != ActionBarView.this) {
- addView(mExpandedHomeLayout);
+ if (mExpandedHomeLayout.getParent() != mUpGoerFive) {
+ mUpGoerFive.addView(mExpandedHomeLayout);
}
mHomeLayout.setVisibility(GONE);
if (mTitleLayout != null) mTitleLayout.setVisibility(GONE);
if (mTabScrollView != null) mTabScrollView.setVisibility(GONE);
if (mSpinner != null) mSpinner.setVisibility(GONE);
if (mCustomNavView != null) mCustomNavView.setVisibility(GONE);
+ setHomeButtonEnabled(false, false);
requestLayout();
item.setActionViewExpanded(true);
@@ -1518,7 +1574,7 @@ public class ActionBarView extends AbsActionBarView {
}
removeView(mExpandedActionView);
- removeView(mExpandedHomeLayout);
+ mUpGoerFive.removeView(mExpandedHomeLayout);
mExpandedActionView = null;
if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
mHomeLayout.setVisibility(VISIBLE);
@@ -1541,6 +1597,7 @@ public class ActionBarView extends AbsActionBarView {
}
mExpandedHomeLayout.setIcon(null);
mCurrentExpandedItem = null;
+ setHomeButtonEnabled(mWasHomeEnabled); // Set by expandItemActionView above
requestLayout();
item.setActionViewExpanded(false);
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 797b58f..a381ae9 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -27,7 +27,6 @@ import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Binder;
-import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -63,8 +62,6 @@ import java.util.TimeZone;
*/
public class LockPatternUtils {
- private static final String OPTION_ENABLE_FACELOCK = "enable_facelock";
-
private static final String TAG = "LockPatternUtils";
/**
@@ -130,16 +127,6 @@ public class LockPatternUtils {
public static final String KEYGUARD_SHOW_APPWIDGET = "showappwidget";
/**
- * Options used to lock the device upon user switch.
- */
- public static final Bundle USER_SWITCH_LOCK_OPTIONS = new Bundle();
-
- static {
- USER_SWITCH_LOCK_OPTIONS.putBoolean(KEYGUARD_SHOW_USER_SWITCHER, true);
- USER_SWITCH_LOCK_OPTIONS.putBoolean(KEYGUARD_SHOW_SECURITY_CHALLENGE, true);
- }
-
- /**
* The bit in LOCK_BIOMETRIC_WEAK_FLAGS to be used to indicate whether liveliness should
* be used
*/