【转】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,即 ...
随机推荐
- jetbrain的plugin repository地址
jetbrain的plugin repository地址:https://plugins.jetbrains.com/plugins/alpha/5047 有的时候 plugins内搜不到东西 把这个 ...
- 【av68676164(p55-p58)】 Intel CPU和Linux内存管理
7.4.1 Intel CPU物理结构 https://www.cnblogs.com/megachen/p/9768115.html x86实模式 实模式 20位:1M内存空间 地址表示方式:段地址 ...
- SCHP代码中的问题
1.subprocess.CalledProcessError: Command ‘[‘where’, ‘cl’]’ returned non-zero exit status 1. 这个问题是因为电 ...
- SpringCloud Sidecar 整合.Net WebApi
在整合.Net的过程中遇到不少问题,一般网上的例子只是调用一个简单的NodeJS示例,并未有详细的介绍及采坑过程. 首先,我的项目结构是:Vue前端 + SpringCloud后端 + .Net的We ...
- G4560 HD610安装黑苹果Hakintosh
这一篇主要是写给使用G4560笔记本折腾黑苹果的朋友. 我折腾了几天黑苹果,发现怎么也无法成功,最后我才知道HD610现在还不支持黑苹果. 由于大多数笔记本不支持屏蔽核显,这意味着要想使用黑苹果必须要 ...
- 【算法•日更•第四十二期】离散傅里叶变换(DFT)
▎前言 小编相当的菜,这篇博客难度稍高,所以有些可能不会带有证明,博客中更多的是定义. 我们将要学到的东西: 复数 暴力多项式乘法 DFT 当然,小编之前就已经写过一篇博客了,主要讲的就是基础多项式, ...
- linux上传下载小工具lrzsz
工具压缩包链接 密码:zbef 1.将压缩包放到linux的任意目录下,执行:tar zxvf lrzsz-0.12.20.tar.gz 解压压缩包 2.cd lrzsz-0.12.20 3../co ...
- Android 禁止ViewPager左右滑动的功能实现
来来来,各位看官~ Look here!!! Android 禁止ViewPager左右滑动的功能实现!! I think it`s so easy,无需重写ViewPager!!! JUST ...
- 使用Kali中的Metasploit生成木马控制Windows系统
一.概念:Kali基于debin的数字取证系统,上面集成了很多渗透测试工具,其前身是BT5 R3(BtackTrack). 其中Metasploit是一个综合利用工具,极大的提高了攻击者的渗透效率,使 ...
- Ubuntu LNMP环境的搭建
一.安装nginx Step1:安装: sudo apt-get install nginx Step2:查看ngnix 运行状态 : service nginx status 查看80端口是否开启: ...