Merge "Revert "Do not display clone apps in launcher work tab."" into udc-dev

This commit is contained in:
Himanshu Gupta
2023-05-17 11:44:57 +00:00
committed by Android (Google) Code Review
2 changed files with 1 additions and 39 deletions

View File

@@ -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;
}
}

View File

@@ -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,