當前位置: 首頁>>代碼示例>>Java>>正文


Java ServiceInfo類代碼示例

本文整理匯總了Java中android.content.pm.ServiceInfo的典型用法代碼示例。如果您正苦於以下問題:Java ServiceInfo類的具體用法?Java ServiceInfo怎麽用?Java ServiceInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ServiceInfo類屬於android.content.pm包,在下文中一共展示了ServiceInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleOnStartOne

import android.content.pm.ServiceInfo; //導入依賴的package包/類
private void handleOnStartOne(Intent intent, int flags, int startIds) throws Exception {
    ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
    if (info != null) {
        Service service = (Service) this.mNameService.get(info.name);
        if (service != null) {
            intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
            Object token = findTokenByService(service);
            Integer integer = (Integer) this.mServiceTaskIds.get(token);
            if (integer == null) {
                integer = Integer.valueOf(-1);
            }
            int startId = integer.intValue() + 1;
            this.mServiceTaskIds.put(token, Integer.valueOf(startId));
            int res = service.onStartCommand(intent, flags, startId);
            QueuedWorkCompat.waitToFinish();
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:19,代碼來源:ServcesManager.java

示例2: addServiceInfo

import android.content.pm.ServiceInfo; //導入依賴的package包/類
void addServiceInfo(int pid, int uid, ServiceInfo stubInfo, ServiceInfo targetInfo) {
    ProcessItem item = items.get(pid);
    if (TextUtils.isEmpty(targetInfo.processName)) {
        targetInfo.processName = targetInfo.packageName;
    }
    if (item == null) {
        item = new ProcessItem();
        item.pid = pid;
        item.uid = uid;

        items.put(pid, item);
    }
    item.stubProcessName = stubInfo.processName;
    if (!item.pkgs.contains(targetInfo.packageName)) {
        item.pkgs.add(targetInfo.packageName);
    }
    item.targetProcessName = targetInfo.processName;
    item.addServiceInfo(stubInfo.name, targetInfo);
}
 
開發者ID:amikey,項目名稱:DroidPlugin,代碼行數:20,代碼來源:RunningProcesList.java

示例3: getSuppressorCaption

import android.content.pm.ServiceInfo; //導入依賴的package包/類
private String getSuppressorCaption(ComponentName suppressor) {
    final PackageManager pm = mContext.getPackageManager();
    try {
        final ServiceInfo info = pm.getServiceInfo(suppressor, 0);
        if (info != null) {
            final CharSequence seq = info.loadLabel(pm);
            if (seq != null) {
                final String str = seq.toString().trim();
                if (str.length() > 0) {
                    return str;
                }
            }
        }
    } catch (Throwable e) {
        Log.w(TAG, "Error loading suppressor caption", e);
    }
    return suppressor.getPackageName();
}
 
開發者ID:ric96,項目名稱:lineagex86,代碼行數:19,代碼來源:SoundSettings.java

示例4: newResult

import android.content.pm.ServiceInfo; //導入依賴的package包/類
@Override
protected ResolveInfo newResult(VPackage.ServiceIntentInfo filter, int match, int userId) {
    final VPackage.ServiceComponent service = filter.service;
    PackageSetting ps = (PackageSetting) service.owner.mExtras;
    ServiceInfo si = PackageParserEx.generateServiceInfo(service, mFlags, ps.readUserState(userId), userId);
    if (si == null) {
        return null;
    }
    final ResolveInfo res = new ResolveInfo();
    res.serviceInfo = si;
    if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) {
        res.filter = filter.filter;
    }
    res.priority = filter.filter.getPriority();
    res.preferredOrder = service.owner.mPreferredOrder;
    res.match = match;
    res.isDefault = filter.hasDefault;
    res.labelRes = filter.labelRes;
    res.nonLocalizedLabel = filter.nonLocalizedLabel;
    res.icon = filter.icon;
    return res;
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:23,代碼來源:VPackageManagerService.java

示例5: newResult

import android.content.pm.ServiceInfo; //導入依賴的package包/類
@Override
protected ResolveInfo newResult(PackageParser.ServiceIntentInfo filter, int match) {
	final PackageParser.Service service = filter.service;
	ServiceInfo si = PackageParserCompat.generateServiceInfo(service, mFlags);
	if (si == null) {
		return null;
	}
	final ResolveInfo res = new ResolveInfo();
	res.serviceInfo = si;
	if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) {
		res.filter = filter;
	}
	res.priority = filter.getPriority();
	res.preferredOrder = service.owner.mPreferredOrder;
	res.match = match;
	res.isDefault = filter.hasDefault;
	res.labelRes = filter.labelRes;
	res.nonLocalizedLabel = filter.nonLocalizedLabel;
	res.icon = filter.icon;
	return res;
}
 
開發者ID:codehz,項目名稱:container,代碼行數:22,代碼來源:VPackageManagerService.java

示例6: getLabel

import android.content.pm.ServiceInfo; //導入依賴的package包/類
public static Pair<String, String> getLabel(Context context, String comboAsString) {
    String recognizer = "[?]";
    String language = "[?]";
    String[] splits = TextUtils.split(comboAsString, SEPARATOR);
    if (splits.length > 0) {
        PackageManager pm = context.getPackageManager();
        ComponentName recognizerComponentName = ComponentName.unflattenFromString(splits[0]);
        if (recognizerComponentName != null) {
            try {
                ServiceInfo si = pm.getServiceInfo(recognizerComponentName, 0);
                recognizer = si.loadLabel(pm).toString();
            } catch (PackageManager.NameNotFoundException e) {
                // ignored
            }
        }
    }
    if (splits.length > 1) {
        language = makeLangLabel(splits[1]);
    }
    return new Pair<>(recognizer, language);
}
 
開發者ID:vaibhavs4424,項目名稱:AI-Powered-Intelligent-Banking-Platform,代碼行數:22,代碼來源:RecognitionServiceManager.java

示例7: call

import android.content.pm.ServiceInfo; //導入依賴的package包/類
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IInterface appThread = (IInterface) args[0];
    Intent service = (Intent) args[1];
    String resolvedType = (String) args[2];
    if (service.getComponent() != null
            && getHostPkg().equals(service.getComponent().getPackageName())) {
        // for server process
        return method.invoke(who, args);
    }
    int userId = VUserHandle.myUserId();
    if (service.getBooleanExtra("_VA_|_from_inner_", false)) {
        userId = service.getIntExtra("_VA_|_user_id_", userId);
        service = service.getParcelableExtra("_VA_|_intent_");
    } else {
        if (isServerProcess()) {
            userId = service.getIntExtra("_VA_|_user_id_", VUserHandle.USER_NULL);
        }
    }
    service.setDataAndType(service.getData(), resolvedType);
    ServiceInfo serviceInfo = VirtualCore.get().resolveServiceInfo(service, VUserHandle.myUserId());
    if (serviceInfo != null) {
        return VActivityManager.get().startService(appThread, service, resolvedType, userId);
    }
    return method.invoke(who, args);
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:27,代碼來源:MethodProxies.java

示例8: handleOnTaskRemovedOne

import android.content.pm.ServiceInfo; //導入依賴的package包/類
private void handleOnTaskRemovedOne(Intent intent) throws Exception {
    if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
        ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
        if (info != null) {
            Service service = mNameService.get(info.name);
            if (service != null) {
                ClassLoader classLoader = getClassLoader(info.applicationInfo);
                intent.setExtrasClassLoader(classLoader);
                service.onTaskRemoved(intent);
                QueuedWorkCompat.waitToFinish();
            }
            QueuedWorkCompat.waitToFinish();
        }
    }
}
 
開發者ID:amikey,項目名稱:DroidPlugin,代碼行數:16,代碼來源:ServcesManager.java

示例9: getServiceInfo

import android.content.pm.ServiceInfo; //導入依賴的package包/類
public ServiceInfo getServiceInfo(ComponentName className, int flags) throws NameNotFoundException, RemoteException {
    ServiceInfo serviceInfo = null;
    if (className != null) {
        try {
            if (!(this.mApkManager == null || className == null)) {
                serviceInfo = this.mApkManager.getServiceInfo(className, flags);
            }
        } catch (RemoteException e) {
            JLog.log("wuxinrong", "獲取svervice信息 失敗 e=" + e.getMessage());
            throw e;
        } catch (Exception e2) {
            JLog.log("wuxinrong", "獲取svervice信息 失敗 e=" + e2.getMessage());
        }
    }
    return serviceInfo;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:17,代碼來源:ApkManager.java

示例10: handleOnTaskRemovedOne

import android.content.pm.ServiceInfo; //導入依賴的package包/類
private void handleOnTaskRemovedOne(Intent intent) throws Exception {
    if (VERSION.SDK_INT >= 14) {
        ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
        if (info != null) {
            Service service = (Service) this.mNameService.get(info.name);
            if (service != null) {
                intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
                service.onTaskRemoved(intent);
                QueuedWorkCompat.waitToFinish();
            }
            QueuedWorkCompat.waitToFinish();
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:15,代碼來源:ServcesManager.java

示例11: handleOnBindOne

import android.content.pm.ServiceInfo; //導入依賴的package包/類
private IBinder handleOnBindOne(Intent intent) throws Exception {
    ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
    if (info != null) {
        Service service = (Service) this.mNameService.get(info.name);
        if (service != null) {
            intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
            return service.onBind(intent);
        }
    }
    return null;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:12,代碼來源:ServcesManager.java

示例12: getServiceInfo

import android.content.pm.ServiceInfo; //導入依賴的package包/類
@Override
public ServiceInfo getServiceInfo(ComponentName component, int flags, int userId) {
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    synchronized (mPackages) {
        VPackage p = mPackages.get(component.getPackageName());
        if (p != null) {
            PackageSetting ps = (PackageSetting) p.mExtras;
            VPackage.ServiceComponent s = mServices.mServices.get(component);
            if (s != null) {
                ServiceInfo serviceInfo = PackageParserEx.generateServiceInfo(s, flags, ps.readUserState(userId), userId);
                ComponentFixer.fixComponentInfo(ps, serviceInfo, userId);
                return serviceInfo;
            }
        }
    }
    return null;
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:19,代碼來源:VPackageManagerService.java

示例13: handleOnUnbindOne

import android.content.pm.ServiceInfo; //導入依賴的package包/類
private boolean handleOnUnbindOne(Intent intent) throws Exception {
    ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
    if (info == null) {
        return false;
    }
    Service service = (Service) this.mNameService.get(info.name);
    if (service == null) {
        return false;
    }
    intent.setExtrasClassLoader(getClassLoader(info.applicationInfo));
    return service.onUnbind(intent);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:ServcesManager.java

示例14: stopServiceToken

import android.content.pm.ServiceInfo; //導入依賴的package包/類
public boolean stopServiceToken(ComponentName cn, IBinder token, int startId) throws Exception {
    if (((Service) this.mTokenServices.get(token)) == null) {
        return false;
    }
    Integer lastId = (Integer) this.mServiceTaskIds.get(token);
    if (lastId == null || startId != lastId.intValue()) {
        return false;
    }
    Intent intent = new Intent();
    intent.setComponent(cn);
    ServiceInfo info = ApkManager.getInstance().resolveServiceInfo(intent, 0);
    if (info == null) {
        return false;
    }
    handleOnUnbindOne(intent);
    handleOnDestroyOne(info);
    return true;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:19,代碼來源:ServcesManager.java

示例15: t

import android.content.pm.ServiceInfo; //導入依賴的package包/類
public static List<ComponentName> t(Context context) {
    z.b();
    List<ComponentName> arrayList = new ArrayList();
    PackageManager packageManager = context.getPackageManager();
    Intent intent = new Intent();
    intent.setAction(z[98]);
    List queryIntentServices = packageManager.queryIntentServices(intent, 0);
    if (queryIntentServices == null || queryIntentServices.size() == 0) {
        return null;
    }
    for (int i = 0; i < queryIntentServices.size(); i++) {
        ServiceInfo serviceInfo = ((ResolveInfo) queryIntentServices.get(i)).serviceInfo;
        String str = serviceInfo.name;
        String str2 = serviceInfo.packageName;
        if (serviceInfo.exported && serviceInfo.enabled && !e.c.equals(str2)) {
            new StringBuilder(z[97]).append(str2).append("/").append(str).append("}");
            z.b();
            arrayList.add(new ComponentName(str2, str));
        }
    }
    return arrayList;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:23,代碼來源:a.java


注:本文中的android.content.pm.ServiceInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。