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);
}
}
项目:InputMethodHolder
文件:InputMethodManagerHook.java
@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);
}
}
@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);
}
项目:springreplugin
文件:PluginServiceServer.java
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);
}
项目:container
文件:FinishActivity.java
@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);
}
项目:TPlayer
文件:ActivityStack.java
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);
}
项目:IdealMedia
文件:PopupIndicator.java
public void showIndicator(View parent,touchBounds.bottom);
mShowing = true;
translateViewIntoPosition(touchBounds.centerX());
invokePopup(p);
}
}
项目:chromium-for-android-56-debug-video
文件:GSAServiceClient.java
@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);
}
}
项目:container
文件:ProxyServiceFactory.java
@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,Object[] args) throws Throwable {
try {
return method.invoke(base,args);
} catch (InvocationTargetException e) {
if (e.getCause() != null) {
throw e.getCause();
}
throw e;
}
}
};
}
};
}
项目:TPlayer
文件:ActivityStack.java
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,launchMode,flags,affinity);
synchronized (task.activities) {
task.activities.add(record);
}
}
}
项目:VirtualHook
文件:ActivityStack.java
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;
}
项目:JobSchedulerCompat
文件:JobSchedulerJobService.java
@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);
}
}
项目:Hotspot-master-devp
文件:BaseProActivity.java
@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 已启动");
}
}
项目:ServiceHook
文件:ClipboardHook.java
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!");
}
}
@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;
}
项目:VirtualHook
文件:VActivityManager.java
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();
}
}
项目:react-native-huashi-100u
文件:HsOtgModule.java
@Override
public void onServiceConnected(ComponentName name,IBinder service) {
HSinterface = (HSInterface) service;
int i = 2;
while (i > 0) {
i--;
int ret = HSinterface.init();
if (ret == 1) {
i = 0;
WritableMap result = new WritableNativeMap();
String sam = HSinterface.GetSAM();
result.putString("code","1");
result.putString("sam",sam);
mPromise.resolve(result);
return;
} else {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printstacktrace();
mPromise.reject("0","connect Failed");
}
continue;
}
}
mPromise.reject("0","connect Failed");
}
项目:springreplugin
文件:PmHostSvc.java
@Override
public void installBinder(String name,IBinder binder) throws remoteexception {
if (LOG) {
LogDebug.d(PLUGIN_TAG,"install binder: n=" + name + " b=" + binder);
}
synchronized (PluginProcessMain.sBinders) {
if (binder != null) {
PluginProcessMain.sBinders.put(name,binder);
binder.linkToDeath(new BinderDied(name,binder),0);
} else {
PluginProcessMain.sBinders.remove(name);
}
}
}
项目:prevent
文件:ActivityManagerService.java
public final int startActivity$Pr(IApplicationThread caller,String callingPackage,Intent intent,String resolvedType,IBinder resultTo,String resultWho,int requestCode,int startFlags,String profileFile,ParcelFileDescriptor profileFd,Bundle options) {
throw new UnsupportedOperationException();
}
public boolean shouldSwitchToOtherInputMethods() {
// Todo: Revisit here to reorganize the settings. Probably we can/should use different
// strategy once the implementation of
// {@link InputMethodManager#shouldOfferSwitchingToNextInputMethod} is defined well.
final boolean fallbackValue = mSettings.getCurrent().mIncludesOtherImesInLanguageSwitchList;
final IBinder token = getwindow().getwindow().getAttributes().token;
if (token == null) {
return fallbackValue;
}
return mRichImm.shouldOfferSwitchingToNextInputMethod(token,fallbackValue);
}
项目:live_master
文件:IjkPlayer.java
private void HideSoftInput(IBinder token) {
if (token != null) {
InputMethodManager manager = (InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE);
manager.hideSoftInputFromWindow(token,InputMethodManager.HIDE_NOT_ALWAYS);
}
}
项目:Near
文件:NearConnectImpl.java
@Override
public void onServiceConnected(ComponentName name,IBinder service) {
if (service instanceof TcpserverService.TcpserverBinder && mServerState == SERVER_STARTED) {
TcpserverService.TcpserverBinder binder = (TcpserverService.TcpserverBinder) service;
binder.setListener(getServerServiceListener());
binder.startServer();
}
}
项目:GitHub
文件:FlashlightManager.java
private static Object getHardwareService() {
Class<?> serviceManagerClass = maybeForName("android.os.ServiceManager");
if (serviceManagerClass == null) {
return null;
}
Method getServiceMethod = maybegetmethod(serviceManagerClass,"getService",String.class);
if (getServiceMethod == null) {
return null;
}
Object hardwareService = invoke(getServiceMethod,null,"hardware");
if (hardwareService == null) {
return null;
}
Class<?> iHardwareServiceStubClass = maybeForName("android.os.IHardwareService$Stub");
if (iHardwareServiceStubClass == null) {
return null;
}
Method asInterfaceMethod = maybegetmethod(iHardwareServiceStubClass,"asInterface",IBinder.class);
if (asInterfaceMethod == null) {
return null;
}
return invoke(asInterfaceMethod,hardwareService);
}
项目:BTNotifierAndroid
文件:NotificationListenerService.java
@Override
public IBinder onBind(Intent mIntent) {
IBinder mIBinder = super.onBind(mIntent);
Log.i(TAG,"onBind");
isNotificationAccessEnabled = true;
try {
server = new Server(this);
server.start();
} catch (Exception e) {
Log.e(TAG,"Error during bind",e);
}
return mIBinder;
}
项目:AstronomyTourPadova
文件:LocationService.java
@Override
public IBinder onBind(Intent intent) {
Log.d(TAG,"in onBind()");
// Called when the App comes to the foreground and binds with this service.
stopForeground(true);
changingConfiguration = false;
return iBinder;
}
项目:KUtils-master
文件:HideUtil.java
/**
* @param mActivity
* @param token
*/
private void hideSoftInput(Activity mActivity,IBinder token) {
if (token != null) {
InputMethodManager im = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(token,InputMethodManager.HIDE_NOT_ALWAYS);
}
}
项目:IdealMedia
文件:PopupIndicator.java
private WindowManager.LayoutParams createPopupLayout(IBinder token) {
WindowManager.LayoutParams p = new WindowManager.LayoutParams();
p.gravity = Gravity.START | Gravity.TOP;
p.width = ViewGroup.LayoutParams.MATCH_PARENT;
p.height = ViewGroup.LayoutParams.MATCH_PARENT;
p.format = PixelFormat.TRANSLUCENT;
p.flags = computeFlags(p.flags);
p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
p.token = token;
p.softInputMode = WindowManager.LayoutParams.soFT_INPUT_STATE_ALWAYS_HIDDEN;
p.setTitle("discreteSeekBar Indicator:" + Integer.toHexString(hashCode()));
return p;
}
项目:VirtualHook
文件:ActivityStack.java
private void realStartActivityLocked(IBinder resultTo,Bundle options) {
Class<?>[] types = mirror.android.app.IActivityManager.startActivity.paramList();
Object[] args = new Object[types.length];
if (types[0] == IApplicationThread.TYPE) {
args[0] = ActivityThread.getApplicationThread.call(VirtualCore.mainThread());
}
int intentIndex = ArrayUtils.protoIndexOf(types,Intent.class);
int resultToIndex = ArrayUtils.protoIndexOf(types,Bundle.class);
int resolvedTypeIndex = intentIndex + 1;
int resultWhoIndex = resultToIndex + 1;
int requestCodeIndex = resultToIndex + 2;
args[intentIndex] = intent;
args[resultToIndex] = resultTo;
args[resultWhoIndex] = resultWho;
args[requestCodeIndex] = requestCode;
if (optionsIndex != -1) {
args[optionsIndex] = options;
}
args[resolvedTypeIndex] = intent.getType();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
args[intentIndex - 1] = VirtualCore.get().getHostPkg();
}
ClassUtils.fixArgs(types,args);
mirror.android.app.IActivityManager.startActivity.call(ActivityManagerNative.getDefault.call(),(Object[]) args);
}
public static IResultReceiver asInterface(IBinder obj) {
if (obj == null) {
return null;
}
IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
if (iin == null || !(iin instanceof IResultReceiver)) {
return new Proxy(obj);
}
return (IResultReceiver) iin;
}
项目:chromium-for-android-56-debug-video
文件:IntentUtils.java
/**
* Just like {@link BundleCompat#getBinder()},but doesn't throw exceptions.
*/
public static IBinder safeGetBinder(Bundle bundle,String name) {
if (bundle == null) return null;
try {
return BundleCompat.getBinder(bundle,name);
} catch (Throwable t) {
// Catches un-parceling exceptions.
Log.e(TAG,"getBinder Failed on bundle " + bundle);
return null;
}
}
项目:tumbviewer
文件:DownloadService.java
@Nullable
@Override
public IBinder onBind(Intent intent) {
if (localBinder == null) {
localBinder = new LocalBinder();
}
return localBinder;
}
项目:VirtualAPK
文件:PluginUtil.java
public static IBinder getBinder(Bundle bundle,String key) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
return bundle.getBinder(key);
} else {
try {
return (IBinder) ReflectUtil.invoke(Bundle.class,bundle,"getIBinder",key);
} catch (Exception e) {
}
return null;
}
}
项目:airgram
文件:ICustomTabsCallback.java
public static ICustomTabsCallback asInterface(IBinder obj) {
if (obj == null) {
return null;
} else {
IInterface iin = obj.queryLocalInterface("android.support.customtabs.ICustomTabsCallback");
return (iin != null && iin instanceof ICustomTabsCallback ? (ICustomTabsCallback) iin : new ICustomTabsCallback.Stub.Proxy(obj));
}
}
项目:container
文件:VActivityManager.java
public void sendActivityResult(IBinder resultTo,int requestCode) {
ActivityClientRecord r = mActivities.get(resultTo);
if (r != null && r.activity != null) {
Object mainThread = VirtualCore.mainThread();
ActivityThread.sendActivityResult.call(mainThread,resultTo,resultWho,requestCode,null);
}
}
项目:prevent
文件:ActivityManagerService.java
public final int startActivity(IApplicationThread caller,ProfilerInfo profilerInfo,Bundle bOptions) {
return PreventRunningUtils.onStartActivity(
startActivity$Pr(caller,callingPackage,intent,resolvedType,startFlags,profilerInfo,bOptions),intent);
}
项目:android-instant-apps
文件:ServiceManagementActivity.java
@Override
public void onServiceConnected(ComponentName name,IBinder service) {
mBinder = (TimekeepingService.TimeBinder) service;
mServiceBound = true;
}
项目:AppAuthIdentityServer4
文件:TokenService.java
@Override
public IBinder onBind(Intent intent) {
return null;
}
项目:container
文件:VActivityManagerService.java
@Override
public void addPendingIntent(IBinder binder,String creator) {
mPendingIntents.addPendingIntent(binder,creator);
}
项目:CommonsLab
文件:RegisterFragment.java
private void closeKeyboard(Context context,IBinder windowToken) {
InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(windowToken,0);
}
@Override
public IBinder onBind(Intent intent) {
initHander();
return mMessenger.getBinder();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。