Merge "Add logging for adding pending icons to the workspace." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
adfbdcf8fe
@@ -24,6 +24,7 @@ import android.content.pm.PackageInstaller.SessionInfo;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.WorkerThread;
|
import androidx.annotation.WorkerThread;
|
||||||
|
|
||||||
@@ -36,6 +37,8 @@ import com.android.launcher3.util.Executors;
|
|||||||
*/
|
*/
|
||||||
public class SessionCommitReceiver extends BroadcastReceiver {
|
public class SessionCommitReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
|
private static final String LOG = "SessionCommitReceiver";
|
||||||
|
|
||||||
// Preference key for automatically adding icon to homescreen.
|
// Preference key for automatically adding icon to homescreen.
|
||||||
public static final String ADD_ICON_PREFERENCE_KEY = "pref_add_icon_to_home";
|
public static final String ADD_ICON_PREFERENCE_KEY = "pref_add_icon_to_home";
|
||||||
|
|
||||||
@@ -68,6 +71,11 @@ public class SessionCommitReceiver extends BroadcastReceiver {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.i(LOG,
|
||||||
|
"Adding package name to install queue. Package name: " + info.getAppPackageName()
|
||||||
|
+ ", has app icon: " + (info.getAppIcon() != null)
|
||||||
|
+ ", has app label: " + !TextUtils.isEmpty(info.getAppLabel()));
|
||||||
|
|
||||||
ItemInstallQueue.INSTANCE.get(context)
|
ItemInstallQueue.INSTANCE.get(context)
|
||||||
.queueItem(info.getAppPackageName(), user);
|
.queueItem(info.getAppPackageName(), user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.content.pm.LauncherActivityInfo;
|
|||||||
import android.content.pm.LauncherApps;
|
import android.content.pm.LauncherApps;
|
||||||
import android.content.pm.PackageInstaller.SessionInfo;
|
import android.content.pm.PackageInstaller.SessionInfo;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.LongSparseArray;
|
import android.util.LongSparseArray;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
|
||||||
@@ -47,6 +48,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
|
public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
|
||||||
|
|
||||||
|
private static final String LOG = "AddWorkspaceItemsTask";
|
||||||
|
|
||||||
private final List<Pair<ItemInfo, Object>> mItemList;
|
private final List<Pair<ItemInfo, Object>> mItemList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,6 +170,8 @@ public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
|
|||||||
|
|
||||||
// Save the WorkspaceItemInfo for binding in the workspace
|
// Save the WorkspaceItemInfo for binding in the workspace
|
||||||
addedItemsFinal.add(itemInfo);
|
addedItemsFinal.add(itemInfo);
|
||||||
|
|
||||||
|
Log.i(LOG, "Adding item info to workspace: " + itemInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ import java.util.stream.Stream;
|
|||||||
*/
|
*/
|
||||||
public class ItemInstallQueue {
|
public class ItemInstallQueue {
|
||||||
|
|
||||||
|
private static final String LOG = "ItemInstallQueue";
|
||||||
|
|
||||||
public static final int FLAG_ACTIVITY_PAUSED = 1;
|
public static final int FLAG_ACTIVITY_PAUSED = 1;
|
||||||
public static final int FLAG_LOADER_RUNNING = 2;
|
public static final int FLAG_LOADER_RUNNING = 2;
|
||||||
public static final int FLAG_DRAG_AND_DROP = 4;
|
public static final int FLAG_DRAG_AND_DROP = 4;
|
||||||
@@ -183,7 +185,17 @@ public class ItemInstallQueue {
|
|||||||
|
|
||||||
private void queuePendingShortcutInfo(PendingInstallShortcutInfo info) {
|
private void queuePendingShortcutInfo(PendingInstallShortcutInfo info) {
|
||||||
// Queue the item up for adding if launcher has not loaded properly yet
|
// Queue the item up for adding if launcher has not loaded properly yet
|
||||||
MODEL_EXECUTOR.post(() -> addToQueue(info));
|
MODEL_EXECUTOR.post(() -> {
|
||||||
|
Pair<ItemInfo, Object> itemInfo = info.getItemInfo(mContext);
|
||||||
|
if (itemInfo == null) {
|
||||||
|
Log.i(LOG, "Adding PendingInstallShortcutInfo with no attached info to queue.");
|
||||||
|
} else {
|
||||||
|
Log.i(LOG, "Adding PendingInstallShortcutInfo to queue. Attached info: "
|
||||||
|
+ itemInfo.first);
|
||||||
|
}
|
||||||
|
|
||||||
|
addToQueue(info);
|
||||||
|
});
|
||||||
flushInstallQueue();
|
flushInstallQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.os.Build;
|
|||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
@@ -56,6 +57,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class InstallSessionHelper {
|
public class InstallSessionHelper {
|
||||||
|
|
||||||
|
private static final String LOG = "InstallSessionHelper";
|
||||||
|
|
||||||
// Set<String> of session ids of promise icons that have been added to the home screen
|
// Set<String> of session ids of promise icons that have been added to the home screen
|
||||||
// as FLAG_PROMISE_NEW_INSTALLS.
|
// as FLAG_PROMISE_NEW_INSTALLS.
|
||||||
protected static final String PROMISE_ICON_IDS = "promise_icon_ids";
|
protected static final String PROMISE_ICON_IDS = "promise_icon_ids";
|
||||||
@@ -219,6 +222,9 @@ public class InstallSessionHelper {
|
|||||||
&& !promiseIconAddedForId(sessionInfo.getSessionId())
|
&& !promiseIconAddedForId(sessionInfo.getSessionId())
|
||||||
&& !new PackageManagerHelper(mAppContext).isAppInstalled(
|
&& !new PackageManagerHelper(mAppContext).isAppInstalled(
|
||||||
sessionInfo.getAppPackageName(), getUserHandle(sessionInfo))) {
|
sessionInfo.getAppPackageName(), getUserHandle(sessionInfo))) {
|
||||||
|
Log.i(LOG, "Adding package name to install queue: "
|
||||||
|
+ sessionInfo.getAppPackageName());
|
||||||
|
|
||||||
ItemInstallQueue.INSTANCE.get(mAppContext)
|
ItemInstallQueue.INSTANCE.get(mAppContext)
|
||||||
.queueItem(sessionInfo.getAppPackageName(), getUserHandle(sessionInfo));
|
.queueItem(sessionInfo.getAppPackageName(), getUserHandle(sessionInfo));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user