feat: Add option to clear home screen in settings (#6125)
Signed-off-by: abhixv <abhi.sharma1@hotmail.com>
This commit is contained in:
1 parent
9898749619
commit
5f3a03f4fb
1577 files changed
+112559
-80244
No files matched your search
@@ -58,7 +58,7 @@ public class SessionCommitReceiver extends BroadcastReceiver {
|
||||
@WorkerThread
|
||||
private static void processIntent(Context context, Intent intent) {
|
||||
UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER);
|
||||
if (!isEnabled(context, user)) {
|
||||
if (!isEnabled(context)) {
|
||||
// User has decided to not add icons on homescreen.
|
||||
return;
|
||||
}
|
||||
@@ -71,21 +71,17 @@ public class SessionCommitReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
InstallSessionHelper packageInstallerCompat = InstallSessionHelper.INSTANCE.get(context);
|
||||
boolean alreadyAddedPromiseIcon =
|
||||
packageInstallerCompat.promiseIconAddedForId(info.getSessionId());
|
||||
boolean alreadyAddedPromiseIcon = packageInstallerCompat.promiseIconAddedForId(info.getSessionId());
|
||||
if (TextUtils.isEmpty(info.getAppPackageName())
|
||||
|| info.getInstallReason() != PackageManager.INSTALL_REASON_USER
|
||||
|| alreadyAddedPromiseIcon) {
|
||||
FileLog.d(LOG,
|
||||
String.format(Locale.ENGLISH,
|
||||
"Removing unneeded PromiseIcon for package: %s"
|
||||
+ ", install reason: %d,"
|
||||
"Removing PromiseIcon for package: %s, install reason: %d,"
|
||||
+ " alreadyAddedPromiseIcon: %s",
|
||||
info.getAppPackageName(),
|
||||
info.getInstallReason(),
|
||||
alreadyAddedPromiseIcon
|
||||
)
|
||||
);
|
||||
info.getAppPackageName(),
|
||||
info.getInstallReason(),
|
||||
alreadyAddedPromiseIcon));
|
||||
packageInstallerCompat.removePromiseIconId(info.getSessionId());
|
||||
return;
|
||||
}
|
||||
@@ -99,19 +95,9 @@ public class SessionCommitReceiver extends BroadcastReceiver {
|
||||
.queueItem(info.getAppPackageName(), user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether adding Installed App Icons to home screen is allowed or not.
|
||||
* Not allowed when:
|
||||
* - User belongs to {@link com.android.launcher3.util.UserIconInfo.TYPE_PRIVATE} or
|
||||
* - Home Settings preference to add App Icons on Home Screen is set as disabled
|
||||
*/
|
||||
public static boolean isEnabled(Context context, UserHandle user) {
|
||||
if (Flags.privateSpaceRestrictItemDrag()
|
||||
&& PreferenceExtensionsKt.firstBlocking(PreferenceManager2.getInstance(context).getLockHomeScreen())
|
||||
&& user != null
|
||||
&& UserCache.getInstance(context).getUserInfo(user).isPrivate()) {
|
||||
public static boolean isEnabled(Context context) {
|
||||
if (PreferenceExtensionsKt.firstBlocking(PreferenceManager2.getInstance(context).getLockHomeScreen()))
|
||||
return false;
|
||||
}
|
||||
return LauncherPrefs.getPrefs(context).getBoolean(ADD_ICON_PREFERENCE_KEY, true);
|
||||
return Utilities.getPrefs(context).getBoolean(ADD_ICON_PREFERENCE_KEY, true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user