Snap for 7128142 from 1508e062e8 to sc-release
Change-Id: I82347c6973dea359e634e0e2af2267b2fca365a9
This commit is contained in:
commit
571ef143e3
15 files changed
+228
-79
No files matched your search
@@ -56,17 +56,22 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo
|
||||
return mHandler;
|
||||
}
|
||||
|
||||
// Called only in R+ platform
|
||||
// Called only in S+ platform
|
||||
@BinderThread
|
||||
public void onAnimationStart(RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets, Runnable runnable) {
|
||||
public void onAnimationStart(
|
||||
int transit,
|
||||
RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets,
|
||||
RemoteAnimationTargetCompat[] nonAppTargets,
|
||||
Runnable runnable) {
|
||||
Runnable r = () -> {
|
||||
finishExistingAnimation();
|
||||
mAnimationResult = new AnimationResult(() -> {
|
||||
UI_HELPER_EXECUTOR.execute(runnable);
|
||||
mAnimationResult = null;
|
||||
});
|
||||
onCreateAnimation(appTargets, wallpaperTargets, mAnimationResult);
|
||||
onCreateAnimation(transit, appTargets, wallpaperTargets, nonAppTargets,
|
||||
mAnimationResult);
|
||||
};
|
||||
if (mStartAtFrontOfQueue) {
|
||||
postAtFrontOfQueueAsynchronously(mHandler, r);
|
||||
@@ -75,6 +80,14 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo
|
||||
}
|
||||
}
|
||||
|
||||
// Called only in R platform
|
||||
@BinderThread
|
||||
public void onAnimationStart(RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets, Runnable runnable) {
|
||||
onAnimationStart(0 /* transit */, appTargets, wallpaperTargets,
|
||||
new RemoteAnimationTargetCompat[0], runnable);
|
||||
}
|
||||
|
||||
// Called only in Q platform
|
||||
@BinderThread
|
||||
@Deprecated
|
||||
@@ -88,8 +101,11 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo
|
||||
*/
|
||||
@UiThread
|
||||
public abstract void onCreateAnimation(
|
||||
int transit,
|
||||
RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets, AnimationResult result);
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets,
|
||||
RemoteAnimationTargetCompat[] nonAppTargets,
|
||||
AnimationResult result);
|
||||
|
||||
@UiThread
|
||||
private void finishExistingAnimation() {
|
||||
|
||||
@@ -866,8 +866,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets,
|
||||
public void onCreateAnimation(int transit,
|
||||
RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets,
|
||||
RemoteAnimationTargetCompat[] nonAppTargets,
|
||||
LauncherAnimationRunner.AnimationResult result) {
|
||||
if (mLauncher.isDestroyed()) {
|
||||
AnimatorSet anim = new AnimatorSet();
|
||||
@@ -880,7 +882,8 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
// If launcher is not resumed, wait until new async-frame after resume
|
||||
mLauncher.addOnResumeCallback(() ->
|
||||
postAsyncCallback(mHandler, () ->
|
||||
onCreateAnimation(appTargets, wallpaperTargets, result)));
|
||||
onCreateAnimation(transit, appTargets, wallpaperTargets,
|
||||
nonAppTargets, result)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -964,8 +967,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets,
|
||||
public void onCreateAnimation(int transit,
|
||||
RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets,
|
||||
RemoteAnimationTargetCompat[] nonAppTargets,
|
||||
LauncherAnimationRunner.AnimationResult result) {
|
||||
AnimatorSet anim = new AnimatorSet();
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
*/
|
||||
public interface WrappedAnimationRunnerImpl {
|
||||
Handler getHandler();
|
||||
void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets,
|
||||
void onCreateAnimation(int transit,
|
||||
RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets,
|
||||
RemoteAnimationTargetCompat[] nonAppTargets,
|
||||
LauncherAnimationRunner.AnimationResult result);
|
||||
}
|
||||
@@ -46,11 +46,15 @@ public class WrappedLauncherAnimationRunner<R extends WrappedAnimationRunnerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets, AnimationResult result) {
|
||||
public void onCreateAnimation(int transit,
|
||||
RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets,
|
||||
RemoteAnimationTargetCompat[] nonAppTargets,
|
||||
AnimationResult result) {
|
||||
R animationRunnerImpl = mImpl.get();
|
||||
if (animationRunnerImpl != null) {
|
||||
animationRunnerImpl.onCreateAnimation(appTargets, wallpaperTargets, result);
|
||||
animationRunnerImpl.onCreateAnimation(transit, appTargets, wallpaperTargets,
|
||||
nonAppTargets, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,11 +73,9 @@ public class DeviceSearchEdu extends AbstractSlideInView implements
|
||||
}
|
||||
|
||||
|
||||
private void close(boolean animate, boolean markAsSeen) {
|
||||
handleClose(animate);
|
||||
if (markAsSeen) {
|
||||
mLauncher.getOnboardingPrefs().markChecked(SEARCH_EDU_SEEN);
|
||||
}
|
||||
private void dismiss() {
|
||||
handleClose(true);
|
||||
mLauncher.getOnboardingPrefs().markChecked(SEARCH_EDU_SEEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,7 +108,7 @@ public class DeviceSearchEdu extends AbstractSlideInView implements
|
||||
|
||||
findViewById(R.id.dismiss_edu).setOnClickListener((view) -> {
|
||||
mSwitchFocusOnDismiss = true;
|
||||
close(true, true);
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -176,7 +174,7 @@ public class DeviceSearchEdu extends AbstractSlideInView implements
|
||||
|
||||
@Override
|
||||
public void onStateTransitionStart(LauncherState toState) {
|
||||
close(true, false);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -203,7 +201,7 @@ public class DeviceSearchEdu extends AbstractSlideInView implements
|
||||
if (mSearchInput != null) {
|
||||
mSearchInput.setText(charSequence.toString());
|
||||
mSwitchFocusOnDismiss = true;
|
||||
close(true, true);
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +213,7 @@ public class DeviceSearchEdu extends AbstractSlideInView implements
|
||||
@Override
|
||||
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
||||
mSearchInput.onEditorAction(i);
|
||||
close(true, true);
|
||||
dismiss();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -184,8 +184,11 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets, AnimationResult result) {
|
||||
public void onCreateAnimation(int transit,
|
||||
RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets,
|
||||
RemoteAnimationTargetCompat[] nonAppTargets,
|
||||
AnimationResult result) {
|
||||
AnimatorSet anim = composeRecentsLaunchAnimator(taskView, appTargets,
|
||||
wallpaperTargets);
|
||||
anim.addListener(resetStateListener());
|
||||
|
||||
@@ -43,8 +43,11 @@ public abstract class RemoteAnimationProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets, AnimationResult result) {
|
||||
public void onCreateAnimation(int transit,
|
||||
RemoteAnimationTargetCompat[] appTargets,
|
||||
RemoteAnimationTargetCompat[] wallpaperTargets,
|
||||
RemoteAnimationTargetCompat[] nonApps,
|
||||
AnimationResult result) {
|
||||
result.setAnimation(createWindowAnimation(appTargets, wallpaperTargets), context);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 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>
|
||||
<color name="popup_color_primary_light">@android:color/system_main_50</color>
|
||||
<color name="popup_color_secondary_light">@android:color/system_main_100</color>
|
||||
<color name="popup_color_tertiary_light">@android:color/system_main_300</color>
|
||||
<color name="popup_color_primary_dark">@android:color/system_main_800</color>
|
||||
<color name="popup_color_secondary_dark">@android:color/system_main_900</color>
|
||||
<color name="popup_color_tertiary_dark">@android:color/system_main_700</color>
|
||||
|
||||
<color name="workspace_text_color_light">@android:color/system_main_50</color>
|
||||
<color name="workspace_text_color_dark">@android:color/system_main_900</color>
|
||||
|
||||
<color name="text_color_primary_dark">@android:color/system_main_50</color>
|
||||
<color name="text_color_secondary_dark">@android:color/system_main_200</color>
|
||||
<color name="text_color_tertiary_dark">@android:color/system_main_400</color>
|
||||
</resources>
|
||||
@@ -40,4 +40,19 @@
|
||||
<color name="gesture_tutorial_fake_previous_task_view_color">#9CCC65</color> <!-- Light Green -->
|
||||
<color name="gesture_tutorial_action_button_label_color">#FFFFFFFF</color>
|
||||
<color name="gesture_tutorial_primary_color">#1A73E8</color> <!-- Blue -->
|
||||
|
||||
<color name="popup_color_primary_light">#FFF</color>
|
||||
<color name="popup_color_secondary_light">#F1F3F4</color>
|
||||
<color name="popup_color_tertiary_light">#E0E0E0</color> <!-- Gray 300 -->
|
||||
<color name="popup_color_primary_dark">#3C4043</color> <!-- Gray 800 -->
|
||||
<color name="popup_color_secondary_dark">#202124</color>
|
||||
<color name="popup_color_tertiary_dark">#757575</color> <!-- Gray 600 -->
|
||||
|
||||
<color name="workspace_text_color_light">#FFF</color>
|
||||
<color name="workspace_text_color_dark">#FF212121</color>
|
||||
|
||||
<color name="text_color_primary_dark">#FFFFFFFF</color>
|
||||
<color name="text_color_secondary_dark">#FFFFFFFF</color>
|
||||
<color name="text_color_tertiary_dark">#CCFFFFFF</color>
|
||||
|
||||
</resources>
|
||||
+12
-12
@@ -35,12 +35,12 @@
|
||||
<item name="allAppsInterimScrimAlpha">46</item>
|
||||
<item name="allAppsNavBarScrimColor">#66FFFFFF</item>
|
||||
<item name="allAppsTheme">@style/AllAppsTheme</item>
|
||||
<item name="popupColorPrimary">#FFF</item>
|
||||
<item name="popupColorSecondary">#F1F3F4</item>
|
||||
<item name="popupColorTertiary">#E0E0E0</item> <!-- Gray 300 -->
|
||||
<item name="popupColorPrimary">@color/popup_color_primary_light</item>
|
||||
<item name="popupColorSecondary">@color/popup_color_secondary_light</item>
|
||||
<item name="popupColorTertiary">@color/popup_color_tertiary_light</item>
|
||||
<item name="isMainColorDark">false</item>
|
||||
<item name="isWorkspaceDarkText">false</item>
|
||||
<item name="workspaceTextColor">@android:color/white</item>
|
||||
<item name="workspaceTextColor">@color/workspace_text_color_light</item>
|
||||
<item name="workspaceShadowColor">#B0000000</item>
|
||||
<item name="workspaceAmbientShadowColor">#33000000</item>
|
||||
<item name="workspaceKeyShadowColor">#44000000</item>
|
||||
@@ -74,7 +74,7 @@
|
||||
</style>
|
||||
|
||||
<style name="LauncherTheme.DarkText" parent="@style/LauncherTheme">
|
||||
<item name="workspaceTextColor">#FF212121</item>
|
||||
<item name="workspaceTextColor">@color/workspace_text_color_dark</item>
|
||||
<item name="allAppsInterimScrimAlpha">128</item>
|
||||
<item name="workspaceShadowColor">@android:color/transparent</item>
|
||||
<item name="workspaceAmbientShadowColor">@android:color/transparent</item>
|
||||
@@ -88,9 +88,9 @@
|
||||
</style>
|
||||
|
||||
<style name="LauncherTheme.Dark" parent="@style/LauncherTheme">
|
||||
<item name="android:textColorPrimary">#FFFFFFFF</item>
|
||||
<item name="android:textColorSecondary">#FFFFFFFF</item>
|
||||
<item name="android:textColorTertiary">#CCFFFFFF</item>
|
||||
<item name="android:textColorPrimary">@color/text_color_primary_dark</item>
|
||||
<item name="android:textColorSecondary">@color/text_color_secondary_dark</item>
|
||||
<item name="android:textColorTertiary">@color/text_color_tertiary_dark</item>
|
||||
<item name="android:textColorHint">#A0FFFFFF</item>
|
||||
<item name="android:colorControlHighlight">#A0FFFFFF</item>
|
||||
<item name="android:colorPrimary">#FF212121</item>
|
||||
@@ -98,9 +98,9 @@
|
||||
<item name="allAppsInterimScrimAlpha">102</item>
|
||||
<item name="allAppsNavBarScrimColor">#80000000</item>
|
||||
<item name="allAppsTheme">@style/AllAppsTheme.Dark</item>
|
||||
<item name="popupColorPrimary">#3C4043</item> <!-- Gray 800 -->
|
||||
<item name="popupColorSecondary">#202124</item>
|
||||
<item name="popupColorTertiary">#757575</item> <!-- Gray 600 -->
|
||||
<item name="popupColorPrimary">@color/popup_color_primary_dark</item>
|
||||
<item name="popupColorSecondary">@color/popup_color_secondary_dark</item>
|
||||
<item name="popupColorTertiary">@color/popup_color_tertiary_dark</item>
|
||||
<item name="widgetsTheme">@style/WidgetContainerTheme.Dark</item>
|
||||
<item name="folderDotColor">?android:attr/colorPrimary</item>
|
||||
<item name="folderFillColor">?android:attr/colorBackground</item>
|
||||
@@ -125,7 +125,7 @@
|
||||
<item name="allAppsInterimScrimAlpha">25</item>
|
||||
<item name="folderFillColor">#CDFFFFFF</item>
|
||||
<item name="folderTextColor">?attr/workspaceTextColor</item>
|
||||
<item name="workspaceTextColor">#FF212121</item>
|
||||
<item name="workspaceTextColor">@color/workspace_text_color_dark</item>
|
||||
<item name="workspaceShadowColor">@android:color/transparent</item>
|
||||
<item name="workspaceAmbientShadowColor">@android:color/transparent</item>
|
||||
<item name="workspaceKeyShadowColor">@android:color/transparent</item>
|
||||
|
||||
@@ -905,7 +905,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
}
|
||||
|
||||
logStopAndResume(false /* isResume */);
|
||||
mAppWidgetHost.setListenIfResumed(false);
|
||||
mAppWidgetHost.setActivityStarted(false);
|
||||
NotificationListener.removeNotificationsChangedListener();
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
mOverlayManager.onActivityStarted(this);
|
||||
}
|
||||
|
||||
mAppWidgetHost.setListenIfResumed(true);
|
||||
mAppWidgetHost.setActivityStarted(true);
|
||||
TraceHelper.INSTANCE.endSection(traceToken);
|
||||
}
|
||||
|
||||
@@ -938,6 +938,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
NotificationListener.setNotificationsChangedListener(mPopupDataProvider);
|
||||
|
||||
DiscoveryBounce.showForHomeIfNeeded(this);
|
||||
mAppWidgetHost.setActivityResumed(true);
|
||||
}
|
||||
|
||||
private void logStopAndResume(boolean isResume) {
|
||||
@@ -1031,7 +1032,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
@Override
|
||||
public void onStateSetEnd(LauncherState state) {
|
||||
super.onStateSetEnd(state);
|
||||
getAppWidgetHost().setResumed(state == LauncherState.NORMAL);
|
||||
getAppWidgetHost().setStateIsNormal(state == LauncherState.NORMAL);
|
||||
getWorkspace().setClipChildren(!state.hasFlag(FLAG_MULTI_PAGE));
|
||||
|
||||
finishAutoCancelActionMode();
|
||||
@@ -1088,6 +1089,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
if (!mDeferOverlayCallbacks) {
|
||||
mOverlayManager.onActivityPaused(this);
|
||||
}
|
||||
mAppWidgetHost.setActivityResumed(false);
|
||||
}
|
||||
|
||||
class LauncherOverlayCallbacksImpl implements LauncherOverlayCallbacks {
|
||||
|
||||
@@ -49,8 +49,11 @@ import java.util.function.IntConsumer;
|
||||
public class LauncherAppWidgetHost extends AppWidgetHost {
|
||||
|
||||
private static final int FLAG_LISTENING = 1;
|
||||
private static final int FLAG_RESUMED = 1 << 1;
|
||||
private static final int FLAG_LISTEN_IF_RESUMED = 1 << 2;
|
||||
private static final int FLAG_STATE_IS_NORMAL = 1 << 1;
|
||||
private static final int FLAG_ACTIVITY_STARTED = 1 << 2;
|
||||
private static final int FLAG_ACTIVITY_RESUMED = 1 << 3;
|
||||
private static final int FLAGS_SHOULD_LISTEN =
|
||||
FLAG_STATE_IS_NORMAL | FLAG_ACTIVITY_STARTED | FLAG_ACTIVITY_RESUMED;
|
||||
|
||||
public static final int APPWIDGET_HOST_ID = 1024;
|
||||
|
||||
@@ -59,7 +62,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
|
||||
private final SparseArray<PendingAppWidgetHostView> mPendingViews = new SparseArray<>();
|
||||
|
||||
private final Context mContext;
|
||||
private int mFlags = FLAG_RESUMED;
|
||||
private int mFlags = FLAG_STATE_IS_NORMAL;
|
||||
|
||||
private IntConsumer mAppWidgetRemovedCallback = null;
|
||||
|
||||
@@ -130,49 +133,45 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the resumed state of the host.
|
||||
* When a host is not resumed, it defers calls to startListening until host is resumed again.
|
||||
* But if the host was already listening, it will not call stopListening.
|
||||
*
|
||||
* @see #setListenIfResumed(boolean)
|
||||
* Sets or unsets a flag the can change whether the widget host should be in the listening
|
||||
* state.
|
||||
*/
|
||||
public void setResumed(boolean isResumed) {
|
||||
if (isResumed == ((mFlags & FLAG_RESUMED) != 0)) {
|
||||
return;
|
||||
}
|
||||
if (isResumed) {
|
||||
mFlags |= FLAG_RESUMED;
|
||||
// Start listening if we were supposed to start listening on resume
|
||||
if ((mFlags & FLAG_LISTEN_IF_RESUMED) != 0 && (mFlags & FLAG_LISTENING) == 0) {
|
||||
startListening();
|
||||
}
|
||||
private void setShouldListenFlag(int flag, boolean on) {
|
||||
if (on) {
|
||||
mFlags |= flag;
|
||||
} else {
|
||||
mFlags &= ~FLAG_RESUMED;
|
||||
mFlags &= ~flag;
|
||||
}
|
||||
|
||||
final boolean listening = isListening();
|
||||
if (!listening && (mFlags & FLAGS_SHOULD_LISTEN) == FLAGS_SHOULD_LISTEN) {
|
||||
// Postpone starting listening until all flags are on.
|
||||
startListening();
|
||||
} else if (listening && (mFlags & FLAG_ACTIVITY_STARTED) == 0) {
|
||||
// Postpone stopping listening until the activity is stopped.
|
||||
stopListening();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the listening state of the host. If the host is not resumed, startListening is
|
||||
* deferred until next resume.
|
||||
*
|
||||
* @see #setResumed(boolean)
|
||||
* Registers an "entering/leaving Normal state" event.
|
||||
*/
|
||||
public void setListenIfResumed(boolean listenIfResumed) {
|
||||
if (listenIfResumed == ((mFlags & FLAG_LISTEN_IF_RESUMED) != 0)) {
|
||||
return;
|
||||
}
|
||||
if (listenIfResumed) {
|
||||
mFlags |= FLAG_LISTEN_IF_RESUMED;
|
||||
if ((mFlags & FLAG_RESUMED) != 0) {
|
||||
// If we are resumed, start listening immediately. Note we do not check for
|
||||
// duplicate calls before calling startListening as startListening is safe to call
|
||||
// multiple times.
|
||||
startListening();
|
||||
}
|
||||
} else {
|
||||
mFlags &= ~FLAG_LISTEN_IF_RESUMED;
|
||||
stopListening();
|
||||
}
|
||||
public void setStateIsNormal(boolean isNormal) {
|
||||
setShouldListenFlag(FLAG_STATE_IS_NORMAL, isNormal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an "activity started/stopped" event.
|
||||
*/
|
||||
public void setActivityStarted(boolean isStarted) {
|
||||
setShouldListenFlag(FLAG_ACTIVITY_STARTED, isStarted);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an "activity paused/resumed" event.
|
||||
*/
|
||||
public void setActivityResumed(boolean isResumed) {
|
||||
setShouldListenFlag(FLAG_ACTIVITY_RESUMED, isResumed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
package com.android.launcher3.allapps.search;
|
||||
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_ENTRY;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_EXIT;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
@@ -46,6 +48,8 @@ import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAppWidgetProviderInfo;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.logging.InstanceIdSequence;
|
||||
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
|
||||
import com.android.launcher3.statemanager.StateManager.StateListener;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.SafeCloseable;
|
||||
@@ -71,6 +75,7 @@ public class LiveSearchManager implements StateListener<LauncherState> {
|
||||
new HashMap<>();
|
||||
private SearchWidgetHost mSearchWidgetHost;
|
||||
private InstanceId mLogInstanceId;
|
||||
private LauncherState mPrevLauncherState;
|
||||
|
||||
public LiveSearchManager(Launcher launcher) {
|
||||
mLauncher = launcher;
|
||||
@@ -133,6 +138,11 @@ public class LiveSearchManager implements StateListener<LauncherState> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionStart(LauncherState toState) {
|
||||
mPrevLauncherState = mLauncher.getStateManager().getCurrentStableState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateTransitionComplete(LauncherState finalState) {
|
||||
if (finalState != ALL_APPS) {
|
||||
@@ -142,6 +152,15 @@ public class LiveSearchManager implements StateListener<LauncherState> {
|
||||
|
||||
clearWidgetHost();
|
||||
}
|
||||
|
||||
StatsLogger logger = mLauncher.getStatsLogManager().logger();
|
||||
if (finalState.equals(ALL_APPS)) {
|
||||
mLogInstanceId = new InstanceIdSequence().newInstanceId();
|
||||
logger.withInstanceId(mLogInstanceId).log(LAUNCHER_ALLAPPS_ENTRY);
|
||||
} else if (mPrevLauncherState.equals(ALL_APPS)) {
|
||||
logger.withInstanceId(mLogInstanceId).log(LAUNCHER_ALLAPPS_EXIT);
|
||||
mLogInstanceId = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -344,6 +344,12 @@ public class StatsLogManager implements ResourceBasedOverride {
|
||||
|
||||
@UiEvent(doc = "Current grid size is changed to 2.")
|
||||
LAUNCHER_GRID_SIZE_2(665),
|
||||
|
||||
@UiEvent(doc = "Launcher entered into AllApps state.")
|
||||
LAUNCHER_ALLAPPS_ENTRY(692),
|
||||
|
||||
@UiEvent(doc = "Launcher exited from AllApps state.")
|
||||
LAUNCHER_ALLAPPS_EXIT(693),
|
||||
;
|
||||
|
||||
// ADD MORE
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.systemui.plugins;
|
||||
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.android.systemui.plugins.annotations.ProvidesInterface;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface to provide SmartspaceTargets to BcSmartspace.
|
||||
*/
|
||||
@ProvidesInterface(action = BcSmartspaceDataPlugin.ACTION, version = BcSmartspaceDataPlugin.VERSION)
|
||||
public interface BcSmartspaceDataPlugin extends Plugin {
|
||||
String ACTION = "com.android.systemui.action.PLUGIN_BC_SMARTSPACE_DATA";
|
||||
int VERSION = 1;
|
||||
|
||||
/** Register a listener to get Smartspace data. */
|
||||
void registerListener(SmartspaceTargetListener listener);
|
||||
|
||||
/** Unregister a listener. */
|
||||
void unregisterListener(SmartspaceTargetListener listener);
|
||||
|
||||
/** Provides Smartspace data to registered listeners. */
|
||||
interface SmartspaceTargetListener {
|
||||
/** Each Parcelable is a SmartspaceTarget that represents a card. */
|
||||
void onSmartspaceTargetsUpdated(List<Parcelable> targets);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user