【转】ANDROID LOLLIPOP SCREEN CAPTURE AND SHARING
https://datatheorem.github.io/android/2014/12/26/android-screencapture/
https://www.youtube.com/watch?v=tT1XSoykjtA
ANDROID LOLLIPOP SCREEN CAPTURE AND SHARING
Android Lollipop has a new feature that allows screen capturing and screen sharing from third party applications. The feature allows third party apps to capture videos from the device and deliver it over the network.
Screen capturing does not require any pre-defined permissions; however, it does require user consent, as shown in the image below. If the user agrees to the consent, which does not necessarily explain the permanence of the feature nor its broad range, the application is able to capture everything that is displayed on the device’s screen, including sensitive activity from all other apps, such as password keystrokes, credit card screens, home addresses, etc. The capturing ability remains on even if the user terminates/closes the app, but not after a reboot. Additionally, when an application is performing screen capturing a small screen casting icon is displayed in the notification bar. This does not give the user enough information to make an informed decision on whether to disable casting.
Please click here to view the full step-by-step demo. Thanks Alexey Reznik for creating an informative video.
Fig:SideScreen is a 3rd Party Application on Google Play
Since a user may not understand the impact of its consent, mobile apps should proactive protect their sensitive screens from third party screen capturing and sharing. This is possible using the FLAG_SECURE option on any given screen. The following code shows an example:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().setFlags(LayoutParams.FLAG_SECURE,
LayoutParams.FLAG_SECURE)
…
…
}
However, if the developers want to protect all the screens of their applications from third party screen capturing and sharing, they need to use this flag in each of the Activities separately. There is no global means to set this flag for all the screens at once. But, one can design their applications in such a way that the FLAG_SECURE needs to be used only once. Below is the code snippet:
- Define a BaseActivity and set the FLAG_SECURE in that Activity :
public class BaseActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/**
* approach 1: create a base activity and set the FLAG_SECURE in it,
* Extend all other activities, Fragments from this activity
*/
getWindow().setFlags(LayoutParams.FLAG_SECURE,
LayoutParams.FLAG_SECURE);
}
- Take this BaseActivity as superclass for all the other Activities.
public class LoginActivity extends BaseActivity
public class MainActivity extends BaseActivity
By doing so, when the onCreate() method of the super class is overrriden, the FLAG_SECURE automatically gets set for all the child activities.
- There might be cases where one wants to unset the FLAG_SECURE for some screens. In such cases, in child activity can use the below code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
clear flags: It can be used when user need to enable screen capturing in some applications
*/
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
More information on FLAG_SECURE API can be found here: FLAG_SECURE
【转】ANDROID LOLLIPOP SCREEN CAPTURE AND SHARING的更多相关文章
- SPX Instant Screen Capture
Today I will recommend a NICE screen capture tool, which name is SPA Instant Screen Capture. http:// ...
- Android(Lollipop/5.0) Material Design(六) 使用图像
Material Design列 Android(Lollipop/5.0)Material Design(一) 简单介绍 Android(Lollipop/5.0)Material Design(二 ...
- ffmpeg 录屏 screen capture recorder
ffmpeg在Linux下用X11grab进行屏幕录像,在Windows下用DirectShow滤镜 首先需要安装一个软件,screen capture recorder 编译好的下载地址是: htt ...
- Android(Lollipop/5.0) Material Design(二) 入门指南
Material Design系列 Android(Lollipop/5.0)Material Design(一) 简介 Android(Lollipop/5.0)Material Design(二) ...
- Android(Lollipop/5.0) Material Design(一) 简单介绍
Material Design系列 Android(Lollipop/5.0)Material Design(一) 简单介绍 Android(Lollipop/5.0)Material Design( ...
- Android(Lollipop/5.0) Material Design(四) 创建列表和卡片
Material Design系列 Android(Lollipop/5.0)Material Design(一) 简单介绍 Android(Lollipop/5.0)Material Design( ...
- full page screen capture in js
full page screen capture in js html2canvas https://html2canvas.hertzen.com/ https://github.com/nikla ...
- Android Lollipop 5.0 经典新特性回顾
*Tamic 专注移动开发! 更多文章请关注 http://blog.csdn.net/sk719887916 虽然Android已到了7.0 ,但是我们还是不能忘怀视觉革命性改变的5.0,今天回顾下 ...
- Android(Lollipop/5.0) Material Design(一) 简介
官网地址:https://developer.android.com/intl/zh-tw/design/material/index.html 使用Material Design 需要api21,即 ...
随机推荐
- 可笑,你竟然不知道 Java 如何生成 UUID
先看再点赞,给自己一点思考的时间,微信搜索[沉默王二]关注这个靠才华苟且的程序员.本文 GitHub github.com/itwanger 已收录,里面还有一线大厂整理的面试题,以及我的系列文章. ...
- OpenCV计算机视觉编程攻略(第三版)源码
去年买了这本OpenCV的书,感觉还不错,但是书上没有给出下载源码的地方,在网上找了下,还好找到了,现在分享给大家: 链接: https://pan.baidu.com/s/1IqAay1IZ8g-h ...
- “随手记”APP与已经发布的记账软件“鲨鱼记账”的差距
我们使用并观察了“鲨鱼记账”APP,发现,我们的软件真的还有很多不足的地方.就功能这方面来说:“鲨鱼记账”APP有更多的收入.支出分类:就界面来说:“鲨鱼记账”APP有比我们优美太多的页面和背景.但是 ...
- 【av68676164(p48-p50】虚拟内存管理(1)
7.3.1 页式虚拟内存管理概念 物理内存(即实内存)管理 特点 缺点 1 源程序直接使用内存的物理地址 程序间容易访问冲突 2 程序必须全部装入内存才能运行 内存太小程序无法运行 3 程序占用连续的 ...
- 9、Bridge 桥梁模式 将类的功能层次结构与实现层结构分离 结构型设计模式
1.何为桥接模式 桥接模式是一种将类的功能层次和实现层次分离的技术,所谓类的功能层次指的是类要实现什么功能,要定义多少个函数还进行处理,在功能之中我们会用到继承来定义新的方法同时也能使用父类的方法,这 ...
- 【Python笔记】2020年7月30日练习【python用input函数输入一个列表】
练习课题链接:廖雪峰-Python教程-高级特性-迭代 学习记录: 1.Python当中类似于 三目运算符 的应用 2.Python用input函数输入一个列表 代码实例:对用户输入的一组数字转化成l ...
- java 接口二
一 接口的多实现 接口最重要的体现:解决多继承的弊端.将多继承这种机制在java中通过多实现完成了. interface Fu1 { void show1(); } interface Fu2 { v ...
- 高级搜索树-AVL树
目录 平衡因子 AVL树节点和AVL树的定义 失衡调整 插入和删除操作 完整源码 AVL树是平衡二叉搜索树中的一种,在渐进意义下,AVL树可以将高度始终控制在O(log n) 以内,以保证每次查找.插 ...
- Linux中C++提示‘close’ was not declared
C++socket编程时关闭socket和epoll时出现‘close’ was not declared,是程序头文件缺失导致的.缺失头文件#include <unistd.h>
- C#设计模式之9-装饰者模式
装饰者模式(Decorator Pattern) 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/405 访问. 装饰者模 ...