本文整理汇总了Scala中android.content.pm.PackageManager类的典型用法代码示例。如果您正苦于以下问题:Scala PackageManager类的具体用法?Scala PackageManager怎么用?Scala PackageManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PackageManager类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: ResolvedPlugin
//设置package包名称以及导入依赖的类
package com.github.shadowsocks.plugin
import android.content.pm.{PackageManager, ResolveInfo}
import android.graphics.drawable.Drawable
import android.os.Bundle
import com.github.shadowsocks.ShadowsocksApplication.app
abstract class ResolvedPlugin(resolveInfo: ResolveInfo, packageManager: PackageManager = app.getPackageManager)
extends Plugin {
protected def metaData: Bundle
override final lazy val id: String = metaData.getString(PluginContract.METADATA_KEY_ID)
override final lazy val label: CharSequence = resolveInfo.loadLabel(packageManager)
override final lazy val icon: Drawable = resolveInfo.loadIcon(packageManager)
override final lazy val defaultConfig: String = metaData.getString(PluginContract.METADATA_KEY_DEFAULT_CONFIG)
override def packageName: String = resolveInfo.resolvePackageName
override final lazy val trusted: Boolean = packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES)
.signatures.exists(PluginManager.trustedSignatures.contains)
}