Merge "Fully null check mRecentsAnimationController" into sc-dev
diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml
index a48e2c0..b43d8d1 100644
--- a/quickstep/AndroidManifest.xml
+++ b/quickstep/AndroidManifest.xml
@@ -124,6 +124,8 @@
android:excludeFromRecents="true"
android:screenOrientation="portrait"
android:permission="android.permission.REBOOT"
+ android:theme="@style/AllSetTheme"
+ android:label="@string/allset_title"
android:exported="true">
<intent-filter>
<action android:name="com.android.quickstep.action.GESTURE_ONBOARDING_ALL_SET"/>
diff --git a/quickstep/res/layout/activity_allset.xml b/quickstep/res/layout/activity_allset.xml
index a6a17e5..e79e57e 100644
--- a/quickstep/res/layout/activity_allset.xml
+++ b/quickstep/res/layout/activity_allset.xml
@@ -20,8 +20,7 @@
android:paddingStart="@dimen/allset_page_margin_horizontal"
android:paddingEnd="@dimen/allset_page_margin_horizontal"
android:layoutDirection="locale"
- android:textDirection="locale"
- android:background="?android:attr/colorBackground">
+ android:textDirection="locale">
<LinearLayout
android:layout_width="match_parent"
@@ -59,13 +58,15 @@
<TextView
android:id="@+id/navigation_settings"
- style="@style/TextAppearance.GestureTutorial.Feedback.Subtitle"
- android:textSize="14sp"
+ style="@style/TextAppearance.GestureTutorial.LinkText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/hint"
- android:gravity="center_horizontal"
- android:layout_marginBottom="72dp"/>
+ android:gravity="center"
+ android:layout_marginBottom="72dp"
+ android:minHeight="48dp"
+ android:background="?android:attr/selectableItemBackground"
+ android:text="@string/allset_navigation_settings" />
<TextView
android:id="@id/hint"
diff --git a/quickstep/res/values-night/styles.xml b/quickstep/res/values-night/styles.xml
new file mode 100644
index 0000000..1bd3f5d
--- /dev/null
+++ b/quickstep/res/values-night/styles.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 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>
+
+ <style name="AllSetTheme" parent="@android:style/Theme.DeviceDefault.NoActionBar">
+ <item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:enforceNavigationBarContrast">false</item>
+ <item name="android:windowLightStatusBar">false</item>
+ <item name="android:windowBackground">#FF000000</item>
+ </style>
+
+</resources>
\ No newline at end of file
diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml
index cfca124..ca1e8c8 100644
--- a/quickstep/res/values/styles.xml
+++ b/quickstep/res/values/styles.xml
@@ -110,6 +110,14 @@
<item name="android:textSize">14sp</item>
</style>
+ <style name="AllSetTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
+ <item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:enforceNavigationBarContrast">false</item>
+ <item name="android:windowLightStatusBar">true</item>
+ <item name="android:windowBackground">#FFFFFFFF</item>
+ </style>
+
<!--
Can be applied to views to color things like ripples and list highlights the workspace text
color.
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index ae7e477..310e178 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -982,10 +982,13 @@
depthController.setSurface(dimLayer);
backgroundRadiusAnim.addListener(new AnimatorListenerAdapter() {
@Override
+ public void onAnimationStart(Animator animation) {
+ depthController.setIsInLaunchTransition(true);
+ }
+
+ @Override
public void onAnimationEnd(Animator animation) {
- // Reset depth at the end of the launch animation, so the wallpaper won't be
- // zoomed out if an app crashes.
- DEPTH.setValue(depthController, 0f);
+ depthController.setIsInLaunchTransition(false);
depthController.setSurface(null);
if (dimLayer != null) {
new SurfaceControl.Transaction()
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index 4503e30..bb8b62d 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -24,6 +24,7 @@
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.os.IBinder;
+import android.os.SystemProperties;
import android.util.FloatProperty;
import android.view.CrossWindowBlurListeners;
import android.view.SurfaceControl;
@@ -117,6 +118,10 @@
* @see android.service.wallpaper.WallpaperService.Engine#onZoomChanged(float)
*/
private float mDepth;
+ /**
+ * If we're launching and app and should not be blurring the screen for performance reasons.
+ */
+ private boolean mBlurDisabledForAppLaunch;
// Workaround for animating the depth when multiwindow mode changes.
private boolean mIgnoreStateChangesDuringMultiWindowAnimation = false;
@@ -211,6 +216,19 @@
}
}
+ /**
+ * If we're launching an app from the home screen.
+ */
+ public void setIsInLaunchTransition(boolean inLaunchTransition) {
+ boolean blurEnabled = SystemProperties.getBoolean("ro.launcher.blur.appLaunch", true);
+ mBlurDisabledForAppLaunch = inLaunchTransition && !blurEnabled;
+ if (!inLaunchTransition) {
+ // Reset depth at the end of the launch animation, so the wallpaper won't be
+ // zoomed out if an app crashes.
+ setDepth(0f);
+ }
+ }
+
private void setDepth(float depth) {
depth = Utilities.boundToRange(depth, 0, 1);
// Round out the depth to dedupe frequent, non-perceptable updates
@@ -238,7 +256,7 @@
boolean opaque = mLauncher.getScrimView().isFullyOpaque() && !isOverview;
int blur = opaque || isOverview || !mCrossWindowBlursEnabled
- ? 0 : (int) (mDepth * mMaxBlurRadius);
+ || mBlurDisabledForAppLaunch ? 0 : (int) (mDepth * mMaxBlurRadius);
new SurfaceControl.Transaction()
.setBackgroundBlurRadius(mSurface, blur)
.setOpaque(mSurface, opaque)
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index 01c9e76..fe5a347 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -19,7 +19,6 @@
import android.content.Context;
import android.graphics.Color;
-import android.os.SystemProperties;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
@@ -85,8 +84,7 @@
@Override
protected float getDepthUnchecked(Context context) {
- //TODO revert when b/178661709 is fixed
- return SystemProperties.getBoolean("ro.launcher.depth.appLaunch", true) ? 1 : 0;
+ return 1;
}
@Override
diff --git a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
index 6f681b3..4472bdc 100644
--- a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
+++ b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
@@ -16,23 +16,22 @@
package com.android.quickstep.interaction;
import android.app.Activity;
-import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
-import android.content.res.TypedArray;
import android.graphics.Color;
-import android.graphics.Typeface;
import android.os.Bundle;
-import android.text.TextPaint;
-import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.View;
+import android.view.View.AccessibilityDelegate;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import java.net.URISyntaxException;
@@ -48,86 +47,56 @@
private static final String EXTRA_ACCENT_COLOR_DARK_MODE = "suwColorAccentDark";
private static final String EXTRA_ACCENT_COLOR_LIGHT_MODE = "suwColorAccentLight";
- private int mAccentColor;
-
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_allset);
- setTitle(R.string.allset_title);
- final int mode =
- getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
- mAccentColor = getIntent().getIntExtra(
- mode == Configuration.UI_MODE_NIGHT_YES
- ? EXTRA_ACCENT_COLOR_DARK_MODE : EXTRA_ACCENT_COLOR_LIGHT_MODE,
- /* defValue= */ Color.BLACK);
+ int mode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+ boolean isDarkTheme = mode == Configuration.UI_MODE_NIGHT_YES;
+ int accentColor = getIntent().getIntExtra(
+ isDarkTheme ? EXTRA_ACCENT_COLOR_DARK_MODE : EXTRA_ACCENT_COLOR_LIGHT_MODE,
+ isDarkTheme ? Color.WHITE : Color.BLACK);
- ((ImageView) findViewById(R.id.icon)).getDrawable().mutate().setTint(mAccentColor);
+ ((ImageView) findViewById(R.id.icon)).getDrawable().mutate().setTint(accentColor);
- TextView navigationSettings = findViewById(R.id.navigation_settings);
- navigationSettings.setMovementMethod(LinkMovementMethod.getInstance());
- AnnotationSpan.LinkInfo linkInfo = new AnnotationSpan.LinkInfo(
- AnnotationSpan.LinkInfo.DEFAULT_ANNOTATION,
- new AllSetLinkSpan(
- /* context= */ this,
- view -> {
- try {
- startActivityForResult(
- Intent.parseUri(URI_SYSTEM_NAVIGATION_SETTING, 0), 0);
- } catch (URISyntaxException e) {
- Log.e(LOG_TAG, "Failed to parse system nav settings intent", e);
- }
- finish();
- }));
- navigationSettings.setText(
- AnnotationSpan.linkify(getText(R.string.allset_navigation_settings), linkInfo));
+ TextView tv = findViewById(R.id.navigation_settings);
+ tv.setTextColor(accentColor);
+ tv.setOnClickListener(v -> {
+ try {
+ startActivityForResult(
+ Intent.parseUri(URI_SYSTEM_NAVIGATION_SETTING, 0), 0);
+ } catch (URISyntaxException e) {
+ Log.e(LOG_TAG, "Failed to parse system nav settings intent", e);
+ }
+ finish();
+ });
+
+ findViewById(R.id.hint).setAccessibilityDelegate(new SkipButtonAccessibilityDelegate());
}
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
- if (hasFocus) {
- hideSystemUI();
- }
- }
+ /**
+ * Accessibility delegate which exposes a click event without making the view
+ * clickable in touch mode
+ */
+ private class SkipButtonAccessibilityDelegate extends AccessibilityDelegate {
- private void hideSystemUI() {
- getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN);
- getWindow().setNavigationBarColor(Color.TRANSPARENT);
- }
-
- private final class AllSetLinkSpan extends AnnotationSpan {
-
- private final String mFontFamily;
- private final int mTextSize;
-
- AllSetLinkSpan(Context context, View.OnClickListener listener) {
- super(listener);
- TypedArray typedArray =
- context.obtainStyledAttributes(R.style.TextAppearance_GestureTutorial_LinkText,
- R.styleable.AllSetLinkSpan);
- mFontFamily = typedArray.getString(R.styleable.AllSetLinkSpan_android_fontFamily);
- mTextSize =
- typedArray.getDimensionPixelSize(
- R.styleable.AllSetLinkSpan_android_textSize, /* defValue= */ -1);
- typedArray.recycle();
+ @Override
+ public AccessibilityNodeInfo createAccessibilityNodeInfo(View host) {
+ AccessibilityNodeInfo info = super.createAccessibilityNodeInfo(host);
+ info.addAction(AccessibilityAction.ACTION_CLICK);
+ info.setClickable(true);
+ return info;
}
@Override
- public void updateDrawState(TextPaint ds) {
- super.updateDrawState(ds);
- ds.setColor(mAccentColor);
- ds.setTypeface(Typeface.create(mFontFamily, Typeface.NORMAL));
- ds.setUnderlineText(false);
- if (mTextSize != -1) {
- ds.setTextSize(mTextSize);
+ public boolean performAccessibilityAction(View host, int action, Bundle args) {
+ if (action == AccessibilityAction.ACTION_CLICK.getId()) {
+ startActivity(Utilities.createHomeIntent());
+ finish();
+ return true;
}
+ return super.performAccessibilityAction(host, action, args);
}
}
-
}
diff --git a/quickstep/src/com/android/quickstep/interaction/AnnotationSpan.java b/quickstep/src/com/android/quickstep/interaction/AnnotationSpan.java
deleted file mode 100644
index fea5078..0000000
--- a/quickstep/src/com/android/quickstep/interaction/AnnotationSpan.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2018 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.quickstep.interaction;
-
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.Intent;
-import android.text.Annotation;
-import android.text.SpannableString;
-import android.text.SpannableStringBuilder;
-import android.text.style.URLSpan;
-import android.util.Log;
-import android.view.View;
-
-import java.util.Arrays;
-import java.util.Comparator;
-
-/**
- * This class is used to add {@link View.OnClickListener} for the text been wrapped by
- * annotation.
- *
- * Copied from packages/apps/Settings/src/com/android/settings/utils/AnnotationSpan.java.
- */
-public class AnnotationSpan extends URLSpan {
-
- private final View.OnClickListener mClickListener;
-
- AnnotationSpan(View.OnClickListener lsn) {
- super((String) null);
- mClickListener = lsn;
- }
-
- @Override
- public void onClick(View widget) {
- if (mClickListener != null) {
- mClickListener.onClick(widget);
- }
- }
-
- public static CharSequence linkify(CharSequence rawText, LinkInfo... linkInfos) {
- SpannableString msg = new SpannableString(rawText);
- Annotation[] spans = msg.getSpans(0, msg.length(), Annotation.class);
- SpannableStringBuilder builder = new SpannableStringBuilder(msg);
- for (Annotation annotation : spans) {
- final String key = annotation.getValue();
- int start = msg.getSpanStart(annotation);
- int end = msg.getSpanEnd(annotation);
- AnnotationSpan link = null;
- for (LinkInfo linkInfo : linkInfos) {
- if (linkInfo.mAnnotation.equals(key)) {
- link = linkInfo.mCustomizedSpan != null ? linkInfo.mCustomizedSpan
- : new AnnotationSpan(linkInfo.mClickListener);
- break;
- }
- }
- if (link != null) {
- builder.setSpan(link, start, end, msg.getSpanFlags(link));
- }
- }
- return builder;
- }
-
- /**
- * get the text part without having text for link part
- */
- public static CharSequence textWithoutLink(CharSequence encodedText) {
- SpannableString msg = new SpannableString(encodedText);
- Annotation[] spans = msg.getSpans(0, msg.length(), Annotation.class);
- if (spans == null) {
- return encodedText;
- }
- Arrays.sort(spans, Comparator.comparingInt(span -> -msg.getSpanStart(span)));
- StringBuilder msgWithoutLink = new StringBuilder(msg.toString());
- for (Annotation span : spans) {
- msgWithoutLink.delete(msg.getSpanStart(span), msg.getSpanEnd(span));
- }
- return msgWithoutLink.toString();
- }
-
- /** Data class to store the annotation and the click action. */
- public static class LinkInfo {
- public static final String DEFAULT_ANNOTATION = "link";
- private static final String TAG = "AnnotationSpan.LinkInfo";
- private final String mAnnotation;
- private final Boolean mActionable;
- private final View.OnClickListener mClickListener;
- private final AnnotationSpan mCustomizedSpan;
-
- public LinkInfo(String annotation, View.OnClickListener listener) {
- mAnnotation = annotation;
- mClickListener = listener;
- mActionable = true; // assume actionable
- mCustomizedSpan = null;
- }
-
- public LinkInfo(String annotation, AnnotationSpan customizedSpan) {
- mAnnotation = annotation;
- mClickListener = null;
- mActionable = customizedSpan != null;
- mCustomizedSpan = customizedSpan;
- }
-
- public LinkInfo(Context context, String annotation, Intent intent) {
- mAnnotation = annotation;
- mCustomizedSpan = null;
- if (intent != null) {
- mActionable = context.getPackageManager().resolveActivity(intent, 0) != null;
- } else {
- mActionable = false;
- }
- if (mActionable) {
- mClickListener =
- view -> {
- try {
- context.startActivity(intent);
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "Activity was not found for intent, " + intent);
- }
- };
- } else {
- mClickListener = null;
- }
- }
-
- public boolean isActionable() {
- return mActionable;
- }
- }
-}
diff --git a/res/layout/system_shortcut.xml b/res/layout/system_shortcut.xml
index 2cdf1f4..de091c5 100644
--- a/res/layout/system_shortcut.xml
+++ b/res/layout/system_shortcut.xml
@@ -32,7 +32,8 @@
android:paddingStart="@dimen/deep_shortcuts_text_padding_start"
android:paddingEnd="@dimen/popup_padding_end"
android:textSize="14sp"
- android:singleLine="true"
+ android:minLines="1"
+ android:maxLines="2"
android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary"
launcher:iconDisplay="shortcut_popup"
diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml
index 1c99dfc..256999c 100644
--- a/res/xml/device_profiles.xml
+++ b/res/xml/device_profiles.xml
@@ -116,6 +116,14 @@
launcher:canBeDefault="true" />
<display-option
+ launcher:name="Large Phone Split Display"
+ launcher:minWidthDps="406"
+ launcher:minHeightDps="694"
+ launcher:iconImageSize="56"
+ launcher:iconTextSize="14.4"
+ launcher:canBeDefault="split_display" />
+
+ <display-option
launcher:name="Shorter Stubby"
launcher:minWidthDps="255"
launcher:minHeightDps="400"
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index ab3ea0a..d1e643f 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -184,16 +184,19 @@
} catch (Exception e) {
Log.e("AllAppsContainerView", "restoreInstanceState viewId = 0", e);
}
+
Bundle state = (Bundle) sparseArray.get(R.id.work_tab_state_id, null);
if (state != null) {
int currentPage = state.getInt(BUNDLE_KEY_CURRENT_PAGE, 0);
if (currentPage != 0) {
- rebindAdapters(true);
mViewPager.setCurrentPage(currentPage);
+ rebindAdapters(true);
+ } else {
+ mSearchUiManager.resetSearch();
}
}
- }
+ }
@Override
protected void dispatchSaveInstanceState(SparseArray<Parcelable> container) {
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index d7a69f1..9a5f3f2 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -40,6 +40,7 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.RecyclerViewFastScroller;
@@ -166,7 +167,7 @@
// Always scroll the view to the top so the user can see the changed results
scrollToTop();
- if (mApps.hasNoFilteredResults()) {
+ if (mApps.hasNoFilteredResults() && !FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
if (mEmptySearchBackground == null) {
mEmptySearchBackground = new AllAppsBackgroundDrawable(getContext());
mEmptySearchBackground.setAlpha(0);
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index b7fe348..a534ee3 100644
--- a/src/com/android/launcher3/popup/ArrowPopup.java
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -511,8 +511,8 @@
mArrowOffsetHorizontal, -mArrowOffsetVertical,
!mIsAboveIcon, mIsLeftAligned,
mArrowColor));
- // TODO: Remove elevation when arrow is above as it casts a shadow on the container
- mArrow.setElevation(mIsAboveIcon ? mElevation : 0);
+ setElevation(mElevation);
+ mArrow.setElevation(mElevation);
}
}