Snap for 7017853 from e676914740 to sc-release

Change-Id: I47a52c9d7fe7248353a597744436b96603da02b8
This commit is contained in:
android-build-team Robot committed 2020-12-08 02:07:07 +00:00
commit 2a120eda3f
11 files changed
+100 -40

No files matched your search

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/gesture_tutorial_fake_task_view_color" />
</shape>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/gesture_tutorial_fake_task_view_color" />
</shape>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?android:attr/colorBackground" />
</shape>
@@ -16,8 +16,7 @@
<com.android.quickstep.interaction.RootSandboxLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/colorBackground">
android:layout_height="match_parent">
<View
android:id="@+id/gesture_tutorial_ripple_view"
@@ -29,15 +28,12 @@
android:id="@+id/gesture_tutorial_fake_icon_view"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/bg_circle"
android:backgroundTint="@color/gesture_tutorial_fake_task_view_color"
android:visibility="invisible" />
<View
android:id="@+id/gesture_tutorial_fake_task_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gesture_tutorial_fake_task_view_color"
android:visibility="invisible" />
<ImageView
@@ -46,7 +46,7 @@ public class SandboxModeTutorialController extends SwipeUpGestureTutorialControl
@Nullable
@Override
Integer getActionButtonStringId() {
return R.string.gesture_tutorial_action_button_label_done;
return null;
}
@Override
@@ -25,8 +25,10 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.CallSuper;
import androidx.annotation.DrawableRes;
import androidx.annotation.Nullable;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.views.ClipIconView;
import com.android.quickstep.interaction.EdgeBackGestureHandler.BackGestureAttemptCallback;
@@ -63,13 +65,13 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mTutorialType = tutorialType;
mContext = mTutorialFragment.getContext();
View rootView = tutorialFragment.getRootView();
RootSandboxLayout rootView = tutorialFragment.getRootView();
mCloseButton = rootView.findViewById(R.id.gesture_tutorial_fragment_close_button);
mCloseButton.setOnClickListener(button -> mTutorialFragment.closeTutorial());
mTitleTextView = rootView.findViewById(R.id.gesture_tutorial_fragment_title_view);
mSubtitleTextView = rootView.findViewById(R.id.gesture_tutorial_fragment_subtitle_view);
mFeedbackView = rootView.findViewById(R.id.gesture_tutorial_fragment_feedback_view);
mLauncherView = tutorialFragment.getLauncherView();
mLauncherView = getMockLauncherView();
mFakeIconView = rootView.findViewById(R.id.gesture_tutorial_fake_icon_view);
mFakeTaskView = rootView.findViewById(R.id.gesture_tutorial_fake_task_view);
mRippleView = rootView.findViewById(R.id.gesture_tutorial_ripple_view);
@@ -84,6 +86,15 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mHideFeedbackRunnable =
() -> mFeedbackView.animate().alpha(0).setDuration(FEEDBACK_ANIMATION_MS)
.withEndAction(this::showHandCoachingAnimation).start();
if (mLauncherView != null) {
rootView.addView(mLauncherView, 0);
}
if (mContext != null) {
rootView.setBackground(mContext.getDrawable(getMockWallpaperResId()));
mFakeTaskView.setBackground(mContext.getDrawable(getMockAppTaskThumbnailResId()));
mFakeIconView.setBackground(mContext.getDrawable(getMockAppIconResId()));
}
}
void setTutorialType(TutorialType tutorialType) {
@@ -110,6 +121,28 @@ abstract class TutorialController implements BackGestureAttemptCallback,
return null;
}
@DrawableRes
protected int getMockAppTaskThumbnailResId() {
return R.drawable.default_sandbox_app_task_thumbnail;
}
@Nullable
public View getMockLauncherView() {
InvariantDeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(mContext);
return new SandboxLauncherRenderer(mContext, dp, true).getRenderedView();
}
@DrawableRes
public int getMockAppIconResId() {
return R.drawable.default_sandbox_app_icon;
}
@DrawableRes
public int getMockWallpaperResId() {
return R.drawable.default_sandbox_wallpaper;
}
void showFeedback(int resId) {
hideHandCoachingAnimation();
mFeedbackView.setText(resId);
@@ -167,10 +200,11 @@ abstract class TutorialController implements BackGestureAttemptCallback,
if (isComplete()) {
hideHandCoachingAnimation();
mLauncherView.setVisibility(View.INVISIBLE);
} else {
showHandCoachingAnimation();
mLauncherView.setVisibility(View.VISIBLE);
}
if (mLauncherView != null) {
mLauncherView.setVisibility(isComplete() ? View.INVISIBLE : View.VISIBLE);
}
}
@@ -213,8 +247,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
return mTutorialType == TutorialType.BACK_NAVIGATION_COMPLETE
|| mTutorialType == TutorialType.HOME_NAVIGATION_COMPLETE
|| mTutorialType == TutorialType.OVERVIEW_NAVIGATION_COMPLETE
|| mTutorialType == TutorialType.ASSISTANT_COMPLETE
|| mTutorialType == TutorialType.SANDBOX_MODE;
|| mTutorialType == TutorialType.ASSISTANT_COMPLETE;
}
/** Denotes the type of the tutorial. */
@@ -31,7 +31,6 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.R;
import com.android.quickstep.interaction.TutorialController.TutorialType;
@@ -42,11 +41,10 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
TutorialType mTutorialType;
@Nullable TutorialController mTutorialController = null;
View mRootView;
RootSandboxLayout mRootView;
@Nullable TutorialHandAnimation mHandCoachingAnimation = null;
EdgeBackGestureHandler mEdgeBackGestureHandler;
NavBarGestureHandler mNavBarGestureHandler;
private View mLauncherView;
public static TutorialFragment newInstance(TutorialType tutorialType) {
TutorialFragment fragment = getFragmentForTutorialType(tutorialType);
@@ -114,7 +112,8 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
mRootView = inflater.inflate(R.layout.gesture_tutorial_fragment, container, false);
mRootView = (RootSandboxLayout) inflater.inflate(
R.layout.gesture_tutorial_fragment, container, false);
mRootView.setOnApplyWindowInsetsListener((view, insets) -> {
Insets systemInsets = insets.getInsets(WindowInsets.Type.systemBars());
mEdgeBackGestureHandler.setInsets(systemInsets.left, systemInsets.right);
@@ -126,9 +125,6 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
mHandCoachingAnimation =
new TutorialHandAnimation(getContext(), mRootView, handAnimationResId);
}
InvariantDeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(getContext());
mLauncherView = new SandboxLauncherRenderer(getContext(), dp, true).getRenderedView();
((ViewGroup) mRootView).addView(mLauncherView, 0);
return mRootView;
}
@@ -161,7 +157,7 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
}
void onAttachedToWindow() {
mEdgeBackGestureHandler.setViewGroupParent((ViewGroup) getRootView());
mEdgeBackGestureHandler.setViewGroupParent(getRootView());
}
void onDetachedFromWindow() {
@@ -186,14 +182,10 @@ abstract class TutorialFragment extends Fragment implements OnTouchListener {
super.onSaveInstanceState(savedInstanceState);
}
View getRootView() {
RootSandboxLayout getRootView() {
return mRootView;
}
View getLauncherView() {
return mLauncherView;
}
@Nullable TutorialHandAnimation getHandAnimation() {
return mHandCoachingAnimation;
}
+1 -3
View File
@@ -2343,9 +2343,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
if (item.restoreStatus == LauncherAppWidgetInfo.RESTORE_COMPLETED) {
// Verify that we own the widget
if (appWidgetInfo == null) {
FileLog.e(TAG, "Removing invalid widget: id=" + item.appWidgetId
+ ",title=" + item.title
+ ",providerName=" + item.providerName.toShortString());
FileLog.e(TAG, "Removing invalid widget: id=" + item.appWidgetId);
getModelWriter().deleteWidgetInfo(item, getAppWidgetHost());
return null;
}
@@ -85,7 +85,6 @@ import java.util.Arrays;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.stream.Collectors;
public class LauncherProvider extends ContentProvider {
private static final String TAG = "LauncherProvider";
@@ -932,11 +931,6 @@ public class LauncherProvider extends ContentProvider {
final IntSet validWidgets = IntSet.wrap(LauncherDbUtils.queryIntArray(db,
Favorites.TABLE_NAME, Favorites.APPWIDGET_ID,
"itemType=" + Favorites.ITEM_TYPE_APPWIDGET, null, null));
final String allWidgetIds = Arrays.stream(allWidgets).mapToObj(String::valueOf)
.collect(Collectors.joining(","));
final String validWidgetIds = validWidgets.getArray().toConcatString();
FileLog.d(TAG, "All widget ids: " + allWidgetIds);
FileLog.d(TAG, "Valid widget ids: " + validWidgetIds);
for (int widgetId : allWidgets) {
if (!validWidgets.contains(widgetId)) {
try {
@@ -153,7 +153,7 @@ public final class FeatureFlags {
"ENABLE_OVERVIEW_CONTENT_PUSH", false, "Show Content Push button in Overview Actions");
public static final BooleanFlag ENABLE_DATABASE_RESTORE = getDebugFlag(
"ENABLE_DATABASE_RESTORE", true,
"ENABLE_DATABASE_RESTORE", false,
"Enable database restore when new restore session is created");
public static final BooleanFlag ENABLE_SMARTSPACE_UNIVERSAL = getDebugFlag(
@@ -745,11 +745,7 @@ public class LoaderTask implements Runnable {
+ "span=" + appWidgetInfo.spanX + "x"
+ appWidgetInfo.spanY + " minSpan="
+ widgetProviderInfo.minSpanX + "x"
+ widgetProviderInfo.minSpanY
+ ", appWidgetInfo.provider="
+ appWidgetInfo.providerName.toShortString()
+ ", widgetProviderInfo.provider="
+ widgetProviderInfo.provider.toShortString());
+ widgetProviderInfo.minSpanY);
continue;
}
if (!c.isOnWorkspaceOrHotseat()) {