diff options
Diffstat (limited to 'packages')
48 files changed, 561 insertions, 437 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/res/values/strings.xml b/packages/DocumentsUI/res/values/strings.xml index 9794273..943104d 100644 --- a/packages/DocumentsUI/res/values/strings.xml +++ b/packages/DocumentsUI/res/values/strings.xml @@ -45,7 +45,7 @@ <!-- Menu item title that deletes the selected documents [CHAR LIMIT=24] --> <string name="menu_delete">Delete</string> <!-- Menu item title that selects all documents in the current directory [CHAR LIMIT=24] --> - <string name="menu_select_all">Select All</string> + <string name="menu_select_all">Select all</string> <!-- Menu item title that copies the selected documents [CHAR LIMIT=24] --> <string name="menu_copy">Copy to\u2026</string> diff --git a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java index cb21131..bba33be 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java +++ b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.concurrent.Executor; @@ -32,6 +33,10 @@ import libcore.io.IoUtils; import android.app.Activity; import android.app.Fragment; import android.content.Intent; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.ProviderInfo; import android.database.Cursor; import android.net.Uri; import android.os.AsyncTask; @@ -96,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; } @@ -232,9 +237,38 @@ abstract class BaseActivity extends Activity { invalidateOptionsMenu(); } + final List<String> getExcludedAuthorities() { + List<String> authorities = new ArrayList<>(); + if (getIntent().getBooleanExtra(DocumentsContract.EXTRA_EXCLUDE_SELF, false)) { + // Exclude roots provided by the calling package. + String packageName = getCallingPackageMaybeExtra(); + try { + PackageInfo pkgInfo = getPackageManager().getPackageInfo(packageName, + PackageManager.GET_PROVIDERS); + for (ProviderInfo provider: pkgInfo.providers) { + authorities.add(provider.authority); + } + } catch (PackageManager.NameNotFoundException e) { + Log.e(mTag, "Calling package name does not resolve: " + packageName); + } + } + return authorities; + } + final String getCallingPackageMaybeExtra() { - final String extra = getIntent().getStringExtra(DocumentsContract.EXTRA_PACKAGE_NAME); - return (extra != null) ? extra : getCallingPackage(); + String callingPackage = getCallingPackage(); + // System apps can set the calling package name using an extra. + try { + ApplicationInfo info = getPackageManager().getApplicationInfo(callingPackage, 0); + if (info.isSystemApp() || info.isUpdatedSystemApp()) { + final String extra = getIntent().getStringExtra(DocumentsContract.EXTRA_PACKAGE_NAME); + if (extra != null) { + callingPackage = extra; + } + } + } finally { + return callingPackage; + } } public static BaseActivity get(Fragment fragment) { @@ -287,6 +321,9 @@ abstract class BaseActivity extends Activity { /** Currently copying file */ public List<DocumentInfo> selectedDocumentsForCopy = new ArrayList<DocumentInfo>(); + /** Name of the package that started DocsUI */ + public List<String> excludedAuthorities = new ArrayList<>(); + public static final int ACTION_OPEN = 1; public static final int ACTION_CREATE = 2; public static final int ACTION_GET_CONTENT = 3; @@ -327,6 +364,7 @@ abstract class BaseActivity extends Activity { out.writeString(currentSearch); out.writeMap(dirState); out.writeList(selectedDocumentsForCopy); + out.writeList(excludedAuthorities); } public static final Creator<State> CREATOR = new Creator<State>() { @@ -348,6 +386,7 @@ abstract class BaseActivity extends Activity { state.currentSearch = in.readString(); in.readMap(state.dirState, null); in.readList(state.selectedDocumentsForCopy, null); + in.readList(state.excludedAuthorities, null); return state; } @@ -627,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); @@ -691,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; } @@ -726,7 +782,6 @@ abstract class BaseActivity extends Activity { mIgnoreNextCollapse = false; return true; } - getDisplayState().currentSearch = null; onCurrentDirectoryChanged(ANIM_NONE); return true; @@ -745,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 da59d0e..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; @@ -256,6 +257,8 @@ public class DocumentsActivity extends BaseActivity { BaseActivity.DocumentsIntent.EXTRA_DIRECTORY_COPY, false); } + state.excludedAuthorities = getExcludedAuthorities(); + return state; } @@ -506,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/DocumentsUI/src/com/android/documentsui/RootsCache.java b/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java index 27e8f20..fbcb938 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java +++ b/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java @@ -383,6 +383,12 @@ public class RootsCache { continue; } + // Exclude roots from the calling package. + if (state.excludedAuthorities.contains(root.authority)) { + if (LOGD) Log.d(TAG, "Excluding root " + root.authority + " from calling package."); + continue; + } + matching.add(root); } return matching; diff --git a/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java b/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java index 97d8ed0..ecf4d6c 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java +++ b/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java @@ -55,7 +55,6 @@ public class RootInfo implements Durable, Parcelable { public String mimeTypes; /** Derived fields that aren't persisted */ - public String derivedPackageName; public String[] derivedMimeTypes; public int derivedIcon; @@ -75,7 +74,6 @@ public class RootInfo implements Durable, Parcelable { availableBytes = -1; mimeTypes = null; - derivedPackageName = null; derivedMimeTypes = null; derivedIcon = 0; } diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java index 7faa3ce..8c5bac1 100644 --- a/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java +++ b/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java @@ -114,6 +114,31 @@ public class RootsCacheTest extends AndroidTestCase { RootsCache.getMatchingRoots(mRoots, mState)); } + public void testExcludedAuthorities() throws Exception { + final List<RootInfo> roots = Lists.newArrayList(); + + // Set up some roots + for (int i = 0; i < 5; ++i) { + RootInfo root = new RootInfo(); + root.authority = "authority" + i; + roots.add(root); + } + // Make some allowed authorities + List<RootInfo> allowedRoots = Lists.newArrayList( + roots.get(0), roots.get(2), roots.get(4)); + // Set up the excluded authority list + for (RootInfo root: roots) { + if (!allowedRoots.contains(root)) { + mState.excludedAuthorities.add(root.authority); + } + } + mState.acceptMimes = new String[] { "*/*" }; + + assertContainsExactly( + allowedRoots, + RootsCache.getMatchingRoots(roots, mState)); + } + private static void assertContainsExactly(List<?> expected, List<?> actual) { assertEquals(expected.size(), actual.size()); for (Object o : expected) { diff --git a/packages/Keyguard/res/layout/keyguard_pattern_view.xml b/packages/Keyguard/res/layout/keyguard_pattern_view.xml index 0f5431e..09c01de 100644 --- a/packages/Keyguard/res/layout/keyguard_pattern_view.xml +++ b/packages/Keyguard/res/layout/keyguard_pattern_view.xml @@ -31,8 +31,7 @@ android:clipToPadding="false" androidprv:layout_maxWidth="@dimen/keyguard_security_width" androidprv:layout_maxHeight="@dimen/keyguard_security_height" - android:gravity="center_horizontal" - android:contentDescription="@string/keyguard_accessibility_pattern_unlock"> + android:gravity="center_horizontal"> <FrameLayout android:layout_width="match_parent" 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/KeyguardPINView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java index d0be855..ac9dc85 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java @@ -22,6 +22,9 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; +import com.android.settingslib.animation.AppearAnimationUtils; +import com.android.settingslib.animation.DisappearAnimationUtils; + /** * Displays a PIN pad for unlocking. */ @@ -115,7 +118,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { .setDuration(500) .setInterpolator(mAppearAnimationUtils.getInterpolator()) .translationY(0); - mAppearAnimationUtils.startAnimation(mViews, + mAppearAnimationUtils.startAnimation2d(mViews, new Runnable() { @Override public void run() { @@ -132,7 +135,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { .setDuration(280) .setInterpolator(mDisappearAnimationUtils.getInterpolator()) .translationY(mDisappearYTranslation); - mDisappearAnimationUtils.startAnimation(mViews, + mDisappearAnimationUtils.startAnimation2d(mViews, new Runnable() { @Override public void run() { diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java index a9b2978..1bd0bb4 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java @@ -36,6 +36,9 @@ import android.widget.LinearLayout; import com.android.internal.widget.LockPatternChecker; import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternView; +import com.android.settingslib.animation.AppearAnimationCreator; +import com.android.settingslib.animation.AppearAnimationUtils; +import com.android.settingslib.animation.DisappearAnimationUtils; import java.util.List; @@ -325,7 +328,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit .setDuration(500) .setInterpolator(mAppearAnimationUtils.getInterpolator()) .translationY(0); - mAppearAnimationUtils.startAnimation( + mAppearAnimationUtils.startAnimation2d( mLockPatternView.getCellStates(), new Runnable() { @Override @@ -353,7 +356,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit .setDuration(300) .setInterpolator(mDisappearAnimationUtils.getInterpolator()) .translationY(-mDisappearAnimationUtils.getStartTranslation()); - mDisappearAnimationUtils.startAnimation(mLockPatternView.getCellStates(), + mDisappearAnimationUtils.startAnimation2d(mLockPatternView.getCellStates(), new Runnable() { @Override public void run() { 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/SettingsLib/res/values/dimens.xml b/packages/SettingsLib/res/values/dimens.xml new file mode 100644 index 0000000..1c4b05f --- /dev/null +++ b/packages/SettingsLib/res/values/dimens.xml @@ -0,0 +1,24 @@ +<?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 + --> +<resources> + + <!-- The y translation to apply at the start in appear animations. --> + <dimen name="appear_y_translation_start">32dp</dimen> + + <!-- The translation for disappearing security views after having solved them. --> + <dimen name="disappear_y_translation">-32dp</dimen> +</resources>
\ No newline at end of file diff --git a/packages/Keyguard/src/com/android/keyguard/AppearAnimationCreator.java b/packages/SettingsLib/src/com/android/settingslib/animation/AppearAnimationCreator.java index e4706b6..8a61e4e 100644 --- a/packages/Keyguard/src/com/android/keyguard/AppearAnimationCreator.java +++ b/packages/SettingsLib/src/com/android/settingslib/animation/AppearAnimationCreator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 The Android Open Source Project + * 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. @@ -14,13 +14,13 @@ * limitations under the License */ -package com.android.keyguard; +package com.android.settingslib.animation; import android.view.animation.Interpolator; /** * An interface which can create animations when starting an appear animation with - * {@link com.android.keyguard.AppearAnimationUtils} + * {@link AppearAnimationUtils} */ public interface AppearAnimationCreator<T> { void createAnimation(T animatedObject, long delay, long duration, diff --git a/packages/Keyguard/src/com/android/keyguard/AppearAnimationUtils.java b/packages/SettingsLib/src/com/android/settingslib/animation/AppearAnimationUtils.java index 9045fe3..441474d 100644 --- a/packages/Keyguard/src/com/android/keyguard/AppearAnimationUtils.java +++ b/packages/SettingsLib/src/com/android/settingslib/animation/AppearAnimationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 The Android Open Source Project + * 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. @@ -14,13 +14,15 @@ * limitations under the License */ -package com.android.keyguard; +package com.android.settingslib.animation; import android.content.Context; import android.view.View; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; +import com.android.settingslib.R; + /** * A class to make nice appear transitions for views in a tabular layout. */ @@ -33,7 +35,7 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { private final AppearAnimationProperties mProperties = new AppearAnimationProperties(); protected final float mDelayScale; private final long mDuration; - protected boolean mScaleTranslationWithRow; + protected RowTranslationScaler mRowTranslationScaler; protected boolean mAppearing; public AppearAnimationUtils(Context ctx) { @@ -49,19 +51,18 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { R.dimen.appear_y_translation_start) * translationScaleFactor; mDelayScale = delayScaleFactor; mDuration = duration; - mScaleTranslationWithRow = false; mAppearing = true; } - public void startAnimation(View[][] objects, final Runnable finishListener) { - startAnimation(objects, finishListener, this); + public void startAnimation2d(View[][] objects, final Runnable finishListener) { + startAnimation2d(objects, finishListener, this); } public void startAnimation(View[] objects, final Runnable finishListener) { startAnimation(objects, finishListener, this); } - public <T> void startAnimation(T[][] objects, final Runnable finishListener, + public <T> void startAnimation2d(T[][] objects, final Runnable finishListener, AppearAnimationCreator<T> creator) { AppearAnimationProperties properties = getDelays(objects); startAnimations(properties, objects, finishListener, creator); @@ -86,8 +87,13 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { if (properties.maxDelayRowIndex == row && properties.maxDelayColIndex == 0) { endRunnable = finishListener; } + float translationScale = mRowTranslationScaler != null + ? mRowTranslationScaler.getRowTranslationScale(row, properties.delays.length) + : 1f; + float translation = translationScale * mStartTranslation; creator.createAnimation(objects[row], delay, mDuration, - mStartTranslation, true /* appearing */, mInterpolator, endRunnable); + mAppearing ? translation : -translation, + mAppearing, mInterpolator, endRunnable); } } @@ -99,10 +105,10 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { } for (int row = 0; row < properties.delays.length; row++) { long[] columns = properties.delays[row]; - float translation = mScaleTranslationWithRow - ? (float) (Math.pow((properties.delays.length - row), 2) - / properties.delays.length * mStartTranslation) - : mStartTranslation; + float translationScale = mRowTranslationScaler != null + ? mRowTranslationScaler.getRowTranslationScale(row, properties.delays.length) + : 1f; + float translation = translationScale * mStartTranslation; for (int col = 0; col < columns.length; col++) { long delay = columns[col]; Runnable endRunnable = null; @@ -193,4 +199,8 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { public int maxDelayRowIndex; public int maxDelayColIndex; } + + public interface RowTranslationScaler { + float getRowTranslationScale(int row, int numRows); + } } diff --git a/packages/Keyguard/src/com/android/keyguard/DisappearAnimationUtils.java b/packages/SettingsLib/src/com/android/settingslib/animation/DisappearAnimationUtils.java index 517d96a..a444ff0 100644 --- a/packages/Keyguard/src/com/android/keyguard/DisappearAnimationUtils.java +++ b/packages/SettingsLib/src/com/android/settingslib/animation/DisappearAnimationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 The Android Open Source Project + * 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. @@ -14,7 +14,7 @@ * limitations under the License */ -package com.android.keyguard; +package com.android.settingslib.animation; import android.content.Context; import android.view.animation.AnimationUtils; @@ -28,17 +28,31 @@ public class DisappearAnimationUtils extends AppearAnimationUtils { public DisappearAnimationUtils(Context ctx) { this(ctx, DEFAULT_APPEAR_DURATION, 1.0f, 1.0f, - AnimationUtils.loadInterpolator(ctx, android.R.interpolator.linear_out_slow_in)); + AnimationUtils.loadInterpolator(ctx, android.R.interpolator.fast_out_linear_in)); } public DisappearAnimationUtils(Context ctx, long duration, float translationScaleFactor, float delayScaleFactor, Interpolator interpolator) { + this(ctx, duration, translationScaleFactor, delayScaleFactor, interpolator, + ROW_TRANSLATION_SCALER); + } + + public DisappearAnimationUtils(Context ctx, long duration, float translationScaleFactor, + float delayScaleFactor, Interpolator interpolator, RowTranslationScaler rowScaler) { super(ctx, duration, translationScaleFactor, delayScaleFactor, interpolator); - mScaleTranslationWithRow = true; + mRowTranslationScaler = rowScaler; mAppearing = false; } protected long calculateDelay(int row, int col) { return (long) ((row * 60 + col * (Math.pow(row, 0.4) + 0.4) * 10) * mDelayScale); } + + private static final RowTranslationScaler ROW_TRANSLATION_SCALER = new RowTranslationScaler() { + + @Override + public float getRowTranslationScale(int row, int numRows) { + return (float) (Math.pow((numRows - row), 2) / numRows); + } + }; } diff --git a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml index 456d2f9..9912343 100644 --- a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml +++ b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml @@ -3,16 +3,16 @@ ** ** Copyright 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 +** 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 +** 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 +** 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. --> @@ -48,7 +48,7 @@ android:layout_marginStart="2dp" android:visibility="invisible" /> - <Space + <Space android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" @@ -80,7 +80,7 @@ android:layout_weight="0" android:contentDescription="@string/accessibility_recent" /> - <Space + <Space android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" @@ -120,7 +120,7 @@ android:id="@+id/lights_out" android:visibility="gone" > - <Space + <Space android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" @@ -132,6 +132,7 @@ android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_back" /> <ImageView android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp" @@ -139,6 +140,7 @@ android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_home" /> <ImageView android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp" @@ -147,8 +149,9 @@ android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_recent" /> - <Space + <Space android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" @@ -193,7 +196,7 @@ android:layout_marginStart="2dp" android:visibility="invisible" /> - <Space + <Space android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" @@ -225,7 +228,7 @@ android:layout_weight="0" android:contentDescription="@string/accessibility_recent" /> - <Space + <Space android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" @@ -264,7 +267,7 @@ android:id="@+id/lights_out" android:visibility="gone" > - <Space + <Space android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" @@ -276,6 +279,7 @@ android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_back" /> <ImageView android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp" @@ -283,6 +287,7 @@ android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_home" /> <ImageView android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp" @@ -291,8 +296,9 @@ android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_recent" /> - <Space + <Space android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml index 5d0367e..48af565 100644 --- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml +++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml @@ -33,7 +33,8 @@ android:gravity="center_horizontal" android:textStyle="italic" android:textColor="#ffffff" - android:textAppearance="?android:attr/textAppearanceSmall" /> + android:textAppearance="?android:attr/textAppearanceSmall" + android:accessibilityLiveRegion="polite" /> <FrameLayout android:id="@+id/preview_container" diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml index 898389d..c92ba45 100644 --- a/packages/SystemUI/res/layout/navigation_bar.xml +++ b/packages/SystemUI/res/layout/navigation_bar.xml @@ -4,16 +4,16 @@ ** ** Copyright 2011, 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 +** 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 +** 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 +** 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. */ --> @@ -57,7 +57,7 @@ android:scaleType="center" android:contentDescription="@string/accessibility_back" /> - <View + <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" @@ -73,7 +73,7 @@ android:scaleType="center" android:contentDescription="@string/accessibility_home" /> - <View + <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" @@ -130,8 +130,9 @@ android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_back" /> - <View + <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" @@ -143,8 +144,9 @@ android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_home" /> - <View + <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" @@ -157,6 +159,7 @@ android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_recent" /> </LinearLayout> @@ -180,7 +183,7 @@ android:paddingTop="0dp" > - <LinearLayout + <LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" @@ -225,7 +228,7 @@ android:layout_weight="0" android:contentDescription="@string/accessibility_recent" /> - <View + <View android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1" @@ -241,7 +244,7 @@ android:layout_weight="0" android:contentDescription="@string/accessibility_home" /> - <View + <View android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1" @@ -265,7 +268,7 @@ </LinearLayout> <!-- lights out layout to match exactly --> - <LinearLayout + <LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" @@ -279,8 +282,9 @@ android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_recent" /> - <View + <View android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1" @@ -292,8 +296,9 @@ android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_home" /> - <View + <View android:layout_height="match_parent" android:layout_width="match_parent" android:layout_weight="1" @@ -306,6 +311,7 @@ android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0" + android:contentDescription="@string/accessibility_back" /> </LinearLayout> diff --git a/packages/SystemUI/res/layout/volume_dialog_row.xml b/packages/SystemUI/res/layout/volume_dialog_row.xml index d12bf5d..c6aa588 100644 --- a/packages/SystemUI/res/layout/volume_dialog_row.xml +++ b/packages/SystemUI/res/layout/volume_dialog_row.xml @@ -22,15 +22,15 @@ <TextView android:id="@+id/volume_row_header" - style="?android:attr/textAppearanceButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" + android:textAppearance="@style/TextAppearance.Volume.Header" android:paddingBottom="0dp" android:paddingEnd="12dp" - android:paddingStart="13dp" - android:paddingTop="8dp" /> + android:paddingStart="12dp" + android:paddingTop="4dp" /> <com.android.keyguard.AlphaOptimizedImageButton android:id="@+id/volume_row_icon" diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index de5639b..260d81b 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -135,8 +135,6 @@ <!-- The maximum number of items to be displayed in quick settings --> <integer name="quick_settings_detail_max_item_count">7</integer> - <integer name="blinds_pop_duration_ms">10</integer> - <!-- Should "4G" be shown instead of "LTE" when the network is NETWORK_TYPE_LTE? --> <bool name="config_show4GForLTE">true</bool> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 10577d8..a0b70f0 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -772,6 +772,9 @@ <!-- Shows when people have clicked on the camera icon [CHAR LIMIT=60] --> <string name="camera_hint">Swipe from icon for camera</string> + <!-- Accessibility content description for Interruption level: None. [CHAR LIMIT=NONE] --> + <string name="interruption_level_none_with_warning">Total silence. This will also silence screen readers.</string> + <!-- Interruption level: None. [CHAR LIMIT=40] --> <string name="interruption_level_none">Total silence</string> @@ -847,7 +850,7 @@ <string name="guest_notification_title">Guest user</string> <!-- Text of the notification shown to a new guest user [CHAR LIMIT=60] --> - <string name="guest_notification_text">Remove guest to delete apps and data</string> + <string name="guest_notification_text">To delete apps and data, remove guest user</string> <!-- Remove action in the notification shown to a new guest user [CHAR LIMIT=30] --> <string name="guest_notification_remove_action">REMOVE GUEST</string> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index bda39b1..67d3312 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -275,6 +275,11 @@ <item name="android:fontFamily">sans-serif</item> </style> + <style name="TextAppearance.Volume.Header"> + <item name="android:textSize">12sp</item> + <item name="android:textColor">@color/volume_slider_inactive</item> + </style> + <style name="TextAppearance.Volume.ZenSummary"> <item name="android:textSize">14sp</item> <item name="android:fontFamily">sans-serif-medium</item> diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java index fece07f..b0e2afa 100644 --- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java +++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java @@ -25,6 +25,7 @@ import android.media.AudioAttributes; import android.os.Vibrator; import android.util.Log; import android.view.Gravity; +import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.ScaleGestureDetector.OnScaleGestureListener; @@ -64,15 +65,6 @@ public class ExpandHelper implements Gefingerpoken { // 2f: maximum brightness is stretching a 1U to 3U, or a 4U to 6U private static final float STRETCH_INTERVAL = 2f; - // level of glow for a touch, without overstretch - // overstretch fills the range (GLOW_BASE, 1.0] - private static final float GLOW_BASE = 0.5f; - - private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder() - .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) - .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION) - .build(); - @SuppressWarnings("unused") private Context mContext; @@ -94,13 +86,11 @@ public class ExpandHelper implements Gefingerpoken { private float mLastSpanY; private int mTouchSlop; private float mLastMotionY; - private int mPopDuration; private float mPullGestureMinXSpan; private Callback mCallback; private ScaleGestureDetector mSGD; private ViewScaler mScaler; private ObjectAnimator mScaleAnimation; - private Vibrator mVibrator; private boolean mEnabled = true; private ExpandableView mResizedView; private float mCurrentHeight; @@ -174,7 +164,6 @@ public class ExpandHelper implements Gefingerpoken { mScaler = new ViewScaler(); mGravity = Gravity.TOP; mScaleAnimation = ObjectAnimator.ofFloat(mScaler, "height", 0f); - mPopDuration = mContext.getResources().getInteger(R.integer.blinds_pop_duration_ms); mPullGestureMinXSpan = mContext.getResources().getDimension(R.dimen.pull_span_min); final ViewConfiguration configuration = ViewConfiguration.get(mContext); @@ -452,7 +441,9 @@ public class ExpandHelper implements Gefingerpoken { } if (!mHasPopped) { - vibrate(mPopDuration); + if (mEventSource != null) { + mEventSource.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); + } mHasPopped = true; } @@ -600,16 +591,5 @@ public class ExpandHelper implements Gefingerpoken { public void onlyObserveMovements(boolean onlyMovements) { mOnlyMovements = onlyMovements; } - - /** - * Triggers haptic feedback. - */ - private synchronized void vibrate(long duration) { - if (mVibrator == null) { - mVibrator = (android.os.Vibrator) - mContext.getSystemService(Context.VIBRATOR_SERVICE); - } - mVibrator.vibrate(duration, VIBRATION_ATTRIBUTES); - } } 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/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 25e3d10..49eb9b2 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -360,7 +360,7 @@ public class QSPanel extends ViewGroup { } private void handleShowDetailTile(TileRecord r, boolean show) { - if ((mDetailRecord != null) == show) return; + if ((mDetailRecord != null) == show && mDetailRecord == r) return; if (show) { r.detailAdapter = r.tile.getDetailAdapter(); @@ -373,7 +373,8 @@ public class QSPanel extends ViewGroup { } private void handleShowDetailImpl(Record r, boolean show, int x, int y) { - if ((mDetailRecord != null) == show) return; // already in right state + boolean visibleDiff = (mDetailRecord != null) != show; + if (!visibleDiff && mDetailRecord == r) return; // already in right state DetailAdapter detailAdapter = null; AnimatorListener listener = null; if (show) { @@ -399,7 +400,7 @@ public class QSPanel extends ViewGroup { mContext.getString(detailAdapter.getTitle()))); setDetailRecord(r); listener = mHideGridContentWhenDone; - if (r instanceof TileRecord) { + if (r instanceof TileRecord && visibleDiff) { ((TileRecord) r).openingDetail = true; } } else { @@ -411,7 +412,9 @@ public class QSPanel extends ViewGroup { } sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); fireShowingDetail(show ? detailAdapter : null); - mClipper.animateCircularClip(x, y, show, listener); + if (visibleDiff) { + mClipper.animateCircularClip(x, y, show, listener); + } } private void setGridContentVisibility(boolean visible) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index c0b3a9b..7cde44c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -21,15 +21,8 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapShader; import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffColorFilter; import android.graphics.RectF; -import android.graphics.Shader; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; @@ -100,7 +93,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private boolean mDark; private int mBgTint = 0; - private final int mRoundedRectCornerRadius; /** * Flag to indicate that the notification has been touched once and the second touch will @@ -126,10 +118,8 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private NotificationBackgroundView mBackgroundDimmed; private ObjectAnimator mBackgroundAnimator; private RectF mAppearAnimationRect = new RectF(); - private PorterDuffColorFilter mAppearAnimationFilter; private float mAnimationTranslationY; private boolean mDrawingAppearAnimation; - private Paint mAppearPaint = new Paint(); private ValueAnimator mAppearAnimator; private float mAppearAnimationFraction = -1.0f; private float mAppearAnimationTranslation; @@ -151,9 +141,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mLinearInterpolator = new LinearInterpolator(); setClipChildren(false); setClipToPadding(false); - mAppearAnimationFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_ATOP); - mRoundedRectCornerRadius = getResources().getDimensionPixelSize( - R.dimen.notification_material_rounded_rect_radius); mLegacyColor = context.getColor(R.color.notification_legacy_background_color); mNormalColor = context.getColor(R.color.notification_material_background_color); mLowPriorityColor = context.getColor( @@ -540,9 +527,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private void startAppearAnimation(boolean isAppearing, float translationDirection, long delay, long duration, final Runnable onFinishedRunnable) { - if (mAppearAnimator != null) { - mAppearAnimator.cancel(); - } + cancelAppearAnimation(); mAnimationTranslationY = translationDirection * getActualHeight(); if (mAppearAnimationFraction == -1.0f) { // not initialized yet, we start anew @@ -613,6 +598,17 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mAppearAnimator.start(); } + private void cancelAppearAnimation() { + if (mAppearAnimator != null) { + mAppearAnimator.cancel(); + } + } + + public void cancelAppearDrawing() { + cancelAppearAnimation(); + enableAppearDrawing(false); + } + private void updateAppearRect() { float inverseFraction = (1.0f - mAppearAnimationFraction); float translationFraction = mCurrentAppearInterpolator.getInterpolation(inverseFraction); @@ -652,20 +648,26 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } private void updateAppearAnimationAlpha() { - int backgroundColor = getBgColor(); - if (backgroundColor != -1) { - float contentAlphaProgress = mAppearAnimationFraction; - contentAlphaProgress = contentAlphaProgress / (1.0f - ALPHA_ANIMATION_END); - contentAlphaProgress = Math.min(1.0f, contentAlphaProgress); - contentAlphaProgress = mCurrentAlphaInterpolator.getInterpolation(contentAlphaProgress); - int sourceColor = Color.argb((int) (255 * (1.0f - contentAlphaProgress)), - Color.red(backgroundColor), Color.green(backgroundColor), - Color.blue(backgroundColor)); - mAppearAnimationFilter.setColor(sourceColor); - mAppearPaint.setColorFilter(mAppearAnimationFilter); + float contentAlphaProgress = mAppearAnimationFraction; + contentAlphaProgress = contentAlphaProgress / (1.0f - ALPHA_ANIMATION_END); + contentAlphaProgress = Math.min(1.0f, contentAlphaProgress); + contentAlphaProgress = mCurrentAlphaInterpolator.getInterpolation(contentAlphaProgress); + setContentAlpha(contentAlphaProgress); + } + + private void setContentAlpha(float contentAlpha) { + int layerType = contentAlpha == 0.0f || contentAlpha == 1.0f ? LAYER_TYPE_NONE + : LAYER_TYPE_HARDWARE; + View contentView = getContentView(); + int currentLayerType = contentView.getLayerType(); + if (currentLayerType != layerType) { + contentView.setLayerType(layerType, null); } + contentView.setAlpha(contentAlpha); } + protected abstract View getContentView(); + private int getBgColor() { if (mBgTint != 0) { return mBgTint; @@ -699,41 +701,24 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView */ private void enableAppearDrawing(boolean enable) { if (enable != mDrawingAppearAnimation) { - if (enable) { - if (getWidth() == 0 || getActualHeight() == 0) { - // TODO: This should not happen, but it can during expansion. Needs - // investigation - return; - } - Bitmap bitmap = Bitmap.createBitmap(getWidth(), getActualHeight(), - Bitmap.Config.ARGB_8888); - Canvas canvas = new Canvas(bitmap); - draw(canvas); - mAppearPaint.setShader(new BitmapShader(bitmap, Shader.TileMode.CLAMP, - Shader.TileMode.CLAMP)); - } else { - mAppearPaint.setShader(null); - } mDrawingAppearAnimation = enable; + if (!enable) { + setContentAlpha(1.0f); + } invalidate(); } } @Override protected void dispatchDraw(Canvas canvas) { - if (!mDrawingAppearAnimation) { - super.dispatchDraw(canvas); - } else { - drawAppearRect(canvas); + if (mDrawingAppearAnimation) { + canvas.save(); + canvas.translate(0, mAppearAnimationTranslation); + } + super.dispatchDraw(canvas); + if (mDrawingAppearAnimation) { + canvas.restore(); } - } - - private void drawAppearRect(Canvas canvas) { - canvas.save(); - canvas.translate(0, mAppearAnimationTranslation); - canvas.drawRoundRect(mAppearAnimationRect, mRoundedRectCornerRadius, - mRoundedRectCornerRadius, mAppearPaint); - canvas.restore(); } public void setOnActivatedListener(OnActivatedListener onActivatedListener) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 22d1287..85b4a64 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1855,11 +1855,8 @@ public abstract class BaseStatusBar extends SystemUI implements } } - if (onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) { - mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE); - } else { - mKeyguardIconOverflowContainer.setVisibility(View.GONE); - } + mStackScroller.updateOverflowContainerVisibility(onKeyguard + && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0); mStackScroller.changeViewPosition(mDismissView, mStackScroller.getChildCount() - 1); mStackScroller.changeViewPosition(mEmptyShadeView, mStackScroller.getChildCount() - 2); 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/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index d444ea8..b88e5ca 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -856,6 +856,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } @Override + protected View getContentView() { + return getShowingLayout(); + } + + @Override public void setActualHeight(int height, boolean notifyListeners) { super.setActualHeight(height, notifyListeners); int contentHeight = calculateContentHeightFromActualHeight(height); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java index a18fff2..d77e050 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java @@ -24,16 +24,21 @@ import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; +import com.android.systemui.R; + /** * Like {@link ExpandableView}, but setting an outline for the height and clipping. */ public abstract class ExpandableOutlineView extends ExpandableView { private final Rect mOutlineRect = new Rect(); + protected final int mRoundedRectCornerRadius; private boolean mCustomOutline; public ExpandableOutlineView(Context context, AttributeSet attrs) { super(context, attrs); + mRoundedRectCornerRadius = getResources().getDimensionPixelSize( + R.dimen.notification_material_rounded_rect_radius); setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { @@ -43,7 +48,7 @@ public abstract class ExpandableOutlineView extends ExpandableView { getWidth(), Math.max(getActualHeight(), mClipTopAmount)); } else { - outline.setRect(mOutlineRect); + outline.setRoundRect(mOutlineRect, mRoundedRectCornerRadius); } } }); @@ -66,12 +71,14 @@ public abstract class ExpandableOutlineView extends ExpandableView { setOutlineRect(rect.left, rect.top, rect.right, rect.bottom); } else { mCustomOutline = false; + setClipToOutline(false); invalidateOutline(); } } protected void setOutlineRect(float left, float top, float right, float bottom) { mCustomOutline = true; + setClipToOutline(true); mOutlineRect.set((int) left, (int) top, (int) right, (int) bottom); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 3feec9e..03d0482 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -43,6 +43,7 @@ public abstract class ExpandableView extends FrameLayout { private ArrayList<View> mMatchParentViews = new ArrayList<View>(); private int mClipTopOptimization; private static Rect mClipRect = new Rect(); + private boolean mWillBeGone; public ExpandableView(Context context, AttributeSet attrs) { super(context, attrs); @@ -339,6 +340,12 @@ 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()); + } + public int getContentHeight() { return mActualHeight - getBottomDecorHeight(); } @@ -374,6 +381,14 @@ public abstract class ExpandableView extends FrameLayout { updateClipping(); } + public boolean willBeGone() { + return mWillBeGone; + } + + public void setWillBeGone(boolean willBeGone) { + mWillBeGone = willBeGone; + } + /** * A listener notifying when {@link #getActualHeight} changes. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowContainer.java index 5fa7070..9653b67 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowContainer.java @@ -18,6 +18,7 @@ package com.android.systemui.statusbar; import android.content.Context; import android.util.AttributeSet; +import android.view.View; import android.widget.TextView; import com.android.systemui.R; @@ -32,6 +33,7 @@ public class NotificationOverflowContainer extends ActivatableNotificationView { private NotificationOverflowIconsView mIconsView; private ViewInvertHelper mViewInvertHelper; private boolean mDark; + private View mContent; public NotificationOverflowContainer(Context context, AttributeSet attrs) { super(context, attrs); @@ -43,7 +45,8 @@ public class NotificationOverflowContainer extends ActivatableNotificationView { mIconsView = (NotificationOverflowIconsView) findViewById(R.id.overflow_icons_view); mIconsView.setMoreText((TextView) findViewById(R.id.more_text)); mIconsView.setOverflowIndicator(findViewById(R.id.more_icon_overflow)); - mViewInvertHelper = new ViewInvertHelper(findViewById(R.id.content), + mContent = findViewById(R.id.content); + mViewInvertHelper = new ViewInvertHelper(mContent, NotificationPanelView.DOZE_ANIMATION_DURATION); } @@ -59,6 +62,11 @@ public class NotificationOverflowContainer extends ActivatableNotificationView { } } + @Override + protected View getContentView() { + return mContent; + } + public NotificationOverflowIconsView getIconsView() { return mIconsView; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java index 64d80cc..2f66c41 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java @@ -32,7 +32,6 @@ public abstract class StackScrollerDecorView extends ExpandableView { protected View mContent; private boolean mIsVisible; private boolean mAnimating; - private boolean mWillBeGone; public StackScrollerDecorView(Context context, AttributeSet attrs) { super(context, attrs); @@ -134,13 +133,5 @@ public abstract class StackScrollerDecorView extends ExpandableView { mContent.animate().cancel(); } - public boolean willBeGone() { - return mWillBeGone; - } - - public void setWillBeGone(boolean willBeGone) { - mWillBeGone = willBeGone; - } - protected abstract View findContentView(); } 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/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 9e1af82..a750572 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -487,6 +487,7 @@ public class NotificationPanelView extends PanelView implements mStatusBar.dismissPopups(); mNotificationStackScroller.setOverScrollAmount(0f, true /* onTop */, false /* animate */, true /* cancelAnimators */); + mNotificationStackScroller.resetScrollPosition(); } public void closeQs() { @@ -1716,12 +1717,16 @@ public class NotificationPanelView extends PanelView implements float alphaQsExpansion = 1 - Math.min(1, getQsExpansionFraction() * 2); mKeyguardStatusBar.setAlpha(Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) * mKeyguardStatusBarAnimateAlpha); + mKeyguardStatusBar.setVisibility(mKeyguardStatusBar.getAlpha() != 0f ? VISIBLE : INVISIBLE); setQsTranslation(mQsExpansionHeight); } private void updateKeyguardBottomAreaAlpha() { - mKeyguardBottomArea.setAlpha( - Math.min(getKeyguardContentsAlpha(), 1 - getQsExpansionFraction())); + float alpha = Math.min(getKeyguardContentsAlpha(), 1 - getQsExpansionFraction()); + mKeyguardBottomArea.setAlpha(alpha); + mKeyguardBottomArea.setImportantForAccessibility(alpha == 0f + ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + : IMPORTANT_FOR_ACCESSIBILITY_AUTO); } private float getNotificationsTopY() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java index 54bd3e9..552a0b2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java @@ -81,10 +81,13 @@ public class PanelBar extends FrameLayout { } public void setBouncerShowing(boolean showing) { + int important = showing ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + : IMPORTANT_FOR_ACCESSIBILITY_AUTO; + + setImportantForAccessibility(important); + if (mPanelHolder != null) { - mPanelHolder.setImportantForAccessibility( - showing ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS - : IMPORTANT_FOR_ACCESSIBILITY_AUTO); + mPanelHolder.setImportantForAccessibility(important); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index a5b18f9..33e8e59 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -707,7 +707,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, R.layout.status_bar_notification_keyguard_overflow, mStackScroller, false); mKeyguardIconOverflowContainer.setOnActivatedListener(this); mKeyguardIconOverflowContainer.setOnClickListener(mOverflowClickListener); - mStackScroller.addView(mKeyguardIconOverflowContainer); + mStackScroller.setOverflowContainer(mKeyguardIconOverflowContainer); SpeedBumpView speedBump = (SpeedBumpView) LayoutInflater.from(mContext).inflate( R.layout.status_bar_notification_speed_bump, mStackScroller, false); @@ -1861,6 +1861,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public void setQsExpanded(boolean expanded) { mStatusBarWindowManager.setQsExpanded(expanded); + mKeyguardStatusView.setImportantForAccessibility(expanded + ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + : View.IMPORTANT_FOR_ACCESSIBILITY_AUTO); } public boolean isGoingToNotificationShade() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java index 6e30803..98bbe7c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java @@ -552,6 +552,7 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL } public void updateEntry() { + mSortedEntries.remove(HeadsUpEntry.this); long currentTime = mClock.currentTimeMillis(); earliestRemovaltime = currentTime + mMinimumDisplayTime; postTime = Math.max(postTime, currentTime); @@ -561,13 +562,13 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL long removeDelay = Math.max(finishTime - currentTime, mMinimumDisplayTime); mHandler.postDelayed(mRemoveHeadsUpRunnable, removeDelay); } - updateSortOrder(HeadsUpEntry.this); + mSortedEntries.add(HeadsUpEntry.this); } @Override public int compareTo(HeadsUpEntry o) { return postTime < o.postTime ? 1 - : postTime == o.postTime ? 0 + : postTime == o.postTime ? entry.key.compareTo(o.entry.key) : -1; } @@ -592,16 +593,6 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL } } - /** - * Update the sorted heads up order. - * - * @param headsUpEntry the headsUp that changed - */ - private void updateSortOrder(HeadsUpEntry headsUpEntry) { - mSortedEntries.remove(headsUpEntry); - mSortedEntries.add(headsUpEntry); - } - public static class Clock { public long currentTimeMillis() { return SystemClock.elapsedRealtime(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java index 1460e5f..5cf6156 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java @@ -30,7 +30,7 @@ import android.view.ViewStub; import android.view.animation.AnimationUtils; import android.widget.FrameLayout; -import com.android.keyguard.AppearAnimationUtils; +import com.android.settingslib.animation.AppearAnimationUtils; import com.android.systemui.R; import com.android.systemui.qs.tiles.UserDetailItemView; import com.android.systemui.statusbar.phone.KeyguardStatusBarView; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index d8f6bcd..1bf4547 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -43,6 +43,7 @@ import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.NotificationData; +import com.android.systemui.statusbar.NotificationOverflowContainer; import com.android.systemui.statusbar.SpeedBumpView; import com.android.systemui.statusbar.StackScrollerDecorView; import com.android.systemui.statusbar.StatusBarState; @@ -226,6 +227,7 @@ public class NotificationStackScrollLayout extends ViewGroup private boolean mTrackingHeadsUp; private ScrimController mScrimController; private boolean mForceNoOverlappingRendering; + private NotificationOverflowContainer mOverflowContainer; public NotificationStackScrollLayout(Context context) { this(context, null); @@ -1368,17 +1370,11 @@ public class NotificationStackScrollLayout extends ViewGroup int childCount = getChildCount(); int count = 0; for (int i = 0; i < childCount; i++) { - View child = getChildAt(i); - if (child.getVisibility() != View.GONE) { + ExpandableView child = (ExpandableView) getChildAt(i); + if (child.getVisibility() != View.GONE && !child.willBeGone()) { count++; } } - if (mDismissView.willBeGone()) { - count--; - } - if (mEmptyShadeView.willBeGone()) { - count--; - } return count; } @@ -2234,6 +2230,11 @@ public class NotificationStackScrollLayout extends ViewGroup } } + public void resetScrollPosition() { + mScroller.abortAnimation(); + mOwnScrollY = 0; + } + private void setIsExpanded(boolean isExpanded) { boolean changed = isExpanded != mIsExpanded; mIsExpanded = isExpanded; @@ -2291,6 +2292,10 @@ public class NotificationStackScrollLayout extends ViewGroup public void onChildAnimationFinished() { requestChildrenUpdate(); + runAnimationFinishedRunnables(); + } + + private void runAnimationFinishedRunnables() { for (Runnable runnable : mAnimationFinishedRunnables) { runnable.run(); } @@ -2348,6 +2353,7 @@ public class NotificationStackScrollLayout extends ViewGroup if (mListener != null) { mListener.onChildLocationsChanged(this); } + runAnimationFinishedRunnables(); } public void setSpeedBumpView(SpeedBumpView speedBumpView) { @@ -2470,7 +2476,7 @@ public class NotificationStackScrollLayout extends ViewGroup mEmptyShadeView.setVisibility(newVisibility); mEmptyShadeView.setWillBeGone(false); updateContentHeight(); - notifyHeightChangeListener(mDismissView); + notifyHeightChangeListener(mEmptyShadeView); } else { Runnable onFinishedRunnable = new Runnable() { @Override @@ -2478,7 +2484,7 @@ public class NotificationStackScrollLayout extends ViewGroup mEmptyShadeView.setVisibility(GONE); mEmptyShadeView.setWillBeGone(false); updateContentHeight(); - notifyHeightChangeListener(mDismissView); + notifyHeightChangeListener(mEmptyShadeView); } }; if (mAnimationsEnabled) { @@ -2492,6 +2498,45 @@ public class NotificationStackScrollLayout extends ViewGroup } } + public void setOverflowContainer(NotificationOverflowContainer overFlowContainer) { + mOverflowContainer = overFlowContainer; + addView(mOverflowContainer); + } + + public void updateOverflowContainerVisibility(boolean visible) { + int oldVisibility = mOverflowContainer.willBeGone() ? GONE + : mOverflowContainer.getVisibility(); + final int newVisibility = visible ? VISIBLE : GONE; + if (oldVisibility != newVisibility) { + Runnable onFinishedRunnable = new Runnable() { + @Override + public void run() { + mOverflowContainer.setVisibility(newVisibility); + mOverflowContainer.setWillBeGone(false); + updateContentHeight(); + notifyHeightChangeListener(mOverflowContainer); + } + }; + if (!mAnimationsEnabled || !mIsExpanded) { + mOverflowContainer.cancelAppearDrawing(); + onFinishedRunnable.run(); + } else if (newVisibility != GONE) { + mOverflowContainer.performAddAnimation(0, + StackStateAnimator.ANIMATION_DURATION_STANDARD); + mOverflowContainer.setVisibility(newVisibility); + mOverflowContainer.setWillBeGone(false); + updateContentHeight(); + notifyHeightChangeListener(mOverflowContainer); + } else { + mOverflowContainer.performRemoveAnimation( + StackStateAnimator.ANIMATION_DURATION_STANDARD, + 0.0f, + onFinishedRunnable); + mOverflowContainer.setWillBeGone(true); + } + } + } + public void updateDismissView(boolean visible) { int oldVisibility = mDismissView.willBeGone() ? GONE : mDismissView.getVisibility(); int newVisibility = visible ? VISIBLE : GONE; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java index feae590..a70ad43 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java @@ -210,7 +210,10 @@ public class StackScrollState { int oldVisibility = view.getVisibility(); int newVisibility = becomesInvisible ? View.INVISIBLE : View.VISIBLE; if (newVisibility != oldVisibility) { - view.setVisibility(newVisibility); + if (!(view instanceof ExpandableView) || !((ExpandableView) view).willBeGone()) { + // We don't want views to change visibility when they are animating to GONE + view.setVisibility(newVisibility); + } } // apply yTranslation diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java index c31244c..c995c8e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java @@ -285,6 +285,10 @@ public class StackStateAnimator { boolean scaleChanging = child.getScaleX() != viewState.scale; float childAlpha = child.getVisibility() == View.INVISIBLE ? 0.0f : child.getAlpha(); boolean alphaChanging = viewState.alpha != childAlpha; + if (child instanceof ExpandableView) { + // We don't want views to change visibility when they are animating to GONE + alphaChanging &= !((ExpandableView) child).willBeGone(); + } // start translationY animation if (yTranslationChanging) { diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java index 29bea4d..49278c5 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java @@ -524,6 +524,7 @@ public class VolumeDialog { } } Util.setVisOrInvis(row.settingsButton, false); + updateVolumeRowHeaderVisibleH(row); row.header.setAlpha(mExpanded && isActive ? 1 : 0.5f); updateVolumeRowSliderTintH(row, isActive); } @@ -606,25 +607,22 @@ public class VolumeDialog { } // update header visible - if (row.cachedShowHeaders != mShowHeaders) { - row.cachedShowHeaders = mShowHeaders; - Util.setVisOrGone(row.header, mShowHeaders); - } + updateVolumeRowHeaderVisibleH(row); // update header text - final String text; - if (isRingZenNone) { - text = mContext.getString(R.string.volume_stream_muted_dnd, ss.name); - } else if (isRingVibrate && isRingLimited) { - text = mContext.getString(R.string.volume_stream_vibrate_dnd, ss.name); - } else if (isRingVibrate) { - text = mContext.getString(R.string.volume_stream_vibrate, ss.name); - } else if (ss.muted || mAutomute && ss.level == 0) { - text = mContext.getString(R.string.volume_stream_muted, ss.name); - } else if (isRingLimited) { - text = mContext.getString(R.string.volume_stream_limited_dnd, ss.name); - } else { - text = ss.name; + String text = ss.name; + if (mShowHeaders) { + if (isRingZenNone) { + text = mContext.getString(R.string.volume_stream_muted_dnd, ss.name); + } else if (isRingVibrate && isRingLimited) { + text = mContext.getString(R.string.volume_stream_vibrate_dnd, ss.name); + } else if (isRingVibrate) { + text = mContext.getString(R.string.volume_stream_vibrate, ss.name); + } else if (ss.muted || mAutomute && ss.level == 0) { + text = mContext.getString(R.string.volume_stream_muted, ss.name); + } else if (isRingLimited) { + text = mContext.getString(R.string.volume_stream_limited_dnd, ss.name); + } } Util.setText(row.header, text); @@ -663,6 +661,15 @@ public class VolumeDialog { updateVolumeRowSliderH(row, enableSlider, vlevel); } + private void updateVolumeRowHeaderVisibleH(VolumeRow row) { + final boolean dynamic = row.ss != null && row.ss.dynamic; + final boolean showHeaders = mShowHeaders || mExpanded && dynamic; + if (row.cachedShowHeaders != showHeaders) { + row.cachedShowHeaders = showHeaders; + Util.setVisOrGone(row.header, showHeaders); + } + } + private void updateVolumeRowSliderTintH(VolumeRow row, boolean isActive) { final ColorStateList tint = isActive && row.slider.isEnabled() ? mActiveSliderTint : mInactiveSliderTint; diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java index ced1a3c..a0eb61f 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java @@ -153,7 +153,7 @@ public class ZenModePanel extends LinearLayout { mZenButtons = (SegmentedButtons) findViewById(R.id.zen_buttons); mZenButtons.addButton(R.string.interruption_level_none_twoline, - R.string.interruption_level_none, + R.string.interruption_level_none_with_warning, Global.ZEN_MODE_NO_INTERRUPTIONS); mZenButtons.addButton(R.string.interruption_level_alarms_twoline, R.string.interruption_level_alarms, |