当前位置: 首页>>代码示例>>Java>>正文


Java IBinder类代码示例

本文整理汇总了Java中android.os.IBinder的典型用法代码示例。如果您正苦于以下问题:Java IBinder类的具体用法?Java IBinder怎么用?Java IBinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IBinder类属于android.os包,在下文中一共展示了IBinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showIndicator

import android.os.IBinder; //导入依赖的package包/类
public void showIndicator(View parent, Rect touchBounds) {
    if (isShowing()) {
        mPopupView.mMarker.animateOpen();
        return;
    }

    IBinder windowToken = parent.getWindowToken();
    if (windowToken != null) {
        WindowManager.LayoutParams p = createPopupLayout(windowToken);

        p.gravity = Gravity.TOP | GravityCompat.START;
        updateLayoutParamsForPosiion(parent, p, touchBounds.bottom);
        mShowing = true;

        translateViewIntoPosition(touchBounds.centerX());
        invokePopup(p);
    }
}
 
开发者ID:zacharee,项目名称:SliderPreferenceEmbedded,代码行数:19,代码来源:PopupIndicator.java

示例2: onHook

import android.os.IBinder; //导入依赖的package包/类
@Override
public void onHook(ClassLoader classLoader) throws Throwable {
    //其实有其他的hook点,比如InputMethodManager的sInstance,初始化的时候可以将代理的IInputMethodManager传进构造函数
    //现在的这种方式是从获取Binder代理对象的唯一入口ServiceManager开始hook,方便以后hook其他服务
    ServiceManagerHook serviceManagerHook = new ServiceManagerHook(mContext, Context.INPUT_METHOD_SERVICE);
    serviceManagerHook.onHook(classLoader);
    Object originBinder = serviceManagerHook.getOriginObj();
    if (originBinder instanceof IBinder) {
        mOriginObj = IInputMethodManagerCompat.asInterface((IBinder) originBinder);
        Object proxyInputMethodInterface = ReflectUtil.makeProxy(classLoader, mOriginObj.getClass(), this);
        serviceManagerHook.setProxyIInterface(proxyInputMethodInterface);
        //若hook之前调用过 mContext.getSystemService(Context.INPUT_METHOD_SERVICE)
        // 则在SystemServiceRegistry中会有缓存,清理缓存后重建才会拿到我们hook的代理
        clearCachedService();
        //rebuild cache
        mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
    }
}
 
开发者ID:pqpo,项目名称:InputMethodHolder,代码行数:19,代码来源:InputMethodManagerHook.java

示例3: onServiceConnected

import android.os.IBinder; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    Log.d(TAG, "onServiceConnected: " + name.flattenToShortString() + ", " + service.toString());

    mUpnpService = (AndroidUpnpService) service;

    Device device = mUpnpService.getRegistry().getDevice(new UDN(mDeviceUdn), false);
    mContentDirectoryService = device.findService(new UDAServiceType("ContentDirectory"));
    if (mContentDirectoryService == null) {
        throw new IllegalStateException("Unable to find ContentDirectory service for device "
                + mDeviceUdn);
    }
    mDeviceName = (device.getDetails() != null && device.getDetails().getFriendlyName() != null)
            ? device.getDetails().getFriendlyName() : device.getDisplayString();

    selectContainer(mCurrentContainer);
}
 
开发者ID:stephenmcgruer,项目名称:simple-upnp,代码行数:18,代码来源:FileBrowserFragment.java

示例4: insertConnectionToRecords

