diff options
Diffstat (limited to 'packages')
27 files changed, 278 insertions, 249 deletions
diff --git a/packages/DocumentsUI/res/layout-sw720dp/activity.xml b/packages/DocumentsUI/res/layout-sw720dp/activity.xml index a9f1b3c..2a273f4 100644 --- a/packages/DocumentsUI/res/layout-sw720dp/activity.xml +++ b/packages/DocumentsUI/res/layout-sw720dp/activity.xml @@ -19,7 +19,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - <Toolbar + <com.android.documentsui.DocumentsToolBar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?android:attr/actionBarSize" @@ -34,7 +34,7 @@ android:layout_marginStart="4dp" android:overlapAnchor="true" /> - </Toolbar> + </com.android.documentsui.DocumentsToolBar> <LinearLayout android:layout_width="match_parent" diff --git a/packages/DocumentsUI/res/layout/activity.xml b/packages/DocumentsUI/res/layout/activity.xml index b549cd3..43fdaf2 100644 --- a/packages/DocumentsUI/res/layout/activity.xml +++ b/packages/DocumentsUI/res/layout/activity.xml @@ -24,7 +24,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - <Toolbar + <com.android.documentsui.DocumentsToolBar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?android:attr/actionBarSize" @@ -39,7 +39,7 @@ android:layout_marginStart="4dp" android:overlapAnchor="true" /> - </Toolbar> + </com.android.documentsui.DocumentsToolBar> <com.android.documentsui.DirectoryContainerView android:id="@+id/container_directory" diff --git a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java index 8ea5816..bba33be 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java +++ b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java @@ -101,7 +101,7 @@ abstract class BaseActivity extends Activity { boolean showMenu = super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.activity, menu); - mSearchManager.install(menu.findItem(R.id.menu_search)); + mSearchManager.install((DocumentsToolBar) findViewById(R.id.toolbar)); return showMenu; } @@ -666,20 +666,24 @@ abstract class BaseActivity extends Activity { * Facade over the various search parts in the menu. */ final class SearchManager implements - SearchView.OnCloseListener, OnActionExpandListener, OnQueryTextListener { + SearchView.OnCloseListener, OnActionExpandListener, OnQueryTextListener, + DocumentsToolBar.OnActionViewCollapsedListener { private boolean mSearchExpanded; private boolean mIgnoreNextClose; private boolean mIgnoreNextCollapse; + private DocumentsToolBar mActionBar; private MenuItem mMenu; private SearchView mView; - public void install(MenuItem menu) { - assert(mMenu == null); - mMenu = menu; - mView = (SearchView) menu.getActionView(); + public void install(DocumentsToolBar actionBar) { + assert(mActionBar == null); + mActionBar = actionBar; + mMenu = actionBar.getSearchMenu(); + mView = (SearchView) mMenu.getActionView(); + mActionBar.setOnActionViewCollapsedListener(this); mMenu.setOnActionExpandListener(this); mView.setOnQueryTextListener(this); mView.setOnCloseListener(this); @@ -730,6 +734,19 @@ abstract class BaseActivity extends Activity { } } + /** + * Cancels current search operation. + * @return True if it cancels search. False if it does not operate + * search currently. + */ + boolean cancelSearch() { + if (mActionBar.hasExpandedActionView()) { + mActionBar.collapseActionView(); + return true; + } + return false; + } + boolean isSearching() { return getDisplayState().currentSearch != null; } @@ -765,7 +782,6 @@ abstract class BaseActivity extends Activity { mIgnoreNextCollapse = false; return true; } - getDisplayState().currentSearch = null; onCurrentDirectoryChanged(ANIM_NONE); return true; @@ -784,5 +800,10 @@ abstract class BaseActivity extends Activity { public boolean onQueryTextChange(String newText) { return false; } + + @Override + public void onActionViewCollapsed() { + updateActionBar(); + } } } diff --git a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java index 69ae34e..90ccf91 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import android.app.ActionBar; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; @@ -508,6 +509,11 @@ public class DocumentsActivity extends BaseActivity { @Override public void onBackPressed() { + // While action bar is expanded, the state stack UI is hidden. + if (mSearchManager.cancelSearch()) { + return; + } + if (!mState.stackTouched) { super.onBackPressed(); return; diff --git a/packages/DocumentsUI/src/com/android/documentsui/DocumentsToolBar.java b/packages/DocumentsUI/src/com/android/documentsui/DocumentsToolBar.java new file mode 100644 index 0000000..36b7646 --- /dev/null +++ b/packages/DocumentsUI/src/com/android/documentsui/DocumentsToolBar.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2015 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.documentsui; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MenuItem; +import android.widget.Toolbar; + +/** + * ToolBar of Documents UI. + */ +public class DocumentsToolBar extends Toolbar { + interface OnActionViewCollapsedListener { + void onActionViewCollapsed(); + } + + private OnActionViewCollapsedListener mOnActionViewCollapsedListener; + + public DocumentsToolBar(Context context, AttributeSet attrs, + int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + public DocumentsToolBar(Context context, AttributeSet attrs, + int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public DocumentsToolBar(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public DocumentsToolBar(Context context) { + super(context); + } + + @Override + public void collapseActionView() { + super.collapseActionView(); + if (mOnActionViewCollapsedListener != null) { + mOnActionViewCollapsedListener.onActionViewCollapsed(); + } + } + + /** + * Adds a listener that is invoked after collapsing the action view. + * @param listener + */ + public void setOnActionViewCollapsedListener( + OnActionViewCollapsedListener listener) { + mOnActionViewCollapsedListener = listener; + } + + public MenuItem getSearchMenu() { + return getMenu().findItem(R.id.menu_search); + } +} diff --git a/packages/Keyguard/res/values/strings.xml b/packages/Keyguard/res/values/strings.xml index 49ce427..748129c 100644 --- a/packages/Keyguard/res/values/strings.xml +++ b/packages/Keyguard/res/values/strings.xml @@ -299,6 +299,42 @@ <!-- Description of airplane mode --> <string name="airplane_mode">Airplane mode</string> + <!-- An explanation text that the pattern needs to be solved since the device has just been restarted. [CHAR LIMIT=80] --> + <string name="kg_prompt_reason_restart_pattern">Pattern required when you restart device.</string> + + <!-- An explanation text that the pin needs to be entered since the device has just been restarted. [CHAR LIMIT=80] --> + <string name="kg_prompt_reason_restart_pin">PIN required when you restart device.</string> + + <!-- An explanation text that the password needs to be entered since the device has just been restarted. [CHAR LIMIT=80] --> + <string name="kg_prompt_reason_restart_password">Password required when you restart device.</string> + + <!-- An explanation text that the pattern needs to be solved since profiles have just been switched. [CHAR LIMIT=80] --> + <string name="kg_prompt_reason_switch_profiles_pattern">Pattern required when you switch profiles.</string> + + <!-- An explanation text that the pin needs to be entered since profiles have just been switched. [CHAR LIMIT=80] --> + <string name="kg_prompt_reason_switch_profiles_pin">PIN required when you switch profiles.</string> + + <!-- An explanation text that the password needs to be entered since profiles have just been switched. [CHAR LIMIT=80] --> + <string name="kg_prompt_reason_switch_profiles_password">Password required when you switch profiles.</string> + + <!-- An explanation text that the pattern needs to be solved since it hasn't been solved in a while. [CHAR LIMIT=80]--> + <plurals name="kg_prompt_reason_time_pattern"> + <item quantity="one">Device hasn\'t been unlocked for <xliff:g id="number">%d</xliff:g> hour. Confirm pattern.</item> + <item quantity="other">Device hasn\'t been unlocked for <xliff:g id="number">%d</xliff:g> hours. Confirm pattern.</item> + </plurals> + + <!-- An explanation text that the pin needs to be entered since it hasn't been entered in a while. [CHAR LIMIT=80]--> + <plurals name="kg_prompt_reason_time_pin"> + <item quantity="one">Device hasn\'t been unlocked for <xliff:g id="number">%d</xliff:g> hour. Confirm PIN.</item> + <item quantity="other">Device hasn\'t been unlocked for <xliff:g id="number">%d</xliff:g> hours. Confirm PIN.</item> + </plurals> + + <!-- An explanation text that the password needs to be entered since it hasn't been entered in a while. [CHAR LIMIT=80]--> + <plurals name="kg_prompt_reason_time_password"> + <item quantity="one">Device hasn\'t been unlocked for <xliff:g id="number">%d</xliff:g> hour. Confirm password.</item> + <item quantity="other">Device hasn\'t been unlocked for <xliff:g id="number">%d</xliff:g> hours. Confirm password.</item> + </plurals> + <!-- Fingerprint hint message when finger was not recognized.--> <string name="fingerprint_not_recognized">Not recognized</string> diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java index ed0d4af..23834a3 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java @@ -150,13 +150,6 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView // Set selected property on so the view can send accessibility events. mPasswordEntry.setSelected(true); - // Poke the wakelock any time the text is selected or modified - mPasswordEntry.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - onUserInput(); - } - }); - mPasswordEntry.setUserActivityListener(new PasswordTextView.UserActivityListener() { @Override public void onUserActivity() { diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java index 4ba04e5..3c5dae3 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java @@ -679,6 +679,8 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat if (resolvedActivities.get(0).activityInfo.exported) { intent.putExtra(PrintService.EXTRA_PRINT_JOB_INFO, mPrintJob); intent.putExtra(PrintService.EXTRA_PRINTER_INFO, printer); + intent.putExtra(PrintService.EXTRA_PRINT_JOB_INFO, + mPrintedDocument.getDocumentInfo().info); // This is external activity and may not be there. try { diff --git a/packages/StatementService/src/com/android/statementservice/retriever/AbstractStatementRetriever.java b/packages/StatementService/src/com/android/statementservice/retriever/AbstractStatementRetriever.java index 3b59fd6..fe9b99a 100644 --- a/packages/StatementService/src/com/android/statementservice/retriever/AbstractStatementRetriever.java +++ b/packages/StatementService/src/com/android/statementservice/retriever/AbstractStatementRetriever.java @@ -90,7 +90,7 @@ public abstract class AbstractStatementRetriever { * Creates a new StatementRetriever that directly retrieves statements from the asset. * * <p> For web assets, {@link AbstractStatementRetriever} will try to retrieve the statement - * file from URL: {@code [webAsset.site]/.well-known/statements.json"} where {@code + * file from URL: {@code [webAsset.site]/.well-known/assetlinks.json"} where {@code * [webAsset.site]} is in the form {@code http{s}://[hostname]:[optional_port]}. The file * should contain one JSON array of statements. * diff --git a/packages/StatementService/src/com/android/statementservice/retriever/DirectStatementRetriever.java b/packages/StatementService/src/com/android/statementservice/retriever/DirectStatementRetriever.java index 2ca85e9..e4feb90 100644 --- a/packages/StatementService/src/com/android/statementservice/retriever/DirectStatementRetriever.java +++ b/packages/StatementService/src/com/android/statementservice/retriever/DirectStatementRetriever.java @@ -38,7 +38,7 @@ import java.util.List; private static final int HTTP_CONNECTION_TIMEOUT_MILLIS = 5000; private static final long HTTP_CONTENT_SIZE_LIMIT_IN_BYTES = 1024 * 1024; private static final int MAX_INCLUDE_LEVEL = 1; - private static final String WELL_KNOWN_STATEMENT_PATH = "/.well-known/statements.json"; + private static final String WELL_KNOWN_STATEMENT_PATH = "/.well-known/assetlinks.json"; private final URLFetcher mUrlFetcher; private final AndroidPackageInfoFetcher mAndroidFetcher; diff --git a/packages/StatementService/src/com/android/statementservice/retriever/Statement.java b/packages/StatementService/src/com/android/statementservice/retriever/Statement.java index da3c355..0f40a62 100644 --- a/packages/StatementService/src/com/android/statementservice/retriever/Statement.java +++ b/packages/StatementService/src/com/android/statementservice/retriever/Statement.java @@ -21,7 +21,7 @@ import android.annotation.NonNull; /** * An immutable value type representing a statement, consisting of a source, target, and relation. * This reflects an assertion that the relation holds for the source, target pair. For example, if a - * web site has the following in its statements.json file: + * web site has the following in its assetlinks.json file: * * <pre> * { diff --git a/packages/StatementService/src/com/android/statementservice/retriever/URLFetcher.java b/packages/StatementService/src/com/android/statementservice/retriever/URLFetcher.java index 969aa88..225e26c 100644 --- a/packages/StatementService/src/com/android/statementservice/retriever/URLFetcher.java +++ b/packages/StatementService/src/com/android/statementservice/retriever/URLFetcher.java @@ -60,33 +60,36 @@ public class URLFetcher { throw new IllegalArgumentException("The url protocol should be on http or https."); } - HttpURLConnection connection; - connection = (HttpURLConnection) url.openConnection(); - connection.setInstanceFollowRedirects(true); - connection.setConnectTimeout(connectionTimeoutMillis); - connection.setReadTimeout(connectionTimeoutMillis); - connection.setUseCaches(true); - connection.setInstanceFollowRedirects(false); - connection.addRequestProperty("Cache-Control", "max-stale=60"); - - if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { - Log.e(TAG, "The responses code is not 200 but " + connection.getResponseCode()); - return new WebContent("", DO_NOT_CACHE_RESULT); - } + HttpURLConnection connection = null; + try { + connection = (HttpURLConnection) url.openConnection(); + connection.setInstanceFollowRedirects(true); + connection.setConnectTimeout(connectionTimeoutMillis); + connection.setReadTimeout(connectionTimeoutMillis); + connection.setUseCaches(true); + connection.setInstanceFollowRedirects(false); + connection.addRequestProperty("Cache-Control", "max-stale=60"); + + if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { + Log.e(TAG, "The responses code is not 200 but " + connection.getResponseCode()); + return new WebContent("", DO_NOT_CACHE_RESULT); + } - if (connection.getContentLength() > fileSizeLimit) { - Log.e(TAG, "The content size of the url is larger than " + fileSizeLimit); - return new WebContent("", DO_NOT_CACHE_RESULT); - } + if (connection.getContentLength() > fileSizeLimit) { + Log.e(TAG, "The content size of the url is larger than " + fileSizeLimit); + return new WebContent("", DO_NOT_CACHE_RESULT); + } - Long expireTimeMillis = getExpirationTimeMillisFromHTTPHeader(connection.getHeaderFields()); + Long expireTimeMillis = getExpirationTimeMillisFromHTTPHeader( + connection.getHeaderFields()); - try { return new WebContent(inputStreamToString( connection.getInputStream(), connection.getContentLength(), fileSizeLimit), expireTimeMillis); } finally { - connection.disconnect(); + if (connection != null) { + connection.disconnect(); + } } } diff --git a/packages/SystemUI/res/drawable/managed_profile_toast_background.xml b/packages/SystemUI/res/drawable/managed_profile_toast_background.xml new file mode 100644 index 0000000..5c77b9a --- /dev/null +++ b/packages/SystemUI/res/drawable/managed_profile_toast_background.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2015 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. +--> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <corners android:radius="2dp" /> + <solid android:color="@color/managed_profile_toast_background" /> +</shape> diff --git a/packages/SystemUI/res/drawable/stat_sys_managed_profile_status.xml b/packages/SystemUI/res/drawable/stat_sys_managed_profile_status.xml index 3c4c646..2bfa39d 100644 --- a/packages/SystemUI/res/drawable/stat_sys_managed_profile_status.xml +++ b/packages/SystemUI/res/drawable/stat_sys_managed_profile_status.xml @@ -20,10 +20,10 @@ Copyright (C) 2015 The Android Open Source Project android:viewportHeight="17.0"> <group android:translateX="2.0"> <path - android:fillColor="#FF000000" + android:fillColor="@android:color/white" android:pathData="M9.9,11.6H7v-1.1H2.1v2.8c0,0.8,0.6,1.4,1.4,1.4h9.9c0.8,0,1.4,-0.6,1.4,-1.4v-2.8H9.9V11.6z"/> <path - android:fillColor="#FF000000" + android:fillColor="@android:color/white" android:pathData="M14.1,4.2h-2.5V3.2l-1.1,-1.1H6.3L5.3,3.2v1H2.8C2,4.2,1.4,4.9,1.4,5.6v2.8c0,0.8,0.6,1.4,1.4,1.4H7V8.8h2.8v1.1h4.2 c0.8,0,1.4,-0.6,1.4,-1.4V5.6C15.5,4.9,14.8,4.2,14.1,4.2z M10.6,4.2H6.3V3.2h4.2V4.2z"/> </group> </vector> diff --git a/packages/SystemUI/res/layout/managed_profile_toast.xml b/packages/SystemUI/res/layout/managed_profile_toast.xml new file mode 100644 index 0000000..5a01ca7 --- /dev/null +++ b/packages/SystemUI/res/layout/managed_profile_toast.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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. +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingLeft="32dp" + android:paddingRight="32dp" + android:background="@drawable/managed_profile_toast_background"> + <ImageView + android:layout_width="32dp" + android:layout_height="32dp" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="16dp" + android:src="@drawable/stat_sys_managed_profile_status"/> + <TextView android:text="@string/managed_profile_foreground_toast" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@android:color/white" + android:textSize="14sp" + android:layout_gravity="center_horizontal" /> +</LinearLayout> diff --git a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml index a996260..38ea6e1 100644 --- a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml +++ b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml @@ -35,6 +35,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="1" + android:contentDescription="@string/accessibility_brightness" systemui:text="@string/status_bar_settings_auto_brightness_label" /> </LinearLayout> diff --git a/packages/SystemUI/res/layout/status_bar_toggle_slider.xml b/packages/SystemUI/res/layout/status_bar_toggle_slider.xml index a5bf68e..062e6cb 100644 --- a/packages/SystemUI/res/layout/status_bar_toggle_slider.xml +++ b/packages/SystemUI/res/layout/status_bar_toggle_slider.xml @@ -45,7 +45,6 @@ android:paddingBottom="16dp" android:thumb="@drawable/ic_brightness_thumb" android:splitTrack="false" - android:contentDescription="@string/accessibility_brightness" /> <TextView android:id="@+id/label" diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 0dcbe88..9a96939 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -143,4 +143,6 @@ <color name="volume_icon_color">#ffffffff</color> <color name="volume_settings_icon_color">#7fffffff</color> <color name="volume_slider_inactive">#FFB0BEC5</color><!-- blue grey 200 --> + + <color name="managed_profile_toast_background">#E5000000</color><!-- 90% black --> </resources> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index a2a2e5f..a0b70f0 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1012,7 +1012,7 @@ <string name="volumeui_notification_text">Touch to restore the original.</string> <!-- Toast shown when user unlocks screen and managed profile activity is in the foreground --> - <string name="managed_profile_foreground_toast">You are in the work profile</string> + <string name="managed_profile_foreground_toast">You\'re using your work profile</string> <string-array name="volume_stream_titles" translatable="false"> <item>Voice calls</item> <!-- STREAM_VOICE_CALL --> diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 3e122da..1e7ee98 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -116,7 +116,6 @@ public class AssistManager { | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); WindowManager.LayoutParams lp = getLayoutParams(); mWindowManager.addView(mView, lp); - mBar.getNavigationBarView().setDelegateView(mView); if (visible) { mView.show(true /* show */, false /* animate */); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java index 7c378f0..915867b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java @@ -73,6 +73,10 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> { : mController.isRotationLocked(); final boolean userInitiated = arg != null ? ((UserBoolean) arg).userInitiated : false; state.visible = mController.isRotationLockAffordanceVisible(); + if (state.value == rotationLocked) { + // No change, no need to update all the values. + return; + } state.value = rotationLocked; final boolean portrait = mContext.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE; diff --git a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java index 8abfe03..cdb8e69 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java +++ b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java @@ -74,6 +74,8 @@ public class ToggleSlider extends RelativeLayout { mLabel = (TextView) findViewById(R.id.label); mLabel.setText(a.getString(R.styleable.ToggleSlider_text)); + setLabelFor(R.id.slider); // use our a11y text to annotate, not replace, the slider's + a.recycle(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index ef8c5db..85b4a64 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -65,6 +65,7 @@ import android.util.Slog; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.view.Display; +import android.view.Gravity; import android.view.IWindowManager; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -395,8 +396,14 @@ public abstract class BaseStatusBar extends SystemUI implements if (recentTask != null && recentTask.size() > 0) { UserInfo user = mUserManager.getUserInfo(recentTask.get(0).userId); if (user != null && user.isManagedProfile()) { - Toast.makeText(mContext, R.string.managed_profile_foreground_toast, - Toast.LENGTH_SHORT).show(); + LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + View layout = inflater.inflate(R.layout.managed_profile_toast, null); + Toast toast = new Toast(mContext); + toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); + toast.setDuration(Toast.LENGTH_SHORT); + toast.setView(layout); + toast.show(); } } } else if (BANNER_ACTION_CANCEL.equals(action) || BANNER_ACTION_SETUP.equals(action)) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java deleted file mode 100644 index 2dc521e..0000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2010 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.systemui.statusbar; - -import android.app.StatusBarManager; -import android.content.res.Resources; -import android.graphics.RectF; -import android.view.MotionEvent; -import android.view.View; -import com.android.systemui.R; -import com.android.systemui.statusbar.phone.PhoneStatusBar; - -public class DelegateViewHelper { - private View mDelegateView; - private View mSourceView; - private PhoneStatusBar mBar; - private int[] mTempPoint = new int[2]; - private float[] mDownPoint = new float[2]; - private float mTriggerThreshhold; - private boolean mPanelShowing; - - RectF mInitialTouch = new RectF(); - private boolean mStarted; - private boolean mSwapXY = false; - private boolean mDisabled; - - public DelegateViewHelper(View sourceView) { - setSourceView(sourceView); - } - - public void setDelegateView(View view) { - mDelegateView = view; - } - - public void setBar(PhoneStatusBar phoneStatusBar) { - mBar = phoneStatusBar; - } - - public boolean onInterceptTouchEvent(MotionEvent event) { - if (mSourceView == null || mDelegateView == null || mBar.shouldDisableNavbarGestures()) { - return false; - } - - mSourceView.getLocationOnScreen(mTempPoint); - final float sourceX = mTempPoint[0]; - final float sourceY = mTempPoint[1]; - - final int action = event.getAction(); - switch (action) { - case MotionEvent.ACTION_DOWN: - mPanelShowing = mDelegateView.getVisibility() == View.VISIBLE; - mDownPoint[0] = event.getX(); - mDownPoint[1] = event.getY(); - mStarted = mInitialTouch.contains(mDownPoint[0] + sourceX, mDownPoint[1] + sourceY); - break; - } - - if (!mStarted) { - return false; - } - - if (!mDisabled && !mPanelShowing && action == MotionEvent.ACTION_MOVE) { - final int historySize = event.getHistorySize(); - for (int k = 0; k < historySize + 1; k++) { - float x = k < historySize ? event.getHistoricalX(k) : event.getX(); - float y = k < historySize ? event.getHistoricalY(k) : event.getY(); - final float distance = mSwapXY ? (mDownPoint[0] - x) : (mDownPoint[1] - y); - if (distance > mTriggerThreshhold) { - mBar.invokeAssistGesture(false /* vibrate */); - mPanelShowing = true; - break; - } - } - } - - if (action == MotionEvent.ACTION_DOWN) { - mBar.setInteracting(StatusBarManager.WINDOW_NAVIGATION_BAR, true); - } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { - mBar.setInteracting(StatusBarManager.WINDOW_NAVIGATION_BAR, false); - } - - mDelegateView.getLocationOnScreen(mTempPoint); - final float delegateX = mTempPoint[0]; - final float delegateY = mTempPoint[1]; - - float deltaX = sourceX - delegateX; - float deltaY = sourceY - delegateY; - event.offsetLocation(deltaX, deltaY); - mDelegateView.dispatchTouchEvent(event); - event.offsetLocation(-deltaX, -deltaY); - return mPanelShowing; - } - - public void abortCurrentGesture() { - if (mStarted) { - mStarted = false; - mBar.setInteracting(StatusBarManager.WINDOW_NAVIGATION_BAR, false); - } - } - - public void setSourceView(View view) { - mSourceView = view; - if (mSourceView != null) { - Resources r = mSourceView.getContext().getResources(); - mTriggerThreshhold = r.getDimensionPixelSize(R.dimen.navigation_bar_min_swipe_distance); - } - } - - /** - * Selects the initial touch region based on a list of views. This is meant to be called by - * a container widget on children over which the initial touch should be detected. Note this - * will compute a minimum bound that contains all specified views. - * - * @param views - */ - public void setInitialTouchRegion(View ... views) { - RectF bounds = new RectF(); - int p[] = new int[2]; - for (int i = 0; i < views.length; i++) { - View view = views[i]; - if (view == null) continue; - view.getLocationOnScreen(p); - if (i == 0) { - bounds.set(p[0], p[1], p[0] + view.getWidth(), p[1] + view.getHeight()); - } else { - bounds.union(p[0], p[1], p[0] + view.getWidth(), p[1] + view.getHeight()); - } - } - mInitialTouch.set(bounds); - } - - /** - * When rotation is set to NO_SENSOR, then this allows swapping x/y for gesture detection - * @param swap - */ - public void setSwapXY(boolean swap) { - mSwapXY = swap; - } - - public void setDisabled(boolean disabled) { - mDisabled = disabled; - } -}
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 8c03350..296538c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -134,6 +134,14 @@ public abstract class ExpandableView extends FrameLayout { } @Override + public boolean dispatchGenericMotionEvent(MotionEvent ev) { + if (filterMotionEvent(ev)) { + return super.dispatchGenericMotionEvent(ev); + } + return false; + } + + @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (filterMotionEvent(ev)) { return super.dispatchTouchEvent(ev); @@ -143,6 +151,8 @@ public abstract class ExpandableView extends FrameLayout { protected boolean filterMotionEvent(MotionEvent event) { return event.getActionMasked() != MotionEvent.ACTION_DOWN + && event.getActionMasked() != MotionEvent.ACTION_HOVER_ENTER + && event.getActionMasked() != MotionEvent.ACTION_HOVER_MOVE || event.getY() > mClipTopAmount && event.getY() < mActualHeight; } @@ -340,6 +350,13 @@ public abstract class ExpandableView extends FrameLayout { outRect.top += getTranslationY() + getClipTopAmount(); } + @Override + public void getBoundsOnScreen(Rect outRect, boolean clipToParent) { + super.getBoundsOnScreen(outRect, clipToParent); + outRect.bottom = (int) (outRect.top + getActualHeight()); + outRect.top += getClipTopAmount(); + } + public int getContentHeight() { return mActualHeight - getBottomDecorHeight(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 636c511..f40f501 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -47,7 +47,6 @@ import android.widget.ImageView; import android.widget.LinearLayout; import com.android.systemui.R; -import com.android.systemui.statusbar.DelegateViewHelper; import com.android.systemui.statusbar.policy.DeadZone; import com.android.systemui.statusbar.policy.KeyButtonView; @@ -79,7 +78,6 @@ public class NavigationBarView extends LinearLayout { private Drawable mRecentLandIcon; private NavigationBarViewTaskSwitchHelper mTaskSwitchHelper; - private DelegateViewHelper mDelegateHelper; private DeadZone mDeadZone; private final NavigationBarTransitions mBarTransitions; @@ -92,7 +90,6 @@ public class NavigationBarView extends LinearLayout { private OnVerticalChangedListener mOnVerticalChangedListener; private boolean mIsLayoutRtl; - private boolean mDelegateIntercepted; private class NavTransitionListener implements TransitionListener { private boolean mBackTransitioning; @@ -180,7 +177,6 @@ public class NavigationBarView extends LinearLayout { mBarSize = res.getDimensionPixelSize(R.dimen.navigation_bar_size); mVertical = false; mShowMenu = false; - mDelegateHelper = new DelegateViewHelper(this); mTaskSwitchHelper = new NavigationBarViewTaskSwitchHelper(context); getIcons(res); @@ -192,13 +188,8 @@ public class NavigationBarView extends LinearLayout { return mBarTransitions; } - public void setDelegateView(View view) { - mDelegateHelper.setDelegateView(view); - } - public void setBar(PhoneStatusBar phoneStatusBar) { mTaskSwitchHelper.setBar(phoneStatusBar); - mDelegateHelper.setBar(phoneStatusBar); } public void setOnVerticalChangedListener(OnVerticalChangedListener onVerticalChangedListener) { @@ -208,44 +199,21 @@ public class NavigationBarView extends LinearLayout { @Override public boolean onTouchEvent(MotionEvent event) { - initDownStates(event); - if (!mDelegateIntercepted && mTaskSwitchHelper.onTouchEvent(event)) { + if (mTaskSwitchHelper.onTouchEvent(event)) { return true; } if (mDeadZone != null && event.getAction() == MotionEvent.ACTION_OUTSIDE) { mDeadZone.poke(event); } - if (mDelegateHelper != null && mDelegateIntercepted) { - boolean ret = mDelegateHelper.onInterceptTouchEvent(event); - if (ret) return true; - } return super.onTouchEvent(event); } - private void initDownStates(MotionEvent ev) { - if (ev.getAction() == MotionEvent.ACTION_DOWN) { - mDelegateIntercepted = false; - } - } - @Override public boolean onInterceptTouchEvent(MotionEvent event) { - initDownStates(event); - boolean intercept = mTaskSwitchHelper.onInterceptTouchEvent(event); - if (!intercept) { - mDelegateIntercepted = mDelegateHelper.onInterceptTouchEvent(event); - intercept = mDelegateIntercepted; - } else { - MotionEvent cancelEvent = MotionEvent.obtain(event); - cancelEvent.setAction(MotionEvent.ACTION_CANCEL); - mDelegateHelper.onInterceptTouchEvent(cancelEvent); - cancelEvent.recycle(); - } - return intercept; + return mTaskSwitchHelper.onInterceptTouchEvent(event); } public void abortCurrentGesture() { - mDelegateHelper.abortCurrentGesture(); getHomeButton().abortCurrentGesture(); } @@ -461,10 +429,6 @@ public class NavigationBarView extends LinearLayout { Log.d(TAG, "reorient(): rot=" + mDisplay.getRotation()); } - // swap to x coordinate if orientation is not in vertical - if (mDelegateHelper != null) { - mDelegateHelper.setSwapXY(mVertical); - } updateTaskSwitchHelper(); setNavigationIconHints(mNavigationIconHints, true); @@ -476,12 +440,6 @@ public class NavigationBarView extends LinearLayout { } @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - super.onLayout(changed, l, t, r, b); - mDelegateHelper.setInitialTouchRegion(getHomeButton(), getBackButton(), getRecentsButton()); - } - - @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { if (DEBUG) Log.d(TAG, String.format( "onSizeChanged: (%dx%d) old: (%dx%d)", w, h, oldw, oldh)); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index 7f1fea1..634270c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -83,6 +83,10 @@ public class StatusBarWindowView extends FrameLayout { insets.top = 0; insets.right = 0; } else { + if (mRightInset != 0) { + mRightInset = 0; + applyMargins(); + } boolean changed = getPaddingLeft() != 0 || getPaddingRight() != 0 || getPaddingTop() != 0 |