mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Merge "Revert "Do not display clone apps in launcher work tab."" into udc-dev am: ee311b3e9c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23264596 Change-Id: I2a678e3a418e67af3d1688fc54ab596ba43e3660 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -45,7 +45,6 @@ import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
@@ -53,7 +52,6 @@ import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -97,15 +95,7 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
|
||||
StatsLogManager statsLogManager) {
|
||||
mUserManager = userManager;
|
||||
mAllApps = allApps;
|
||||
boolean cloningChanges = FeatureFlags.ENABLE_APP_CLONING_CHANGES_IN_LAUNCHER.get();
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(WORK_TAB_MISSING, "matcher flag: " + cloningChanges);
|
||||
}
|
||||
if (cloningChanges) {
|
||||
mMatcher = ofWorkProfileUser(userManager);
|
||||
} else {
|
||||
mMatcher = mAllApps.mPersonalMatcher.negate();
|
||||
}
|
||||
mMatcher = mAllApps.mPersonalMatcher.negate();
|
||||
mStatsLogManager = statsLogManager;
|
||||
}
|
||||
|
||||
@@ -280,27 +270,4 @@ public class WorkProfileManager implements PersonalWorkSlidingTabStrip.OnActiveP
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter to only display apps in managed profile in work tab.
|
||||
*/
|
||||
private Predicate<ItemInfo> ofWorkProfileUser(UserManager um) {
|
||||
return info -> info != null && isManagedProfile(um, info.user.hashCode());
|
||||
}
|
||||
|
||||
|
||||
private static boolean isManagedProfile(UserManager um, int userId) {
|
||||
try {
|
||||
// isManagedProfile is a @SystemApi.
|
||||
String methodName = "isManagedProfile";
|
||||
Method method = um.getClass().getDeclaredMethod(methodName, int.class);
|
||||
Object result = method.invoke(um, userId);
|
||||
if (result instanceof Boolean) {
|
||||
return (boolean) result;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to call #isManagedProfile via reflection from Launcher");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,11 +213,6 @@ public final class FeatureFlags {
|
||||
public static final BooleanFlag ENABLE_TRANSIENT_TASKBAR = getDebugFlag(270395798,
|
||||
"ENABLE_TRANSIENT_TASKBAR", ENABLED, "Enables transient taskbar.");
|
||||
|
||||
// TODO(Block 15): Clean up flags
|
||||
public static final BooleanFlag ENABLE_APP_CLONING_CHANGES_IN_LAUNCHER = getDebugFlag(266177840,
|
||||
"ENABLE_APP_CLONING_CHANGES_IN_LAUNCHER", DISABLED,
|
||||
"Removes clone apps from the work profile tab.");
|
||||
|
||||
// TODO(Block 16): Clean up flags
|
||||
// When enabled the promise icon is visible in all apps while installation an app.
|
||||
public static final BooleanFlag PROMISE_APPS_IN_ALL_APPS = getDebugFlag(270390012,
|
||||
|
||||
Reference in New Issue
Block a user