Service 如何知道caller
重写Binder的onTransact方法
|
you need to do that in
Binder#onTransact method, this is a good place for any remote checks – pskink Feb 10 at 17:58 |
||
|
The description of
Binder#onTransact mentions unmarshalling transactions. Is it safe to use it just for checking permissions and returning false when the permissions are not okay, and returning the default implementation when all is well? – Daniel Feb 11 at 15:36 |
||
|
i think so, but the docs do not say what is returned boolean for (try to return
false and see what happens) or you would try to throw RemoteException saying "dear client, nonono, you have no permissions to call me" – pskink Feb 11 at 16:03 |
||
|
I did try it. When I return
false from onTransact , the function call on the client returns null . – Daniel |
拿到caller的包名
String pkg = getPackageManager().getNameForUid(getCallingUid());
Service 如何知道caller的更多相关文章
- [源码解析] TensorFlow 分布式之 MirroredStrategy 分发计算
[源码解析] TensorFlow 分布式之 MirroredStrategy 分发计算 目录 [源码解析] TensorFlow 分布式之 MirroredStrategy 分发计算 0x1. 运行 ...
- 【Java EE 学习 24 下】【注解在数据库开发中的使用】【反射+注解+动态代理在事务中的应用service层】
一.使用注解可以解决JavaBean和数据库中表名不一致.字段名不一致.字段数量不一致的问题. 1.Sun公司给jdbc提供的注解 @Table.@Column.@Id.@OneToMany.@One ...
- Service之三种服务方式
(一)StartService 运行Service的方法之一.任何继承于android.content.Context的Android组件(component)都可以使用一个Intent(androi ...
- [蓝牙] 4、Heart Rate Service module
Detailed Description Heart Rate Service module. This module implements the Heart Rate Service with t ...
- Android中Service(服务)详解
http://blog.csdn.net/ryantang03/article/details/7770939 Android中Service(服务)详解 标签: serviceandroidappl ...
- java攻城狮之路(Android篇)--BroadcastReceiver&Service
四大组件:activity 显示. contentProvider 对外暴露自己的数据给其他的应用程序.BroadcastReceiver 广播接收者,必须指定要接收的广播类型.必须明确的指定acti ...
- [转]Web Service Authentication
本文转自:http://www.codeproject.com/Articles/9348/Web-Service-Authentication Download source files - 45. ...
- GSM Sniffing入门之软件篇:GSMTAP抓取与SMS(Short Message Service)
重点介绍如何利用50元左右的设备,抓包并还原SMS短信内容: ps:研究GSM Sniffing纯属个人兴趣,能抓SMS报文只是捡了个明文传输的漏子,切勿用于非法用途.就像sylvain说的,osmo ...
- Service Oriented Architecture
What is Service Oriented Architecture (SOA)? There have been so many interpretations of this through ...
随机推荐
- ERROR 2003 (HY000): Can't connect to MySQL server
http://blog.csdn.net/longxibendi/article/details/6363934 一.问题的提出 /usr/local/webserver/mysql/bin/mysq ...
- Ubuntu系统启动错误问题的解决
一.hub_port_status failed (err=-110) 1.问题产生的原因 笔者不知道出现这种错误是不是都是相同的原因,但是我的系统出现这种原因是由于: 1.更改了虚拟硬盘的大小和/e ...
- ByteArrayInputStream 和 ByteArrayOutputStream
package java.io; /** * A <code>ByteArrayInputStream</code> contains * an internal buffer ...
- constant属性详解
/**是否使用开发模式,不在开发模式下变为false*/ (常用) <constant name = "struts.devmode" value = "true& ...
- [BZOJ 1047] [HAOI2007] 理想的正方形 【单调队列】
题目链接:BZOJ - 1047 题目分析 使用单调队列在 O(n^2) 的时间内求出每个 n * n 正方形的最大值,最小值.然后就可以直接统计答案了. 横向有 a 个单调队列(代码中是 Q[1] ...
- 【Java】java数据库连接池配置的几种方法
今天遇到了关于数据源连接池配置的问题,发现有很多种方式可以配置,现总结如下,希望对大家有所帮助:(已Mysql数据库为例) 一,Tomcat配置数据源: 方式一:在WebRoot下面建文件夹META- ...
- Struts2 全局拦截器、result 的实现
定义一个可以继承的包,在这个包里面写入自己常用的拦截器,于是就实现了全局拦截器的实现. 现在,我们定义一个专门用来继承的包: <!--专门提供前台继承的包--> <package n ...
- 【UVA11324】The Largest Clique (SCC)
题意: 给一张有向图G,求一个结点数最大的结点集,使得该结点中任意两个结点 u 和 v满足:要么 u 可以到达 v, 要么 v 可以到达 u(u 和 v 相互可达也可以). 分析: Tarjan求SC ...
- [LeetCode#276] Paint Fence
Problem: There is a fence with n posts, each post can be painted with one of the k colors. You have ...
- Say To ME
每天都要有计划,无计划不生活. 计划包括天计划和月计划. 每个月应该有月主题. 避免大概,可能,貌似,等不肯定的词语.增强自信心,增强给别人的自信心. 不熬夜,早睡. 多运动,每周应该至少出门一次,运 ...