本文整理汇总了Java中android.os.Binder.getCallingPid方法的典型用法代码示例。如果您正苦于以下问题:Java Binder.getCallingPid方法的具体用法?Java Binder.getCallingPid怎么用?Java Binder.getCallingPid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Binder
的用法示例。
在下文中一共展示了Binder.getCallingPid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachPluginProcess
import android.os.Binder; //导入方法依赖的package包/类
@Override
public String attachPluginProcess(String process, int index, IBinder binder, String def) throws RemoteException {
int pid = Binder.getCallingPid();
IPluginClient client = null;
try {
client = IPluginClient.Stub.asInterface(binder);
} catch (Throwable e) {
if (LOGR) {
LogRelease.e(PLUGIN_TAG, "a.p.p pc.s.ai: " + e.getMessage(), e);
}
}
if (client == null) {
return null;
}
return PluginProcessMain.attachProcess(pid, process, index, binder, client, def, mManager);
}
示例2: reloadLauncherIfExternal
import android.os.Binder; //导入方法依赖的package包/类
private void reloadLauncherIfExternal() {
if (AndroidVersion.isAtLeastMarshmallow && Binder.getCallingPid() != Process.myPid()) {
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null) {
app.getModel().forceReload();
}
}
}
示例3: insert
import android.os.Binder; //导入方法依赖的package包/类
@Override
public Uri insert(@NonNull Uri uri, ContentValues initialValues) {
createDbIfNotExists();
SqlArguments args = new SqlArguments(uri);
// In very limited cases, we support system|signature permission apps to modify the db.
if (Binder.getCallingPid() != Process.myPid()) {
if (!initializeExternalAdd(initialValues)) {
return null;
}
}
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
addModifiedTime(initialValues);
final long rowId = dbInsertAndCheck(mOpenHelper, db, args.table, null, initialValues);
if (rowId < 0) return null;
uri = ContentUris.withAppendedId(uri, rowId);
notifyListeners();
if (AndroidVersion.isAtLeastMarshmallow) {
reloadLauncherIfExternal();
} else {
// Deprecated behavior to support legacy devices which rely on provider callbacks.
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null && "true".equals(uri.getQueryParameter("isExternalAdd"))) {
app.getModel().forceReload();
}
String notify = uri.getQueryParameter("notify");
if (notify == null || "true".equals(notify)) {
getContext().getContentResolver().notifyChange(uri, null);
}
}
return uri;
}
示例4: shouldRestrictVisibility
import android.os.Binder; //导入方法依赖的package包/类
/**
* @return true if we should restrict the columns readable by this caller
*/
private boolean shouldRestrictVisibility() {
int callingUid = Binder.getCallingUid();
return Binder.getCallingPid() != Process.myPid() &&
callingUid != mSystemUid &&
callingUid != mDefContainerUid;
}
示例5: getCallingPid
import android.os.Binder; //导入方法依赖的package包/类
public static int getCallingPid() {
return Binder.getCallingPid();
}
示例6: onGetCallingUid
import android.os.Binder; //导入方法依赖的package包/类
public static int onGetCallingUid(int originUid) {
int callingPid = Binder.getCallingPid();
if (callingPid == Process.myPid()) {
return VClientImpl.get().getBaseVUid();
}
if (callingPid == VirtualCore.get().getSystemPid()) {
return Process.SYSTEM_UID;
}
int vuid = VActivityManager.get().getUidByPid(callingPid);
if (vuid != -1) {
return VUserHandle.getAppId(vuid);
}
VLog.d(TAG, "Unknown uid: " + callingPid);
return VClientImpl.get().getBaseVUid();
}
示例7: reloadLauncherIfExternal
import android.os.Binder; //导入方法依赖的package包/类
private void reloadLauncherIfExternal() {
if (Utilities.ATLEAST_MARSHMALLOW && Binder.getCallingPid() != Process.myPid()) {
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null) {
app.reloadWorkspace();
}
}
}
示例8: onActivityCreated
import android.os.Binder; //导入方法依赖的package包/类
@Override
public void onActivityCreated(ComponentName component, ComponentName caller, IBinder token, Intent intent, String affinity, int taskId, int launchMode, int flags) {
int pid = Binder.getCallingPid();
ProcessRecord targetApp = findProcessLocked(pid);
if (targetApp != null) {
mMainStack.onActivityCreated(targetApp, component, caller, token, intent, affinity, taskId, launchMode, flags);
}
}
示例9: insert
import android.os.Binder; //导入方法依赖的package包/类
@Override
public Uri insert(Uri uri, ContentValues initialValues) {
createDbIfNotExists();
SqlArguments args = new SqlArguments(uri);
// In very limited cases, we support system|signature permission apps to modify the db.
if (Binder.getCallingPid() != Process.myPid()) {
if (!initializeExternalAdd(initialValues)) {
return null;
}
}
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
addModifiedTime(initialValues);
final long rowId = dbInsertAndCheck(mOpenHelper, db, args.table, null, initialValues);
if (rowId < 0) return null;
uri = ContentUris.withAppendedId(uri, rowId);
notifyListeners();
if (Utilities.ATLEAST_MARSHMALLOW) {
reloadLauncherIfExternal();
} else {
// Deprecated behavior to support legacy devices which rely on provider callbacks.
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null && "true".equals(uri.getQueryParameter("isExternalAdd"))) {
app.reloadWorkspace();
}
String notify = uri.getQueryParameter("notify");
if (notify == null || "true".equals(notify)) {
getContext().getContentResolver().notifyChange(uri, null);
}
}
return uri;
}
示例10: delete
import android.os.Binder; //导入方法依赖的package包/类
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
createDbIfNotExists();
SqlArguments args = new SqlArguments(uri, selection, selectionArgs);
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
if (Binder.getCallingPid() != Process.myPid()
&& Favorites.TABLE_NAME.equalsIgnoreCase(args.table)) {
String widgetSelection = TextUtils.isEmpty(args.where) ? "1=1" : args.where;
widgetSelection = String.format(Locale.ENGLISH, "%1$s = %2$d AND ( %3$s )",
Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPWIDGET, widgetSelection);
try (Cursor c = db.query(Favorites.TABLE_NAME, new String[] { Favorites.APPWIDGET_ID },
widgetSelection, args.args, null, null, null)) {
AppWidgetHost host = new AppWidgetHost(getContext(), Launcher.APPWIDGET_HOST_ID);
while (c.moveToNext()) {
int widgetId = c.getInt(0);
if (widgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
try {
host.deleteAppWidgetId(widgetId);
} catch (RuntimeException e) {
Log.e(TAG, "Error deleting widget id " + widgetId, e);
}
}
}
}
}
int count = db.delete(args.table, args.where, args.args);
if (count > 0) {
notifyListeners();
reloadLauncherIfExternal();
}
return count;
}
示例11: checkCallingPermission
import android.os.Binder; //导入方法依赖的package包/类
public static int checkCallingPermission(@NonNull Context context, @NonNull String permission, String packageName) {
if (Binder.getCallingPid() == Process.myPid()) {
return -1;
}
return checkPermission(context, permission, Binder.getCallingPid(), Binder.getCallingUid(), packageName);
}
示例12: regActivity
import android.os.Binder; //导入方法依赖的package包/类
@Override
public void regActivity(int index, String plugin, String container, String activity) throws RemoteException {
int pid = Binder.getCallingPid();
PluginProcessMain.attachActivity(pid, index, plugin, activity, container);
}
示例13: unregActivity
import android.os.Binder; //导入方法依赖的package包/类
@Override
public void unregActivity(int index, String plugin, String container, String activity) throws RemoteException {
int pid = Binder.getCallingPid();
PluginProcessMain.detachActivity(pid, index, plugin, activity, container);
}
示例14: regService
import android.os.Binder; //导入方法依赖的package包/类
@Override
public void regService(int index, String plugin, String service) throws RemoteException {
int pid = Binder.getCallingPid();
PluginProcessMain.attachService(pid, index, plugin, service);
}
示例15: unregService
import android.os.Binder; //导入方法依赖的package包/类
@Override
public void unregService(int index, String plugin, String service) throws RemoteException {
int pid = Binder.getCallingPid();
PluginProcessMain.detachService(pid, index, plugin, service);
}