import android.os.IBinder; //导入依赖的package包/类
private void insertConnectionToRecords(ServiceRecord sr, ProcessBindRecord b, IServiceConnection connection, int flags) {
    ConnectionBindRecord c = new ConnectionBindRecord(b, connection, flags);
    IBinder binder = connection.asBinder();

    // ServiceRecord.connections<Map - Key:IBinder>
    ArrayList<ConnectionBindRecord> clist = sr.connections.get(binder);
    if (clist == null) {
        clist = new ArrayList<>();
        sr.connections.put(binder, clist);
    }
    clist.add(c);

    // ProcessBindRecord.connections<List>
    b.connections.add(c);

    // ProcessRecord.connections<List>
    b.client.connections.add(c);

    // PluginServiceServer.mServiceConnections<Map - Key:IBinder>
    clist = mServiceConnections.get(binder);
    if (clist == null) {
        clist = new ArrayList<>();
        mServiceConnections.put(binder, clist);
    }
    clist.add(c);
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:27,代码来源:PluginServiceServer.java

示例5: afterCall

import android.os.IBinder; //导入依赖的package包/类
@Override
public Object afterCall(Object who, Method method, Object[] args, Object result) throws Throwable {
	IBinder token = (IBinder) args[0];
	ActivityClientRecord r = VActivityManager.get().getActivityRecord(token);
	boolean taskRemoved = VActivityManager.get().onActivityDestroy(token);
	if (!taskRemoved && r != null && r.activity != null && r.info.getThemeResource() != 0) {
		try {
               TypedValue out = new TypedValue();
               Resources.Theme theme = r.activity.getResources().newTheme();
               theme.applyStyle(r.info.getThemeResource(), true);
               if (theme.resolveAttribute(android.R.attr.windowAnimationStyle, out, true)) {

                   TypedArray array = theme.obtainStyledAttributes(out.data,
                           new int[]{
                                   android.R.attr.activityCloseEnterAnimation,
                                   android.R.attr.activityCloseExitAnimation
                           });
                   r.activity.overridePendingTransition(array.getResourceId(0, 0), array.getResourceId(1, 0));
                   array.recycle();
               }
           } catch (Throwable e) {
               e.printStackTrace();
           }
	}
	return super.afterCall(who, method, args, result);
}
 
开发者ID:codehz,项目名称:container,代码行数:27,代码来源:FinishActivity.java

示例6: realStartActivitiesLocked

import android.os.IBinder; //导入依赖的package包/类
private void realStartActivitiesLocked(IBinder resultTo, Intent[] intents, String[] resolvedTypes, Bundle options) {
    Class<?>[] types = IActivityManager.startActivities.paramList();
    Object[] args = new Object[types.length];
    if (types[0] == IApplicationThread.TYPE) {
        args[0] = ActivityThread.getApplicationThread.call(VirtualCore.mainThread());
    }
    int pkgIndex = ArrayUtils.protoIndexOf(types, String.class);
    int intentsIndex = ArrayUtils.protoIndexOf(types, Intent[].class);
    int resultToIndex = ArrayUtils.protoIndexOf(types, IBinder.class, 2);
    int optionsIndex = ArrayUtils.protoIndexOf(types, Bundle.class);
    int resolvedTypesIndex = intentsIndex + 1;
    if (pkgIndex != -1) {
        args[pkgIndex] = VirtualCore.get().getHostPkg();
    }
    args[intentsIndex] = intents;
    args[resultToIndex] = resultTo;
    args[resolvedTypesIndex] = resolvedTypes;
    args[optionsIndex] = options;
    ClassUtils.fixArgs(types, args);
    IActivityManager.startActivities.call(ActivityManagerNative.getDefault.call(),
            (Object[]) args);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:23,代码来源:ActivityStack.java

示例7: onServiceConnected

import android.os.IBinder; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    // Ignore this call if we disconnected in the meantime.
    if (mContext == null) return;

    mService = new Messenger(service);
    mComponentName = name;
    try {
        Message registerClientMessage = Message.obtain(
                null, REQUEST_REGISTER_CLIENT);
        registerClientMessage.replyTo = mMessenger;
        Bundle b = mGsaHelper.getBundleForRegisteringGSAClient(mContext);
        registerClientMessage.setData(b);
        registerClientMessage.getData().putString(
                KEY_GSA_PACKAGE_NAME, mContext.getPackageName());
        mService.send(registerClientMessage);
        // Send prepare overlay message if there is a pending GSA context.
    } catch (RemoteException e) {
        Log.w(SERVICE_CONNECTION_TAG, "GSAServiceConnection - remote call failed", e);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:GSAServiceClient.java

示例8: getService

import android.os.IBinder; //导入依赖的package包/类
@Override
public IBinder getService(final Context context, ClassLoader classLoader, IBinder binder) {
	return new StubBinder(classLoader, binder) {
		@Override
		public InvocationHandler createHandler(Class<?> interfaceClass, final IInterface base) {
			return new InvocationHandler() {
				@Override
				public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
					try {
						return method.invoke(base, args);
					} catch (InvocationTargetException e) {
						if (e.getCause() != null) {
							throw e.getCause();
						}
						throw e;
					}
				}
			};
		}
	};
}
 
开发者ID:codehz,项目名称:container,代码行数:22,代码来源:ProxyServiceFactory.java

示例9: onActivityCreated

import android.os.IBinder; //导入依赖的package包/类
void onActivityCreated(ProcessRecord targetApp, ComponentName component, ComponentName caller, IBinder token,
                       Intent taskRoot, String affinity, int taskId, int launchMode, int flags) {
    synchronized (mHistory) {
        optimizeTasksLocked();
        TaskRecord task = mHistory.get(taskId);
        if (task == null) {
            task = new TaskRecord(taskId, targetApp.userId, affinity, taskRoot);
            mHistory.put(taskId, task);
        }
        ActivityRecord record = new ActivityRecord(task, component, caller, token, targetApp.userId, targetApp,
                launchMode, flags, affinity);
        synchronized (task.activities) {
            task.activities.add(record);
        }
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:17,代码来源:ActivityStack.java

示例10: findActivityByToken

import android.os.IBinder; //导入依赖的package包/类
private ActivityRecord findActivityByToken(int userId, IBinder token) {
    ActivityRecord target = null;
    if (token != null) {
        for (int i = 0; i < this.mHistory.size(); i++) {
            TaskRecord task = this.mHistory.valueAt(i);
            if (task.userId != userId) {
                continue;
            }
            synchronized (task.activities) {
                for (ActivityRecord r : task.activities) {
                    if (r.token == token) {
                        target = r;
                    }
                }
            }
        }
    }
    return target;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:20,代码来源:ActivityStack.java

示例11: onServiceConnected

import android.os.IBinder; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    if (!(service instanceof JobService.Binder)) {
        Log.w(LOG_TAG, "Unknown service connected: " + service);
        stopJob(this, false);
        return;
    }
    binder = (JobService.Binder) service;
    if (!binder.startJob(toLocalParameters(params), JobSchedulerJobService.this)) {
        stopJob(this, false);
    }
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:13,代码来源:JobSchedulerJobService.java

示例12: onServiceConnected

import android.os.IBinder; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    LocalJettyService.JettyBinder jettyBinder = (LocalJettyService.JettyBinder) service;
    jettyService = jettyBinder.getService();
    Server server = jettyService.getServer();
    if(server==null||!server.getState().equals("STARTED")) {
        LogUtils.d(ConstantValues.LOG_PREFIX+"jetty 未启动,开始启动...");
        jettyService.startJetty();
    }else {
        LogUtils.d(ConstantValues.LOG_PREFIX+"jetty 已启动");
    }
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:13,代码来源:BaseProActivity.java

示例13: hookService

import android.os.IBinder; //导入依赖的package包/类
public static void hookService(Context context) {
    IBinder clipboardService = ServiceManager.getService(Context.CLIPBOARD_SERVICE);
    String IClipboard = "android.content.IClipboard";

    if (clipboardService != null) {
        IBinder hookClipboardService =
                (IBinder) Proxy.newProxyInstance(clipboardService.getClass().getClassLoader(),
                        clipboardService.getClass().getInterfaces(),
                        new ServiceHook(clipboardService, IClipboard, true, new ClipboardHookHandler()));
        ServiceManager.setService(Context.CLIPBOARD_SERVICE, hookClipboardService);
    } else {
        Log.e(TAG, "ClipboardService hook failed!");
    }
}
 
开发者ID:zhaozepeng,项目名称:ServiceHook,代码行数:15,代码来源:ClipboardHook.java

示例14: query

import android.os.IBinder; //导入依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection,
		String[] selectionArgs, String sortOrder) {
	IBinder binder = getService(selection);
	BinderCusrsor binderCursor = BinderCusrsor.create(binder);
	return binderCursor;
}
 
开发者ID:devyok,项目名称:IPCServiceManager,代码行数:8,代码来源:IPCService.java

示例15: onActivityResumed

import android.os.IBinder; //导入依赖的package包/类
public void onActivityResumed(Activity activity) {
    IBinder token = mirror.android.app.Activity.mToken.get(activity);
    try {
        getService().onActivityResumed(VUserHandle.myUserId(), token);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:9,代码来源:VActivityManager.java


注:本文中的android.os.IBinder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。