本文整理汇总了Java中android.content.pm.PackageInstaller.SessionInfo.getAppPackageName方法的典型用法代码示例。如果您正苦于以下问题:Java SessionInfo.getAppPackageName方法的具体用法?Java SessionInfo.getAppPackageName怎么用?Java SessionInfo.getAppPackageName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.pm.PackageInstaller.SessionInfo
的用法示例。
在下文中一共展示了SessionInfo.getAppPackageName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAndGetActiveSessionCache
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
@Override
public HashMap<String, Integer> updateAndGetActiveSessionCache() {
HashMap<String, Integer> activePackages = new HashMap<>();
UserHandle user = Process.myUserHandle();
for (SessionInfo info : mInstaller.getAllSessions()) {
addSessionInfoToCache(info, user);
if (info.getAppPackageName() != null) {
activePackages.put(info.getAppPackageName(), (int) (info.getProgress() * 100));
mActiveSessions.put(info.getSessionId(), info.getAppPackageName());
}
}
return activePackages;
}
示例2: addSessionInfoToCache
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
@Thunk private void addSessionInfoToCache(SessionInfo info, UserHandle user) {
String packageName = info.getAppPackageName();
if (packageName != null) {
mCache.cachePackageInstallInfo(packageName, user, info.getAppIcon(),
info.getAppLabel());
}
}
示例3: onProgressChanged
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
@Override
public void onProgressChanged(int sessionId, float progress) {
SessionInfo session = mInstaller.getSessionInfo(sessionId);
if (session != null && session.getAppPackageName() != null) {
sendUpdate(new PackageInstallInfo(session.getAppPackageName(),
STATUS_INSTALLING,
(int) (session.getProgress() * 100)));
}
}
示例4: pushSessionDisplayToLauncher
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
private void pushSessionDisplayToLauncher(int sessionId) {
SessionInfo session = mInstaller.getSessionInfo(sessionId);
if (session != null && session.getAppPackageName() != null) {
addSessionInfoToCache(session, Process.myUserHandle());
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null) {
app.getModel().updateSessionDisplayInfo(session.getAppPackageName());
}
}
}
示例5: updateAndGetActiveSessionCache
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
@Override
public HashMap<String, Integer> updateAndGetActiveSessionCache() {
HashMap<String, Integer> activePackages = new HashMap<>();
UserHandleCompat user = UserHandleCompat.myUserHandle();
for (SessionInfo info : mInstaller.getAllSessions()) {
addSessionInfoToCahce(info, user);
if (info.getAppPackageName() != null) {
activePackages.put(info.getAppPackageName(), (int) (info.getProgress() * 100));
mActiveSessions.put(info.getSessionId(), info.getAppPackageName());
}
}
return activePackages;
}
示例6: addSessionInfoToCahce
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
@Thunk void addSessionInfoToCahce(SessionInfo info, UserHandleCompat user) {
String packageName = info.getAppPackageName();
if (packageName != null) {
mCache.cachePackageInstallInfo(packageName, user, info.getAppIcon(),
info.getAppLabel());
}
}
示例7: pushSessionDisplayToLauncher
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
private void pushSessionDisplayToLauncher(int sessionId) {
SessionInfo session = mInstaller.getSessionInfo(sessionId);
if (session != null && session.getAppPackageName() != null) {
addSessionInfoToCahce(session, UserHandleCompat.myUserHandle());
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null) {
app.getModel().updateSessionDisplayInfo(session.getAppPackageName());
}
}
}
示例8: updateAndGetActiveSessionCache
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
@Override
public HashSet<String> updateAndGetActiveSessionCache() {
HashSet<String> activePackages = new HashSet<String>();
UserHandleCompat user = UserHandleCompat.myUserHandle();
for (SessionInfo info : mInstaller.getAllSessions()) {
addSessionInfoToCahce(info, user);
if (info.getAppPackageName() != null) {
activePackages.add(info.getAppPackageName());
}
}
return activePackages;
}
示例9: addSessionInfoToCahce
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
private void addSessionInfoToCahce(SessionInfo info, UserHandleCompat user) {
String packageName = info.getAppPackageName();
if (packageName != null) {
mCache.cachePackageInstallInfo(packageName, user, info.getAppIcon(),
info.getAppLabel());
}
}
示例10: onFinished
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
@Override
public void onFinished(int sessionId, boolean success) {
mPendingReplays.remove(sessionId);
SessionInfo session = mInstaller.getSessionInfo(sessionId);
if ((session != null) && (session.getAppPackageName() != null)) {
mPendingBadgeUpdates.remove(session.getAppPackageName());
// Replay all updates with a one time update for this installed package. No
// need to store this record for future updates, as the app list will get
// refreshed on resume.
replayUpdates(new PackageInstallInfo(session.getAppPackageName(),
success ? STATUS_INSTALLED : STATUS_FAILED, 0));
}
}
示例11: pushSessionBadgeToLauncher
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
private void pushSessionBadgeToLauncher(int sessionId) {
SessionInfo session = mInstaller.getSessionInfo(sessionId);
if (session != null) {
addSessionInfoToCahce(session, UserHandleCompat.myUserHandle());
if (session.getAppPackageName() != null) {
mPendingBadgeUpdates.add(session.getAppPackageName());
}
mPendingReplays.put(sessionId, session);
replayUpdates(null);
}
}
示例12: replayUpdates
import android.content.pm.PackageInstaller.SessionInfo; //导入方法依赖的package包/类
private void replayUpdates(PackageInstallInfo newInfo) {
if (DEBUG) Log.d(TAG, "updates resumed");
if (!mResumed || !mBound) {
// Not yet ready
return;
}
if ((mPendingReplays.size() == 0) && (newInfo == null)) {
// Nothing to update
return;
}
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app == null) {
// Try again later
if (DEBUG) Log.d(TAG, "app is null, delaying send");
return;
}
ArrayList<PackageInstallInfo> updates = new ArrayList<PackageInstallInfo>();
if ((newInfo != null) && (newInfo.state != STATUS_INSTALLED)) {
updates.add(newInfo);
}
for (int i = mPendingReplays.size() - 1; i >= 0; i--) {
SessionInfo session = mPendingReplays.valueAt(i);
if (session.getAppPackageName() != null) {
updates.add(new PackageInstallInfo(session.getAppPackageName(),
STATUS_INSTALLING,
(int) (session.getProgress() * 100)));
}
}
mPendingReplays.clear();
if (!updates.isEmpty()) {
app.setPackageState(updates);
}
if (!mPendingBadgeUpdates.isEmpty()) {
for (String pkg : mPendingBadgeUpdates) {
app.updatePackageBadge(pkg);
}
mPendingBadgeUpdates.clear();
}
}