openfile mp3prehandlee->frames: 0 mp3prehandlee->bytes:

发现在《矽说》专栏之前的一篇文章很适合这个问题,就搬运过来了:)&br&欢迎关注《矽说》专栏:&a href=&/silicontalks& class=&internal&&&span class=&invisible&&https://&/span&&span class=&visible&&/sili&/span&&span class=&invisible&&contalks&/span&&span class=&ellipsis&&&/span&&/a&&br&&b&触摸屏回顾与综述&/b&触摸屏技术至少可以追溯到上世纪70年代的美国伊利诺伊大学,当时科学家们把这项实验室里的最新成果安装到了PLATO IV计算机上用于课堂辅助教学,触摸屏由此第一次走出实验室正式进入实际应用阶段。不过,触摸屏的技术并不成熟,商用价值在此后的很长时间内也并没有被发掘出来。到了90年代,触摸屏出现在高端PDA(年纪稍长的读者一定还记得快译通和文曲星)中,可惜仍然不温不火。一方面,PDA的市场规模并不大,另一方面由于触摸屏的精度有限,大多数PDA用户还是更喜欢直接用实体键盘操作。2004年,任天堂的掌上游戏机NDS在全球热卖,其最大的卖点就是NDS拥有两块屏幕并且其中一块是触摸屏,于是触摸屏随着NDS的流行而进入了更多人的视野。不过,直到那时候,触摸屏的使用还是局限于特定的人群。真正让触摸屏走进千家万户还是要归功于苹果的乔帮主。2007年,初代iPhone发售,它重新定义了智能手机。在iPhone发售之前,智能手机的定义是“用户能够自主安装软件的手机”,而在iPhone发售之后,智能手机的定义变成了“屏幕可以滑的手机”,触摸屏对于iPhone来说是标志性不可或缺的模块。实际上,在手机上搭载触摸屏苹果并非首创,但是苹果iPhone使用触摸屏完全更新了手机的操作方式,在iPhone中引入了拖曳,缩放等手势操作,极大地改善了用户的操作体验。随着iPhone销量节节攀升,三星、HTC等公司也不甘示弱,纷纷推出了搭载触摸屏且操作方式类似iPhone的智能手机。一夜之间,地铁上再也听不到手机的按键声,因为所有人都开始用触摸屏“滑”手机。&img src=&/v2-e7f494c2cb_b.jpg& data-rawwidth=&345& data-rawheight=&320& class=&content_image& width=&345&&&em&触摸屏首次出现在PLATO IV计算机中(左上),此后陆续出现在快译通(右上),NDS(左下)等设备中,最后苹果推出的iPhone(右下)让触摸屏真正走进千家万户&/em&&br&在iPhone推出之后,触摸屏并没有停止更新。为了使手机变得更轻更薄,屏幕制造技术也经历了out-of-cell到on-cell直至最薄的in-cell。相对于十年前的触摸屏,今天的触摸屏更薄,操作手感更好。&br&作者:李一雷&br&链接:&a href=&/p/& class=&internal&&&span class=&invisible&&https://&/span&&span class=&visible&&/p/22&/span&&span class=&invisible&&967519&/span&&span class=&ellipsis&&&/span&&/a&&br&来源:知乎&br&著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。&br&&br&&b&突破二向箔的束缚:三维触控&/b&然而,人们对触摸屏交互方法的探索并没有到此为止。这里不妨再梳理一下手机与用户交互方式的进化过程。最初,用户只能通过按手机上若干位置固定的按键来操作手机,这种方式可以称作一维的操作方式。在苹果引入触摸屏以及手势操作后,用户可以在手机触摸屏的二维空间里自由动作,因此可以称作二维的操作方式。如果我们的触摸屏不再进化,那么用户与手机的交互维度将会被限制在二维,就像《三体》中被二向箔击中的文明一样。很自然地,我们会想到:既然人类生活在三维的空间里,为什么用户与设备的交互只能是在二维空间里呢?有没有可能实现三维的交互方法呢?要实现三维交互,就必须能够实时捕捉到用户的手在三维空间中的坐标,并且根据用户手的三维坐标(及其变化)做出相应回应。幸运的是,科学家和工程师们已经开始开发三维触控来实现超越二维的人机交互。在具体地分析技术之前,我们不妨先来展望一下三维人机交互方法都能带来哪些革命性的应用?&br&&strong&1.游戏(含VR)&/strong&说到三维触控,大家首先想到的就是在游戏中的应用。确实,游戏是所有应用中对于交互方式要求最高的。使用与游戏相配合的专用交互设备,玩家才能完全体会到游戏的魅力(不信你用键盘玩赛车游戏试试),这也是为什么一些游戏需要开发专用外设(如早年《热舞革命》的跳舞毯,《吉他英雄》的吉他,各类赛车游戏的方向盘等等)。当触摸屏在手机上刚普及时,《愤怒的小鸟》,《水果忍者》等一批完美利用触摸屏交互特性的游戏也获得了大家的青睐。当触摸屏可以捕捉到人手在三维中的动作时,在游戏中可以实现许多新的玩法。一个非常有潜力的方向就是和VR技术结合,例如类似《水果忍者》的游戏可以在三维空间内通过玩家的手势进行,《街头霸王》等格斗游戏的出招可以由玩家的真实手势触发,从而使玩家的代入感大大增加。&img src=&/v2-353fe5bdb61d865c0cdaa07eba0401e6_b.jpg& data-rawwidth=&323& data-rawheight=&217& class=&content_image& width=&323&&&em&3D触屏结合VR技术可以极大地增加游戏可玩性&/em&&br&&br&&strong&2.增强现实(Augmented Reality, AR)&/strong&三维触摸屏很有潜力成为AR应用中人机交互的基础技术。在AR技术中,用户佩戴的专用眼镜作为显示屏,通过计算机视觉技术将AR的图像界面与现实世界有机地结合在一起并投射到用户眼睛的视网膜上。当用户的手做出动作时,AR设备必须能准确地捕捉到手的实时位置并根据用户手的动作做出相应反应。三维触摸屏正是能够捕捉到手的精确位置,从而成为AR人机交互的基础技术。在AR技术普及后,不仅仅手机、电脑会用到三维触摸屏,甚至日常家具(如桌子,橱柜)的表面都可能需要支持三维触摸技术,从而让用户随时随地能使用AR。&img src=&/v2-df6b9a5ac921f46aa1be8b166cbdf069_b.jpg& data-rawwidth=&570& data-rawheight=&200& class=&origin_image zh-lightbox-thumb& width=&570& data-original=&/v2-df6b9a5ac921f46aa1be8b166cbdf069_r.jpg&&&em&增强现实将计算机图像与现实结合在一起(左),AR与用户交互方式需要能精确地捕捉用户手的三维位置(右)&/em&&br&&br&&b&三维触摸屏候选技术&/b&目前三维触摸屏技术尚处于探索阶段。现在最有希望商用的三维触摸屏技术有两种,一种基于毫米波雷达,另一种基于电容感应。基于毫米波雷达技术的三维触摸技术以Google的Project Soli为代表。今年五月份,Google正式发布了代号为Project Soli的三维触控模组。那么,Project Soli的毫米波雷达是如何实现三维触控的呢?首先我们要清楚雷达的原理。大家一定都看到过探照灯:在漆黑的天空中,探照灯的光束方向上的物体位置可以被看得一清二楚。探照灯通过不停地旋转改变光束照射方向,于是整个天空中所有方向上物体的位置就可以被一一探知。雷达也是一样,不过雷达发射的不是肉眼可以看到的光束,而是电磁波波束,并通过检测电路来探知波束方向上物体的位置。很显然,雷达也可以用在三维触控上:手就是需要检测的物体,通过雷达我们可以实时监控手在空间中的位置并让设备做出相应反应从而实现三维的人机交互,这也是Project Soli的原理。&img src=&/v2-4ac63f4fb416cfe5c5b79ec_b.jpg& data-rawwidth=&344& data-rawheight=&345& class=&content_image& width=&344&&&em&探照灯通过改变光束方向来探测目标(左上),雷达通过改变波束方向来扫描目标(右上),Project Soli利用和雷达原理来探测手的位置从而实现三维触控(下)&/em&&br&&br&那么什么是毫米波雷达呢?它与电视里出现的那种巨大的雷达有什么区别呢?原来,雷达的分辨率和它发射电磁波的波长有关,发射的电磁波波长越短则分辨率越好,也即对物体探测位置越精确。但是,电磁波波长越短则在空气中的衰减会越大,因此如果物体距离雷达很远就会检测不到。因此物体探测精度和探测距离是一对矛盾。传统军用和警用雷达使用的是微波波段,因为传统雷达需要检测的物体通常尺寸很大,微波波段能做到大约10cm级别的分辨精度已经很够用了;另一方面传统雷达需要有足够的探测距离才能满足使用需求。然而,10cm级别的分辨精度对于三维触控来说完全不够用。另一方面,三维触控所需要检测的距离很短,通常手距离触摸屏的距离不会超过20cm。最后,三维触控模组的体积必须足够小。因此,Project Soli使用了波长为毫米数量级的毫米波雷达,理论上可以实现毫米级别的分辨精度。该雷达可以集成到硬币大小的芯片中,从而可以安装在各类设备上。下图是Project Soli使用的毫米波雷达传感芯片。芯片大小约为8mm x 10mm,上面白色的小点应当是用来把芯片固定到主板上的焊锡球(bump)。芯片上还有天线阵列(绿色框内)用来实现波束成型。根据天线的大小我们可以估计出Project Soli使用的毫米波雷达波长大约在2mm-5mm之间。&br&&img src=&/v2-a0e0084caaed2ebd4a14ceafa3c0c9a6_b.jpg& data-rawwidth=&226& data-rawheight=&195& class=&content_image& width=&226&&毫米波雷达用来实现三维触控可以达到很高的精度。然而,它的劣势在于功耗太大。目前即使最领先的毫米波雷达芯片也至少需要100mW以上的功耗,因此用在移动设备上会导致电池很快就用完了。这样一来,毫米波雷达触控比较适合使用在电源不是问题的设备上,例如大型游戏机或者电视机上的三维触控。另一种非常有前景的三维触控技术是&strong&电容感应技术&/strong&。毫米波雷达技术利用的是动态电磁波,而电容感应技术利用的是静电场。电容感应型三维触控技术是目前电容触摸屏的增强版:电容触摸屏可以感应到与屏幕接触的手的位置,而电容感应式三维触控技术则增强了感应范围,在手尚未接触到屏幕时就能感应到手在空间中的三维位置,从而实现三维触控。为了理解电容感应式三维触控的原理,我们不妨想象有许多热传感器组成的阵列,而传感器阵列上方有一个火苗(热源)。根据传感器的相对温度分布(即哪里温度比较高,哪里温度比较低)我们可以知道火苗在哪一个传感器上方(即火苗的二维位置),根据传感器的绝对温度(即传感器探测到的绝对温度有多高)我们可以知道火苗离传感器有多远(即火苗在空间中第三维的位置)。结合这两条信息我们可以得到火苗在空间中的三维位置。&img src=&/v2-f867d86dccad45b24b4e5_b.jpg& data-rawwidth=&576& data-rawheight=&200& class=&origin_image zh-lightbox-thumb& width=&576& data-original=&/v2-f867d86dccad45b24b4e5_r.jpg&&&em&热传感器阵列可以通过相对温度分布和绝对温度来判断火苗在三维空间中的位置&/em&&br&&br&电容传感式三维触控的原理也是这样,只不过这里探测的不是火苗带来的温度改变而是手指带来的静电场改变。通过探测哪一个电容传感器探测到的静电场改变最大我们可以感应到手指的二维位置,而通过电容传感器探测到静电场改变的绝对强度我们可以感应到手指的第三维坐标,从而实现三维触控。电容传感式三维触控的优势在于传感器的功耗可以远远小于毫米波雷达(大约仅仅是毫米波雷达的十分之一甚至更小),因此可以安装在对功耗比较敏感的移动设备上。但是电容传感也有自己的问题需要解决,就是传感器之间的互相干扰。我们同样拿热传感器感应火苗位置来作类比。现在我们假设除了火苗会发热以外,热传感器自己也会发热。这样一来,如果火苗离热传感器距离较远,那么它带来的温度变化相对于热传感器自己的发热可能微不足道,从而热传感器需要相当高的探测精度才能根据温度变化检测到火苗的位置。电容传感式三维触控也是如此:电容传感器之间的电场会互相耦合形成很大的电容,因此手指造成的静电场变化需要精度非常高的探测器才能检测到。好在随着电路技术的发展,即使微小的变化可以由高精度模拟放大器检测到,因此电容传感式三维触控在未来的前景非常光明。目前在电容传感式三维触控已经出现在微软的pre-touch screen demo中,该demo可以实现离屏幕较近距离(1-2cm)的三维触控。另一方面,不少顶尖高校的实验室也展示了基于电容传感原理的三维触控模块。例如,普林斯顿大学由Naveen Verma教授领衔的团队成功地展示了基于薄膜电子的三维触控(目前成立了SpaceTouch公司),有机会可以用在未来可弯曲屏幕上。此外,UCLA由Frank Chang教授和Li Du博士带领的Airtouch团队使用传统低成本CMOS工艺制作的芯片配合普通手机触摸屏已经可以实现距离屏幕10cm范围内的三维触控。该芯片最初于2015年在国际固态半导体会议上发表(ISSCC,全球芯片领域最高规格的会议,号称芯片界的奥林匹克盛会),之后团队又乘热打铁将深度学习与三维触控芯片结合在一起用于高精度三维手势识别,并应邀在2016年的自动设计会议(DAC,全球电子设计领域最高规格的会议之一)发表了最新成果。Airtouch芯片功耗仅2 mW(远远小于Google的毫米波雷达触控方案),且与普通触摸屏兼容,将来可以广泛地应用于手机等移动设备的三维触控。&br&&img src=&/v2-2ddc9bce1fa006_b.jpg& data-rawwidth=&505& data-rawheight=&434& class=&origin_image zh-lightbox-thumb& width=&505& data-original=&/v2-2ddc9bce1fa006_r.jpg&&&br&&br&Airtouch视频演示&br&&b&&a class=&video-box& href=&///?target=http%3A///v_show/id_XMTc3NDk3MjQwNA%3D%3D.html& target=&_blank& data-video-id=&& data-video-playable=&& data-name=&Airtouch DAC—在线播放—优酷网,视频高清在线观看& data-poster=&& data-lens-id=&&&
&img class=&thumbnail& src=&&&&span class=&content&&
&span class=&title&&Airtouch DAC—在线播放—优酷网,视频高清在线观看&span class=&z-ico-extern-gray&&&/span&&span class=&z-ico-extern-blue&&&/span&&/span&
&span class=&url&&&span class=&z-ico-video&&&/span&/v_show/id_XMTc3NDk3MjQwNA==.html&/span&
&/a&&br&&/b&&br&&br&&br&&b&结语&/b&&br&触控技术经历数十年的发展,到今天已经能够超越传统二维触控而进入三维触控领域了。三维触控会带来人机交互方式的革新,可以用于游戏、AR/VR等等应用中。目前较有希望商用的三维触控方案包括毫米波雷达(Google Project Soli为代表)和电容感应(UCLA Airtouch为代表)。我们可望在不久的将来就看到三维触控走入千家万户,成为人机交互的基本方式。
发现在《矽说》专栏之前的一篇文章很适合这个问题,就搬运过来了:) 欢迎关注《矽说》专栏: 触摸屏回顾与综述触摸屏技术至少可以追溯到上世纪70年代的美国伊利诺伊大学,当时科学家们把这项实验室里的最新成果安装到了PLATO IV计算机上…
手头上没有图,但是就目前体验来说,绝对是甩siri几条街的。&br&&br&完美整合了谷歌的搜索和youtube搜索。你可以问google:给我看看那个有关小男孩吃饭,但是觉得妈妈做饭做的太可爱,他舍不得吃的那个视频。然后google会给你调出YouTube视频。这种智能程度在体验上还是非常好的。&br&&br&不知道有多少次,我们在使用google或者其他搜索引擎的时候不知道该怎么提问,我们不能像问一个真实的人一样问搜索引擎问题,但是通过google assistant,我们可以做到这一点了。&br&&br&我们只需要描述问题,google就能做出回答。&br&&br&我之前看美恐,觉得里面那个zoe的女演员特别漂亮。我就问:在美恐里的那个漂亮女演员叫什么名字,然后google就给我了搜索结果。然后我可以接下去问:她的ins账号是什么,她还演过什么表演。这已经非常完美的达到了人与人的对话程度了。&br&&br&其次,你还可以和google assistant玩游戏。你只需要和她说:play a game with me, 她就会有很多游戏推荐:其中最有趣的是Google assistant与你互动游戏。目前有三四种游戏可以选择。有知识问答 GA 会问你各种百科问题,然后你来回答,你可以最多和四个朋友一起玩,GA会变成主持人+裁判,最后判定谁赢。&br&&br&综上,google目前在人工智能(至少早应用上)是绝对超过siri的。而且siri曾引以为傲的幽默的人性特色也别google赶上了。&br&&br&目前google assistant不支持中文,想试试中文的朋友再等等吧。&br&&br&(我从iphone3gs开始每代iphone都用过,一直是个果粉,直到最近iphone7出来之后打算换成pixel,并不是果黑。)
手头上没有图,但是就目前体验来说,绝对是甩siri几条街的。 完美整合了谷歌的搜索和youtube搜索。你可以问google:给我看看那个有关小男孩吃饭,但是觉得妈妈做饭做的太可爱,他舍不得吃的那个视频。然后google会给你调出YouTube视频。这种智能程度在体验…
最近剛好整理 Android N 的資料Blog 連結:&a href=&///?target=https%3A//vinta.ws/booch/%3Fp%3D180& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Android Nougat introduction (一)&i class=&icon-external&&&/i&&/a&&br&&p&由於 google 的官方更新項目是不斷增長的,且不少東西也沒有詳細的實務經驗,我就只能看到哪寫到哪。以下是簡單介紹。&/p&&p&看完的,有補充資料&/p&&ol&&li&&a href=&///?target=https%3A///guide/topics/ui/multi-window.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Multi-Window Support 多視窗支援&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A//android-developers.blogspot.tw/2016/06/notifications-in-android-n.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Notification Enhancements 通知欄強化&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///guide/topics/resources/multilingual-support.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Multi-locale Support, More Languages 多地區設定支援,更多語言&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///training/monitoring-device-state/doze-standby.htm& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Doze on the Go 移動時休眠&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///topic/performance/background-optimization.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Project Svelte: Background Optimizations 專案 Svelte:背景最佳化&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///watch%3Fv%3DH-9xKmuwawg& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Data Saver&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///reference/android/service/quicksettings/Tile.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Quick Settings Tile API 快速設定磚 API&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///training/tv/tif/content-recording.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Android TV 錄製&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///training/articles/security-config.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Network Security Configuration 網路安全性強化&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///training/articles/scoped-directory-access.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Scoped Directory Access 限定範圍目錄存取&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///about/versions/nougat/android-7.0.html%3Fhl%3Den& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Virtual Files 虛擬檔案&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///training/articles/direct-boot.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Supporting Direct Boot 直接開機&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///work/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Android for Work Updates&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///guide/platform/j8-jack.html%3Fhl%3Den& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Java 8 Language features JAVA 8 支援&i class=&icon-external&&&/i&&/a&&/li&&li&Profile-guided JIT/AOT Compilation 設定檔指引 JIT/AOT 編譯&/li&&/ol&&p&底下是還沒細看的(待補充,我決定放到第二篇),一句話結論&/p&&ol&&li&&a href=&///?target=https%3A///ndk/guides/graphics/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Vulkan API&i class=&icon-external&&&/i&&/a& -新的 3D 渲染 api&/li&&li&&a href=&///?target=https%3A///reference/android/view/SurfaceView.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&SurfaceView&i class=&icon-external&&&/i&&/a& -請大家用 SurfaceView 取代 TextureView ,比較省電&/li&&li&&a href=&///?target=https%3A///about/versions/nougat/android-7.0.html%3Fhl%3Den%23print_svc& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Number Blocking&i class=&icon-external&&&/i&&/a&-系統級的 who’s call&/li&&li&&a href=&///?target=https%3A///reference/android/telecom/CallScreeningService.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Call Screening&i class=&icon-external&&&/i&&/a&-系統級的 who’ call&/li&&li&&a href=&///?target=http%3A//unicode.org/emoji/charts/full-emoji-list.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&New Emojis&i class=&icon-external&&&/i&&/a&-更多 Emojis&/li&&li&&a href=&///?target=http%3A//icu4j%2520apis%2520in%2520android/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ICU4J APIs in Android&i class=&icon-external&&&/i&&/a& -更小的 size&/li&&li&&a href=&///?target=https%3A///about/versions/nougat/android-7.0.html%3Fhl%3Den%23webview& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&WebView&i class=&icon-external&&&/i&&/a&-Chrome + WebView, Together and Multiprocess&/li&&li&&a href=&///?target=https%3A///guide/topics/graphics/opengl.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&OpenGL(TM) ES 3.2 API&i class=&icon-external&&&/i&&/a&-更新&/li&&li&&a href=&///?target=https%3A///reference/android/accessibilityservice/AccessibilityService.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Accessibility Enhancements&i class=&icon-external&&&/i&&/a& -nope&/li&&li&&a href=&///?target=https%3A///training/articles/security-key-attestation.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Key Attestation&i class=&icon-external&&&/i&&/a& -nope&/li&&li&&a href=&///?target=https%3A///studio/build/build-variants.html%23signing& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&APK Signature Scheme v2&i class=&icon-external&&&/i&&/a&-改善驗證速度並增強完整性保證&/li&&li&&a href=&///?target=http%3A////android-n-preview-3-introduces-a-new-shortcuts-helper-screen-for-physical-keyboards/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Keyboard Shortcuts Helper&i class=&icon-external&&&/i&&/a&-&strong&Meta(alt/command) + /&/strong& to trigger a&em&Keyboard Shortcuts&/em& screen&/li&&li&&a href=&///?target=https%3A///about/versions/nougat/android-7.0.html%3Fhl%3Den%23custom_pointer_api& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Custom Pointer API&i class=&icon-external&&&/i&&/a&-自訂游標外觀&/li&&li&&a href=&///?target=https%3A///about/versions/nougat/android-7.0.html%3Fhl%3Den%23sustained_performance_api& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Sustained Performance API&i class=&icon-external&&&/i&&/a&-用來測試 long-running apps&/li&&li&&a href=&///?target=https%3A///vr/android/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Print Service Enhancements&i class=&icon-external&&&/i&&/a&-nope&/li&&li&&a href=&///?target=https%3A///about/versions/nougat/android-7.0.html%3Fhl%3Den%23framemetrics_api& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&FrameMetricsListener API&i class=&icon-external&&&/i&&/a& -monitor its UI rendering performance,not limited to the past 120 frames.&/li&&/ol&&a href=&///?target=https%3A///guide/topics/ui/multi-window.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Multi-Window Support 多視窗支援&i class=&icon-external&&&/i&&/a&&p&Android N 新增一次顯示多個應用程式的支援。 在手持式裝置上,兩個應用程式可以在「分割畫面」模式中並排或上下排列。 在電視裝置上,應用程式能使用「子母畫面」模式,在使用者與另一個應用程式互動時持續播放影片。&/p&&p&這功能其實之前就有其他大廠做過,我想主因其實很簡單,就是在大螢幕機器上,這樣的操作可以有效利用所有的畫面,是個非常直覺的功能。但是相對的對裝置效能更加要求,尤其是對 RAM,這樣的功能實在很難想像在 256 MB 的手機上可以使用。&/p&&p&至於如何使用,官網是這樣說&/p&&p&使用者可以透過下列方式來切換多視窗模式:&/p&&ul&&li&如果使用者開啟&a href=&///?target=https%3A///guide/components/recents.html%3Fhl%3Dzh-tw& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&總覽畫面&i class=&icon-external&&&/i&&/a&並長按活動標題,就可以將該標題拖曳到畫面醒目提示的部分,將活動放入多視窗模式。&/li&&li&如果使用者長按「總覽」按鈕,裝置會將目前的活動放入多視窗模式,並開啟總覽畫面,讓使用者選擇要分享螢幕的另一個活動。&/li&&/ul&&p&使用者可以在活動分享螢幕時,將一個活動中的資料&a href=&///?target=https%3A///guide/topics/ui/drag-drop.html%3Fhl%3Dzh-tw& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&拖放&i class=&icon-external&&&/i&&/a&到另一個活動。 (之前,使用者只能在單一活動內拖放資料)。&/p&&p&ps. 總覽畫面就是 recent app 頁面,也就是大家手機按下右下或是左下的方塊按鈕會出現的畫面,老實說我覺得千言萬語比不上一段&a href=&///?target=https%3A///watch%3Fv%3DlaHfmVN01FQ& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&影片演示&i class=&icon-external&&&/i&&/a&。&/p&&p&看到這邊注意到官網提到的&/p&&p&『Manufacturers of larger devices can choose to enable freeform mode, in which the user can freely resize each activity. If the manufacturer enables this feature, the device offers freeform mode in addition to split-screen mode.』&/p&&p&這個也是文字敘述並不太好理解,簡單來說就是可以像平常操作電腦,可以自由縮放視窗,尤其是在向電視這種超大型畫面上,個人覺得所有做 Android 電視棒的廠商都要好好注意這塊,不過也是需要 app vendor 去支援。&/p&&p&&a href=&///?target=https%3A///guide/topics/ui/multi-window.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&開發方面就不多說,要注意的東西不少。&i class=&icon-external&&&/i&&/a&需要注意的是 multi-window activity 的生命週期基本上跟原本一樣,但是仔細想想就知道多視窗操作時就會有其中一個才是 focus 的 window,而沒有 focus 的 window activity 都是處在 onPause 階段,並非 onStop 階段,相對地拿到 focus 的 windows activity 會進入 onResume。&/p&&p&另外就是我很好奇 home app 會是怎麼處理 multi-windows ,之後拿到機子一定要試試看。此外 task queue 的處理也是需要仔細研究。ps. multi-windows mode 下 Android N是可以支援兩個view (兩個Activities之間)交換資訊(&a href=&///?target=https%3A///guide/topics/ui/multi-window.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&multi-window&i class=&icon-external&&&/i&&/a&);實作 &a href=&///?target=https%3A///reference/android/view/View.OnDragListener.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&View.OnDragListener&i class=&icon-external&&&/i&&/a&,傳遞 &a href=&///?target=https%3A///reference/android/content/ClipData.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ClipData&i class=&icon-external&&&/i&&/a&。(&a href=&///?target=https%3A///guide/topics/ui/drag-drop.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Drag and Drap&i class=&icon-external&&&/i&&/a&)&/p&&p&&a href=&///?target=https%3A//vinta.ws/booch/wp-content/uploads/2016/09/pip-active.png& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&而在此項目之下所衍生的就是『Picture in picture(子母畫面)』,&i class=&icon-external&&&/i&&/a&&a href=&///?target=https%3A///watch%3Fv%3DTxAbht2DkyU& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&影片演示&i class=&icon-external&&&/i&&/a& ,(TV only)&/p&&blockquote&&p&當使用者從影片返回瀏覽其他內容,您的應用程式可以將影片移入 PIP 模式。&/p&&p&當使用者觀看到影片內容的結尾時,您的應用程式可將影片切換到 PIP 模式。&/p&&p&主畫面顯示系列中下一集的預告或摘要資訊時。您的應用程式可以為使用者提供一個觀賞影片時佇列其他內容的方式。 當主畫面顯示內容選擇活動時,影片繼續在 PIP 模式中播放。&/p&&/blockquote&&p&開發上需要注意的基本跟 multi-windows 是一樣的,生命週期,通常進入 onPause 後,影片就會停止播放,因此必須在 onPause 階段作一些處理,讓影片繼續播放,同樣的也必須在 onResume 階段作相對處理。另外需要注意的就是 pip mode 是 240×135 dp。(這很明顯是為了 tv 設計的,可是目前感覺市面上好像還沒有出旗艦款的電視,同時處理子母畫面感覺很吃資源)。&/p&&a href=&///?target=https%3A//android-developers.blogspot.tw/2016/06/notifications-in-android-n.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Notification Enhancements 通知欄強化&i class=&icon-external&&&/i&&/a&&p&這部份有以下五大改版&/p&&p&&strong&1. Template updates&/strong&: We’re updating notification templates to put a new emphasis on hero image and avatar. Developers will be able to take advantage of the new templates with minimal adjustments in their code.&/p&&p&&strong&樣板更新&/strong&,老實說我覺得沒啥好說,看上面圖最快。使用者可以更加簡單的換成新版的ui&/p&&p&&strong&2. Messaging style customization&/strong&: You can customize more of the user interfacelabels associated with your notifications using the MessagingStyle class. You can configure the message, conversation title, and content view.&/p&&p&&strong&訊息風格客製化&/strong&,其實這個很方便,可以根據情況套入不同的 message style ,其實以前就可以用 客製化 notification ui 的方式達到,但這個很明顯 google 多個規範,讓大家更好做事。&/p&&p&&strong&3. &a href=&///?target=https%3A///watch%3Fv%3D2ZQ1D003g14& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Bundled notifications:&i class=&icon-external&&&/i&&/a&&/strong& The system can group messages together, for example by message topic, and display the group. A user can take actions, such as Dismiss or Archive, on them in place. If you’ve implemented notifications for Android Wear, you’ll already be familiar with this model.&/p&&p&&strong&通知歸群&/strong&,這個的中文實在不好翻,看了一下 i/o 影片介紹,個人覺得這個比較符合意義,過去在通知欄裡其實沒啥可以玩得,因為所有的通知都是照時間排序好,彼此之間都是獨立的。但也不是說一定不行,如果有開發 email 的人就會知道有個 style 叫做 inbox ,可以作到類似的事情但是處理實在麻煩。 現在多一個 setGroup() and setGroupSummary() 幫助各位更方便處理這件事情。此外在 api 24 以上 ,系統會自動把4條通知以上歸類成一組,如果怕被系統弄的不好看,請自己先處理吧。&/p&&p&&strong&4. &a href=&///?target=https%3A///watch%3Fv%3DZg4v9G-lku8& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Direct reply:&i class=&icon-external&&&/i&&/a&&/strong& For real-time communication apps, the Android system supportsinline replies so that users can quickly respond to an SMS or text message directly within the notification interface.&/p&&p&直接回應,就我所知以往要回覆信件或是 sns, notification 最多能作到的就是利用 pendingIntent 去開啟 activity 進行回應。而這次多了一個新的 api 就是 RemoteInput,配合 message style 可以作到直接在 notificaion 上輸入文字,直接回覆,而不需要離開通知欄。感覺就是為了 Android wear 所設計的,實際上 Android wear 上早已經有了。&/p&&p&&strong&5. Custom views&/strong&: Two new APIs enable you to leverage system decorations, such as notification headers and actions, when using custom views in notifications.&/p&&p&&strong&畫面客製化&/strong&,主要就是多了兩個 api style,這一樣會需要搭配 message style 會更好。&br&&a href=&///?target=https%3A///reference/android/app/Notification.DecoratedCustomViewStyle.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Notification.DecoratedCustomViewStyle:&i class=&icon-external&&&/i&&/a& Notification style for custom views that are decorated by the system.&br&&a href=&///?target=https%3A///reference/android/app/Notification.DecoratedMediaCustomViewStyle.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Notification.DecoratedMediaCustomViewStyle &i class=&icon-external&&&/i&&/a&:Notification style for media custom views that are decorated by the system.&/p&&p&總結:這次改動頗大,上次有比較大的改版感覺就是 notification service listener。而這次改版則是讓使用者可以有更多操作在 notification上面(受益最明顯的就是 email 這類 app (gmail)),其實這兩種改版都是為了讓 notification 不再像是潑出去的水一樣,就只是個通知,而是提高使用者,activity和 notification 之間的關聯性。ps.甚至在官方 blog 上提到 Android N 的 N 就是 notification。&/p&&a href=&///?target=https%3A///guide/topics/resources/multilingual-support.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Multi-locale Support, More Languages 多地區設定支援,更多語言&i class=&icon-external&&&/i&&/a&&p&Android N 現在可讓使用者在 [設定] 中選取&strong&多個地區設定&/strong&,以便以更好的方式支援雙語言使用案例。應用程式可以使用新的 API 取得使用者選取的地區設定,然後為多地區設定使用者提供更精細的使用者體驗 — 例如以多語言顯示搜尋結果,以及不為使用者已經熟知語言的網頁提供翻譯。&/p&&p&簡單來說,過去你只能選擇一種語言作為使用環境,假設是繁體中文,如果 App 並不支援繁體中文那就只能是預設英文,但現在你可以在『設定』裡選擇多個你最習慣的語言與優先權,假設是第一優先是法文(fr_cj),第二是義大利文(it_ch),如果 App 沒有支援法文,那就會自動找義大利文,如果還是找不到,那才會跳到英文。&/p&&p&對於國籍以及區碼的對應方式也改變。底下用幾張圖表示更加清楚&/p&&p&&strong&第一張圖:&/strong&這是 Android N 之前的作法,當使用者只設定 fr_CH ,但 App Resources 只有 en , de_DE , es_ES , fr_FR , it_IT,那他的比對過程就會是&/p&&p&1. 先確認 fr_CH =& 沒有
2. 接者對應國籍 fr =& 沒有 3. 最後只好使用預設 en&br&&/p&&p&&strong&第二張圖:&/strong&這是 Android N 的作法,當使用者只設定 fr_CH ,但 App Resources 只有 en , de_DE , es_ES , fr_FR , it_IT(同上),那他的比對過程就會是&/p&&p&1. 先確認 fr_CH =& 沒有
2. 接者對應國籍 fr =& 也沒有
3.找找看有沒有 Child 區碼對應到,就是 fr_FR
就決定是 fr_FR&/p&&p&第三張圖:這是如果設定兩種以上預設語言 P1: fr_CH , P2: it_CH,但 App Resources 只有 en , de_DE , es_ES , it_IT,那他的比對過程就會是&/p&&p&1. 先確認第一優先 fr_CH =& 沒有
2. 接者看國籍 fr =& 也沒有
3. 找找看有沒有 Child 區碼對應到 =& 還是沒有
4. 那開始找 P2:it_CH
=& 依然沒有
5. 找國籍 it =& 就是沒有
6. 那找找有沒有 Child 區碼對應到,就是 it_IT
7. 就決定是 it_IT&/p&&p&總結:為了加快批配速度,開發者最好能更加精準的給予資源對應。對使用者也是一大方便,有人就是只看的懂 中文和日文,Android 每次沒中文就跳到英文,煩不煩阿&/p&&a href=&///?target=https%3A///training/monitoring-device-state/doze-standby.htm& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Doze on the Go 移動時休眠&i class=&icon-external&&&/i&&/a&&p&Android 6.0 引進休眠功能,這是可節省電池電力的系統模式,它會在裝置閒置時 (例如放在桌子上或抽屜中) 延後應用程式的 CPU 與網路活動。&/p&&p&現在 Android N 中的休眠功能更進一步進展,『可在移動時節省電池電力』。只要螢幕關閉一段時間且裝置拔除電源的情況下,休眠功能就會將熟悉的 CPU 與網路限制的子集套用到應用程式(Doze applies a subset of the familiar CPU and network restrictions to apps)。這表示即使使用者將裝置放在口袋內時也可以節省電池電力。&/p&&p&原本Android M 的休眠情況只有以下&/p&&ul&&li&裝置閒置(不包含移動)&/li&&li&螢幕關閉&/li&&li&裝置拔除電源&/li&&/ul&&p&那麼『休眠功能就會將熟悉的 CPU 與網路限制的子集』這句是啥?看中英文都不好理解,再進一步就是底下這些情況&/p&&ul&&li&Network access is suspended.&/li&&li&The system ignores &a href=&///?target=https%3A///reference/android/os/PowerManager.WakeLock.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&wake locks&i class=&icon-external&&&/i&&/a&.&/li&&li&Standard &a href=&///?target=https%3A///reference/android/app/AlarmManager.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&AlarmManager&i class=&icon-external&&&/i&&/a& alarms (including &a href=&///?target=https%3A///reference/android/app/AlarmManager.html%23setExact%28int%2C%2520long%2C%2520android.app.PendingIntent%29& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&setExact()&i class=&icon-external&&&/i&&/a& and &a href=&///?target=https%3A///reference/android/app/AlarmManager.html%23setWindow%28int%2C%2520long%2C%2520long%2C%2520android.app.PendingIntent%29& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&setWindow()&i class=&icon-external&&&/i&&/a&) are deferred to the next maintenance window.&/li&&li&&ul&&li&If you need to set alarms that fire while in Doze, use &a href=&///?target=https%3A///reference/android/app/AlarmManager.html%23setAndAllowWhileIdle%28int%2C%2520long%2C%2520android.app.PendingIntent%29& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&setAndAllowWhileIdle()&i class=&icon-external&&&/i&&/a&or &a href=&///?target=https%3A///reference/android/app/AlarmManager.html%23setExactAndAllowWhileIdle%28int%2C%2520long%2C%2520android.app.PendingIntent%29& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&setExactAndAllowWhileIdle()&i class=&icon-external&&&/i&&/a&.&/li&&li&Alarms set with &a href=&///?target=https%3A///reference/android/app/AlarmManager.html%23setAlarmClock%28android.app.AlarmManager.AlarmClockInfo%2C%2520android.app.PendingIntent%29& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&setAlarmClock()&i class=&icon-external&&&/i&&/a& continue to fire normally — the system exits Doze shortly before those alarms fire.&/li&&/ul&&/li&&li&The system does not perform Wi-Fi scans.&/li&&li&The system does not allow &a href=&///?target=https%3A///reference/android/content/AbstractThreadedSyncAdapter.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&sync adapters&i class=&icon-external&&&/i&&/a& to run.&/li&&li&The system does not allow &a href=&///?target=https%3A///reference/android/app/job/JobScheduler.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&JobScheduler&i class=&icon-external&&&/i&&/a& to run&/li&&/ul&&p&總結:一句話『就算是移動中,沒在用手機我一樣進入休眠模式』,這裡 google 有提供建議 『&a href=&///?target=https%3A///training/monitoring-device-state/doze-standby.html%23using_gcm& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Using GCM to Interact with Your App While the Device is Idle&i class=&icon-external&&&/i&&/a&(we strongly recommend that you &strong&use GCM if possible&/strong&, rather than maintaining your own persistent network connection.)』,對於 GCM 的通知,Android 會有系統級的對應,相對好很多。&/p&&a href=&///?target=https%3A///topic/performance/background-optimization.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Project Svelte: Background Optimizations 專案 Svelte:背景最佳化&i class=&icon-external&&&/i&&/a&&p&專案 Svelte 一直努力在生態系統中讓各種 Android 裝置上系統與應用程式使用最少的 RAM。在 Android N 中,「專案 Svelte」專注於最佳化應用程式在背景執行的方式。&/p&&p&上面就是一段廢話,重點就是 Android 7.0 we&a href=&///?target=https%3A///reference/android/hardware/Camera.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&‘&i class=&icon-external&&&/i&&/a&re removing three commonly-used implicit broadcasts — &a href=&///?target=https%3A///reference/android/net/ConnectivityManager.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&CONNECTIVITY_ACTION&i class=&icon-external&&&/i&&/a&, &a href=&///?target=https%3A///reference/android/hardware/Camera.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ACTION_NEW_PICTURE&i class=&icon-external&&&/i&&/a&, and&a href=&///?target=https%3A///reference/android/hardware/Camera.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ACTION_NEW_VIDEO&i class=&icon-external&&&/i&&/a&— since those can wake the background processes of multiple apps at once and strain memory and battery. If your app is receiving these, take advantage of the Android 7.0 to migrate to &b&JobScheduler&/b& and related APIs instead.&/p&&p&總結:『從 Android 5.0,我就一直拜託大家快使用 &b&JobScheduler,可是你們好像又不太愛用,是不是做的不好阿?那我這次下大招了』google 如是說。&/b&&br&其實就是這三種 action 都有『thundering herd(驚群)』的問題,會造成 action 發出去的那一瞬間,一大堆 service 都醒來,讓 device 變得耗電,且浪費資源,所以這次配合上一段 Doze 來改善這問題。&a href=&///?target=https%3A///reference/android/net/ConnectivityManager.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&CONNECTIVITY_ACTION&i class=&icon-external&&&/i&&/a&,在執行中的AP還是可以用&a href=&///?target=https%3A///reference/android/content/BroadcastReceiver.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&BroadcastReceiver&i class=&icon-external&&&/i&&/a&向 &a href=&///?target=https%3A///reference/android/content/Context.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Context.registerReceiver()&i class=&icon-external&&&/i&&/a&註冊去聽CONNECTIVITY_CHANGE。&/p&&a href=&///?target=https%3A///watch%3Fv%3DH-9xKmuwawg& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Data Saver&i class=&icon-external&&&/i&&/a&&ul&&li&Android 7.0 introduces Data Saver mode, a new system service that helps reduce cellular data use by apps. Data Saver gives users control over how apps use cellular data and lets developers provide more efficient servicewhen Data Saver is on.&/li&&li&When Data Saver is on, the system blocks background data usage and signals apps to use less data in the foreground wherever possible — such as by limiting bit rate for streaming, reducing image quality, deferring optimistic precaching, and so on.&/li&&li&Android N 擴充 &a href=&///?target=https%3A///reference/android/net/ConnectivityManager.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ConnectivityManager&i class=&icon-external&&&/i&&/a& 為應用程式提供&a href=&///?target=https%3A///preview/features/data-saver.html%23status& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&擷取使用者的 Data Saver 喜好設定&i class=&icon-external&&&/i&&/a&與&a href=&///?target=https%3A///preview/features/data-saver.html%23monitor-changes& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&監視喜好設定變更&i class=&icon-external&&&/i&&/a&的方法。所有應用程式應該檢視使用者是否已啟用 Data Saver 並努力限制前景與背景的數據使用量(期許阿,希望大家能加入以下 code)。&/li&&/ul&&div class=&highlight&&&pre&&code class=&language-text&&ConnectivityManager connMgr = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);// Checks if the device is on a metered networkif (connMgr.isActiveNetworkMetered()) {
// Checks user’s Data Saver settings.
switch (connMgr.getRestrictBackgroundStatus()) {
case RESTRICT_BACKGROUND_STATUS_ENABLED:
// Background data usage is blocked for this app. Wherever possible,
// the app should also use less data in the foreground.
case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
// The app is whitelisted. Wherever possible,
// the app should use less data in the foreground and background.
case RESTRICT_BACKGROUND_STATUS_DISABLED:
// Data Saver is disabled. Since the device is connected to a
// metered network, the app should use less data wherever possible.
// The device is not on a metered network.
// Use data as required to perform syncs, downloads, and updates.}
&/code&&/pre&&/div&&p&Data saver 對於 app 的處理流程&/p&&p&總結:看完&a href=&///?target=https%3A///watch%3Fv%3DH-9xKmuwawg& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&& i/o 介紹影片&i class=&icon-external&&&/i&&/a&之後,又是一個拜託各位用 JobSchedule 的系統級限制(那女講者表情超有趣)。過去對於 Data usage 設定最多只有針對個別 App 的 cellular networks 開啟或關閉。如果有好心的 App (Google 自家 Youtube如下),了不起在底下加個 APP SETTINGS 讓你開啟 activity 進行流量限制設定。&/p&&p&如果是懶得做的 APP(Facebook 夠大廠了吧),啥鬼設定都沒有。&/p&&a href=&///?target=https%3A///reference/android/service/quicksettings/Tile.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Quick Settings Tile API 快速設定磚 API&i class=&icon-external&&&/i&&/a&&p&快速設定是直接從通知欄顯示關鍵設定與動作的常用簡單方式。在 Android N 中,我們擴充了快速設定的範圍,讓它變得更實用、更便利。&/p&&p&我們也為額外的快速設定磚增加了更多空間,使用者可以透過向左或向右撥動存取分頁顯示區域。我們也讓使用者能夠控制要顯示的快速設定磚與顯示位置 — 使用者只需拖放磚,即可新增或移除它們。&/p&&p&對於開發人員,Android N 也加入了新的 API,讓您定義自己的快速設定磚,以便使用者輕鬆存取您應用程式中的關鍵控制項與動作。&/p&&p&快速設定磚是專為急需或常用的控制項或動作而保留的,它不應該做為啟動應用程式的捷徑。&/p&&p&定義磚之後,您即可將它們顯示給使用者,使用者只需拖放這些磚,即可將它們新增到快速設定中。&/p&&p&如需建立應用程式磚的相關資訊,請參閱可下載之 &a href=&///?target=https%3A///reference/android/service/quicksettings/package-summary.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&API 參考資料&i class=&icon-external&&&/i&&/a&中的android.service.quicksettings.Tile。&/p&&p&總結:&a href=&///?target=https%3A///watch%3Fv%3DvTwJNlKXuMI& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&直接看影片最清楚&i class=&icon-external&&&/i&&/a&&br&&br&老實說這東西我開發上也沒有特別玩過,之前都要是裝置開發商才能用,現在終於釋放出來給一般APP 開發者玩 (這樣真的部會出現一大堆在 setting bar 上面嗎?之後可以實驗,一隻 app 到底可以放幾個 tile上去。主要做法須要實作 TileService 去聽 change 且有 permission “android.permission.BIND_QUICK_SETTINGS_TILE&)。(ps. 有機會的話,請我的好同事 J大來談一下這章節,來談談 api 24 之前的 quick settings 開發辛酸史,聽他轉述感覺 google 就是在做他之前的事情啊)&/p&&a href=&///?target=https%3A///training/tv/tif/content-recording.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Android TV 錄製&i class=&icon-external&&&/i&&/a&&p&Android N 透過新的錄製 API,新增了錄製和播放 Android TV 輸入服務內容的功能。以現有的時間位移 API 為建置基礎,TV 輸入服務可以控制要錄製哪個頻道的資料、如何儲存已錄製的時段,以及管理使用者與錄製內容的互動。&/p&&p&如需詳細資訊,請參閱 &a href=&///?target=https%3A///preview/features/tv-recording-api.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Android TV 錄製 API&i class=&icon-external&&&/i&&/a&。&/p&&p&總結:沒用過也沒玩過,但感覺很方便。歡迎大家提供看法。&/p&&a href=&///?target=https%3A///training/articles/security-config.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Network Security Configuration 網路安全性強化&i class=&icon-external&&&/i&&/a&&p&路安全性設定功能,讓應用程式在安全的宣告式設定檔中即可自訂網路安全性設定,而不必修改應用程式的程式碼。 這些設定可以針對特定網域以及針對特定應用程式來設定。主要有以下四點。&/p&&p&這一段真的比較是屬於開發層面,目前還是比較少碰一塊,希望我的理解是對得,也歡迎各位指教&/p&&p&&b&1. Custom trust anchors:&/b&Customize which Certificate Authorities (CA) are trusted for an app’s secure connections. For example, trusting particular self-signed certificates or restricting the set of public CAs that the app trusts.&/p&&p&設定自憑證 & 限止信任的 CA 組&br&&/p&&p&信任其他 CA&br&&/p&&p&&strong&自訂信任錨點: &/strong&其實只看上面的 xml code ,個人很直覺得就是把以前對 ssl(Secure Sockets Layer) 的處理由程式碼轉換到 google xml 的規範化,這確實可以有效降低開發者的苦工。以前的玩法就是在 Android 裡使用 HttpUrlConnection 使用 TrustManager 去處理。事實上大部分開發下不少開發者是不太處理這塊,主要是因為 Android 已經預先把合法發行單位(VeriSign)的憑證都拉進來。而比較特殊的情況則是開發者自己需要連線到自己的 server 作存取,然後又不想使用發行單位發行的憑證,原因其實蠻簡單,就是送去發行單位一年大概要繳費 100 – 500 美金,且大部分 app 會存取的 server 都蠻固定(股票:通常會要求使用個人 CA,信件:通常會自己 Import 公司的 CA….)。&/p&&p&以下為過去的寫法,為了處理自發行憑證,不少 google c/p(就是我) 工程師就會犯一些錯誤,第一段程式碼會信任所有的 CA ,這樣搞的話有 SSL 跟沒 SSL 是一樣的。&/p&&div class=&highlight&&&pre&&code class=&language-text&&import org.apache.http.conn.ssl.SSLSocketFpublic class MySSLSocketFactory extends SSLSocketFactory {
SSLContext sslContext = SSLContext.getInstance(&TLS&);
public MySSLSocketFactory(KeyStore truststore) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
super(truststore);
TrustManager tm = new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
public X509Certificate[] getAcceptedIssuers() {
sslContext.init(null, new TrustManager[] { tm }, null);
public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException {
return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose);
public Socket createSocket() throws IOException {
return sslContext.getSocketFactory().createSocket();
&/code&&/pre&&/div&&p&而以下這段則是 買一套送全部的典型範例,當憑證接受其中一個網站的 server ,那麼其他的也統統都接受了&/p&&div class=&highlight&&&pre&&code class=&language-text&&HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;DefaultHttpClient client = new DefaultHttpClient();SchemeRegistry registry = new SchemeRegistry();SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();socketFactory.setHostnameVerifier((X509HostnameVerifier) hostnameVerifier);registry.register(new Scheme(&https&, socketFactory, 443));SingleClientConnManager mgr = new SingleClientConnManager(client.getParams(), registry);DefaultHttpClient httpClient = new DefaultHttpClient(mgr, client.getParams());// Set verifier
HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);// Example send http requestfinal String url = &”HttpPost httpPost = new HttpPost(url);HttpResponse response = httpClient.execute(httpPost);HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
&/code&&/pre&&/div&&p&扯的這邊有點遠了,主要是想把前因後果還有耍笨的故事寫一下。另外不知道有沒有人覺得 raw/my_ca 這樣寫會有問題,如果被反組譯,那這個 CA 憑證不是很危險嗎?根據小組討論,感覺這個 ca 應該單純只是個公鑰,或是只是單純為了範例簡單寫而已
,歡迎有高手幫忙解答。&/p&&p&&b&2. Debug-only overrides:&/b&Safely debug secure connections in an app without added risk to the installed base.&/p&&p&設定 CA 進行偵錯:「只」有在 &a href=&///?target=https%3A///guide/topics/manifest/application-element.html%23debug& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&android:debuggable&i class=&icon-external&&&/i&&/a& 為 true 時才予以信任。就是實用測試功能,可以把在 code 裡面的 DEBUG 搬出來。因為 play store 採取的安全措施是,不接受標示為可偵錯的應用程式,所以這種方式會比條件式程式碼安全。&/p&&p&&b&3. Cleartext&/b&&b& traffic opt-out:&/b&Protect apps from accidental usage of cleartext traffic.&/p&&p&&strong&退出明碼流量&/strong&:打算只使用安全連線連線至目的地的應用程式,可以針對那些目的地退出支援明碼 (使用未加密的 HTTP 通訊協定,而非 HTTPS)。 此選項有助於避免應用程式由於外部來源 (例如,後端伺服器) 提供的 URL 中發生變更,而造成意外回復。 如需更多詳細資料,請參閱 &a href=&///?target=https%3A///reference/android/security/NetworkSecurityPolicy.html%3Fhl%3Dkm%23isCleartextTrafficPermitted%28%29& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&NetworkSecurityPolicy.isCleartextTrafficPermitted()&i class=&icon-external&&&/i&&/a&。『&/p&&p&This flag is honored on a best effort basis because it’s impossible to prevent all cleartext traffic from Android applications given the level of access provided to them. For example, there’s no expectation that the &a href=&///?target=https%3A///reference/java/net/Socket.html%3Fhl%3Dkm& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Socket&i class=&icon-external&&&/i&&/a& API will honor this flag because it cannot determine whether its traffic is in cleartext. However, most network traffic from applications is handled by higher-level network stacks/components which can honor this aspect of the policy.&/p&&p&NOTE: &a href=&///?target=https%3A///reference/android/webkit/WebView.html%3Fhl%3Dkm& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&WebView&i class=&icon-external&&&/i&&/a& does not honor this flag.』&/p&&p&例如上面,應用程式想要確保
的所有連線一律要透過 HTTPS 完成,以保護敏感流量不受惡意網路危害。&/p&&p&補充:在 API level 23. 有加入這個 android:usesCleartextTraffic,但這個是所有網域都被限制住,預設值是 true (for example, HTTP and FTP stacks, &a href=&///?target=https%3A///reference/android/app/DownloadManager.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&DownloadManager&i class=&icon-external&&&/i&&/a&,&a href=&///?target=https%3A///reference/android/media/MediaPlayer.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&MediaPlayer&i class=&icon-external&&&/i&&/a&)&/p&&p&&b&4. Certificate pinning:&/b&Restrict an app’s secure connection to particular certificates.&/p&&p&&strong&關聯憑證:&/strong&&/p&&p&應用程式一般會信任所有預先安裝的 CA。若這類的任何 CA 意在發行詐騙憑證,應用程式會有遭受 MiTM 攻擊的風險。 有些應用程式選擇透過限制所信任的 CA 組或關聯憑證,來限制可接受的憑證組。&/p&&p&憑證關聯的方法是,透過公用金鑰的雜湊 (X.509 憑證的 SubjectPublicKeyInfo) 來提供一組憑證。 只有當憑證鏈至少包含一個關聯的公用金鑰時,才是有效的憑證鏈。&/p&&p&請注意,使用憑證關聯時,您務必要包括備份金鑰,這樣萬一強制您切換到新的金鑰或變更 CA (關聯到 CA 憑證或該 CA 的中繼者) 時,您的應用程式連線才不會受到影響。 否則,您必須推出應用程式更新,才能還原連線。&/p&&p&總結:這段我只有在開發 mail 時有稍微涉略。沒辦法給出更多實務上的感想。但看得出來 google 從 M 開始就非常注意,但是 M 所在意的則是 device 操作以及使用者資料的權限安全,而 N 則是更加強化網路安全這塊。看起來應該是發生過太多問題啦。&/p&&a href=&///?target=https%3A///training/articles/scoped-directory-access.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Scoped Directory Access 限定範圍目錄存取&i class=&icon-external&&&/i&&/a&&p&應用程式 (例如,相片應用程式) 通常只需要存取外部儲存空間中的特定目錄,例如 Pictures 目錄。 目前用來存取外部儲存空間的方式並非設計來輕鬆地為這些類型的應用程式提供已設定目標的目錄存取。 例如:&/p&&ul&&li&在您的宣示說明中要求 &a href=&///?target=https%3A///reference/android/Manifest.permission.html%23READ_EXTERNAL_STORAGE& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&READ_EXTERNAL_STORAGE&i class=&icon-external&&&/i&&/a& 或 &a href=&///?target=https%3A///reference/android/Manifest.permission.html%23WRITE_EXTERNAL_STORAGE& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&WRITE_EXTERNAL_STORAGE&i class=&icon-external&&&/i&&/a& 可允許存取外部儲存空間ac上的所有公用目錄,但這可能超過您應用程式所需的存取權。&/li&&li&使用&a href=&///?target=https%3A///guide/topics/providers/document-provider.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&儲存空間存取架構&i class=&icon-external&&&/i&&/a&通常會使得您的使用者透過系統 UI 挑選目錄,這在您的應用程式一律存取相同外部目錄的情況下是不必要的。&/li&&/ul&&p&Android N 提供新的簡化 API,可用來存取常用外部儲存空間目錄。&/p&&div class=&highlight&&&pre&&code class=&language-text&&// 開啟主要共用儲存空間中的 &code&Pictures&/code& 目錄StorageManager sm = (StorageManager)getSystemService(Context.STORAGE_SERVICE);StorageVolume volume = sm.getPrimaryVolume();Intent intent = volume.createAccessIntent(Environment.DIRECTORY_PICTURES);startActivityForResult(intent, request_code);
&/code&&/pre&&/div&&p&並向使用者確認權限&br&&/p&&p&存取外部空間則需要,另外宣告&/p&&div class=&highlight&&&pre&&code class=&language-text&&// BroadcastReceiver has already cached the MEDIA_MOUNTED// notification Intent in mediaMountedIntentStorageVolume volume = (StorageVolume)
mediaMountedIntent.getParcelableExtra(StorageVolume.EXTRA_STORAGE_VOLUME);volume.createAccessIntent(Environment.DIRECTORY_PICTURES);startActivityForResult(intent, request_code);
&/code&&/pre&&/div&&p&總結:一直到目前,幾乎所有的 app 開發對於 store access 權限都是全有或是全無,這對使用者會在給予權限感到恐慌。google 也不是沒有想過這問題,就是在 kitkat 時加入的 &a href=&///?target=https%3A///guide/topics/providers/document-provider.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Storage Access Framework&i class=&icon-external&&&/i&&/a& 讓使用者自己挑選資料夾給予存取,但老實說我還真的很少看到會使用 SAF 的 app ,主要還是因為使用者會覺得太麻煩,總和『好麻煩』和『通天的權限』兩個問題, 就希望能取消兩大資料存取權限,然後針對固定通用型的系統資料夾做出簡化操作,改成發 intent 的方式去請系統幫忙保證資料的存取範圍。ps.取得對特定外部目錄的存取權也會取得對該目錄之子目錄的存取權。&/p&&a href=&///?target=https%3A///about/versions/nougat/android-7.0.html%3Fhl%3Den& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Virtual Files 虛擬檔案&i class=&icon-external&&&/i&&/a&&p&In previous versions of Android, your app could use the Storage Access Frameworkto allow users to select files from their cloud storage accounts, such as Google Drive. However, there was no way to represent files that did not have a direct byt every file was required to provide an input stream.&/p&&p&Android 7.0 adds the concept of &em&virtual files&/em& to the Storage Access Framework. The virtual files feature allows your &a href=&///?target=https%3A///reference/android/provider/DocumentsProvider.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&DocumentsProvider&i class=&icon-external&&&/i&&/a& to return document URIs that can be used with an &a href=&///?target=https%3A///reference/android/content/Intent.html%23ACTION_VIEW& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ACTION_VIEW&i class=&icon-external&&&/i&&/a& intent even if they don’t have a direct bytecode representation. Android 7.0 also allows you to provide alternate formats for user files, virtual or otherwise.&/p&&p&To get a URI for a virtual document in your app, first you create an &a href=&///?target=https%3A///reference/android/content/Intent.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Intent&i class=&icon-external&&&/i&&/a& to open the file picker UI. Since an app cannot directly open a virtual file by using the&a href=&///?target=https%3A///reference/android/content/ContentResolver.html%23openInputStream%28android.net.Uri%29& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&openInputStream()&i class=&icon-external&&&/i&&/a& method, your app does not receive any virtual files if you include the &a href=&///?target=https%3A///reference/android/content/Intent.html%23CATEGORY_OPENABLE& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&CATEGORY_OPENABLE&i class=&icon-external&&&/i&&/a& category.&/p&&p&After the user has made a selection, the system calls the &a href=&///?target=https%3A///reference/android/app/Activity.html%23onActivityResult%28int%2C%2520int%2C%2520android.content.Intent%29& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&onActivityResult()&i class=&icon-external&&&/i&&/a& method. Your app can retrieve the URI of the virtual file and get an input stream, as demonstrated in the code snippet below.&/p&&p&師爺來說說這是啥,就是以前雖然可以利用 Storage Access Framework 拿到雲端空間的 URI,但是因為雲端文件沒有在本地端的直接 bytecode 那就無法被顯示出來讓使用者選擇(這段話超難理解,簡單來說就是 &a href=&///?target=https%3A///reference/android/content/Intent.html%23ACTION_VIEW& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ACTION_VIEW&i class=&icon-external&&&/i&&/a& intent 沒辦法找到這個雲端文間 URI 的檔案),那現在加入 virtual file 的概念,這東西可以被 &a href=&///?target=https%3A///reference/android/provider/DocumentsProvider.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&DocumentsProvider&i class=&icon-external&&&/i&&/a& 找到,但是畢竟 virtual file 並不存在於 local ,所以就算現在可以用 &a href=&///?target=https%3A///reference/android/content/Intent.html%23ACTION_VIEW& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ACTION_VIEW&i class=&icon-external&&&/i&&/a& 找到, &a href=&///?target=https%3A///reference/android/content/ContentResolver.html%23openInputStream%28android.net.Uri%29& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&openInputStream&i class=&icon-external&&&/i&&/a& 依然無法存取 byte code.那要怎麼辦呢,我給你 code 你參考參考。&/p&&p&千言萬語不如來段 code&/p&&div class=&highlight&&&pre&&code class=&language-text&&// Other Activity code ...
final static private int REQUEST_CODE = 64;
// We listen to the OnActivityResult event to respond to the user's selection.
public void onActivityResult(int requestCode, int resultCode,
Intent resultData) {
if (requestCode == REQUEST_CODE &&
resultCode == Activity.RESULT_OK) {
if (resultData != null) {
uri = resultData.getData();
ContentResolver resolver = getContentResolver();
// Before attempting to coerce a file into a MIME type,
// check to see what alternative MIME types are available to
// coerce this file into.
String[] streamTypes =
resolver.getStreamTypes(uri, &*/*&);
AssetFileDescriptor descriptor =
resolver.openTypedAssetFileDescriptor(
streamTypes[0],
// Retrieve a stream to the virtual file.
InputStream inputStream = descriptor.createInputStream();
} catch (Exception ex) {
Log.e(&EXCEPTION&, &ERROR: &, ex);
&/code&&/pre&&/div&&p&底下是一般情況,非 virtual file&/p&&div class=&highlight&&&pre&&code class=&language-text&&@Overridepublic void onActivityResult(int requestCode, int resultCode,
Intent resultData) {
// The ACTION_OPEN_DOCUMENT intent was sent with the request code
// READ_REQUEST_CODE. If the request code seen here doesn't match, it's the
// response to some other intent, and the code below shouldn't run at all.
if (requestCode == READ_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
// The document selected by the user won't be returned in the intent.
// Instead, a URI to that document will be contained in the return intent
// provided to this method as a parameter.
// Pull that URI using resultData.getData().
if (resultData != null) {
uri = resultData.getData();
Log.i(TAG, &Uri: & + uri.toString());
showImage(uri);
&/code&&/pre&&/div&&p&總結:無感,因為我還是不太理解直接的應用點在哪?而且他的英文描述不太好懂,希望我沒有理解錯。歡迎大家指教。&/p&&a href=&///?target=https%3A///training/articles/direct-boot.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Supporting Direct Boot 直接開機&i class=&icon-external&&&/i&&/a&&p&直接開機可加速裝置啟動時間,並讓已註冊的應用程式只能使用有限的功能 (即使在未預期的重新開機之後)。例如,如果一個加密裝置在使用者睡覺時重新開機,已註冊的鬧鐘、訊息與來電現在可以持續如常通知使用者。這也表示協助工具服務在重新啟動之後可立即使用。&/p&&p&為了達到上述的目的,Android N 會在一個安全的 &i&直接開機&/i& 模式下執行,這是裝置已經開啟電源但使用者尚未解鎖裝置的期間。 為了支援這種方式,系統為資料提供兩個儲存位置:&/p&&ul&&li&&i&認證加密的儲存空間&/i&:這是預設的儲存位置,只有在使用者解鎖裝置之後才能使用。&/li&&li&&i&裝置加密的儲存空間&/i&:這是「直接開機」模式期間與使用者解鎖裝置之後都可以使用的儲存位置。&/li&&/ul&&p&這個部分我認為應該和 &a href=&///?target=http%3A//file-based%2520encryption%fbe%2529/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&file-based encryption (FBE)&i class=&icon-external&&&/i&&/a& 一起看,在 Android N 之前全部都是 full-disk encryption ,而這一版改成 FBE ,這直接受益部分就是直接開機。&/p&&p&『File-based encryption enables a new feature introduced in Android 7.0 called&a href=&///?target=https%3A///preview/features/direct-boot.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Direct Boot&i class=&icon-external&&&/i&&/a&. Direct Boot allows encrypted devices to boot straight to the lock screen. Previously, on encrypted devices using &a href=&///?target=https%3A///security/encryption/full-disk.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&full disk encryption&i class=&icon-external&&&/i&&/a& (FDE), users needed to provided credentials before any data could be accessed, preventing the phone from performing all but the most basic of operations。』&/p&&p&由於可以在兩種空間上進行切換,那對於開發者來說需要注意的是 切換點以及兩邊資料整合。先註冊 broadcastReceiver&/p&&div class=&highlight&&&pre&&code class=&language-text&&android.intent.action.ACTION_LOCKED_BOOT_COMPLETED
&/code&&/pre&&/div&&p&Getting Notified of User Unlock&/p&&ul&&ul&&li&If your app has foreground processes that need immediate notification, listen for the &a href=&///?target=https%3A///reference/android/content/Intent.html%23ACTION_USER_UNLOCKED& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ACTION_USER_UNLOCKED&i class=&icon-external&&&/i&&/a& message.&/li&&li&If your app only uses background processes that can act on a delayed notification, listen for the &a href=&///?target=https%3A///reference/android/content/Intent.html%23ACTION_BOOT_COMPLETED& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ACTION_BOOT_COMPLETED&i class=&icon-external&&&/i&&/a& message.&/li&&/ul&&/ul&&p&Migrating Existing Data&/p&&p&Use Context.moveSharedPreferencesFrom() and Context.moveDatabaseFrom() to migrate preference and database data between credential encrypted storage and device encrypted storage.&/p&&div class=&highlight&&&pre&&code class=&language-text&&Context directBootContext = appContext.createDeviceProtectedStorageContext();// Access appDataFilename that lives in device encrypted storageFileInputStream inStream = directBootContext.openFileInput(appDataFilename);// Use inStream to read content...
&/code&&/pre&&/div&&p&總結:我怎麼覺得 mtk 有個關機鬧鐘,那到底怎麼弄的。這次 Android N 在系統層面的安全性真的強化不少。&/p&&a href=&///?target=https%3A///work/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Android for Work Updates&i class=&icon-external&&&/i&&/a&&p&來段廣告詞『Android for Work 是協助企業使用 Android 的方案,包括 Android 的產品功能、Google Play for Work 及其他生產力工具。Android for Work 主要透過 API 發佈,可讓企業行動管理服務 (EMM) 供應商和企業應用程式開發商為客戶員工提供安全、有效率而多元化的行動環境。&/p&&ul&&li&&strong&Work profile security challenge&/strong&&/li&&li&設定檔擁有者可以為以工作設定檔執行之應用程式指定個別的安全性查問。當使用者嘗試開啟任何工作應用程式時會顯示工作查問。成功完成安全性查問可將工作設定檔解鎖並在必要時將它解密。&/li&&li&&strong&Toggle Work Mode&/strong&&/li&&li&在具有工作設定檔的裝置上,使用者可以切換工作模式。當工作模式關閉時,受管理的使用者會暫時關機,因此而停用工作設定檔應用程式、背景同步與通知。這也包括設定檔擁有者應用程式。當工作模式關閉時,系統會顯示持續的狀態圖示,提醒使用者他們無法啟動工作應用程式。啟動器會指出工作應用程式和小工具無法存取。&/li&&li&&strong&Always-On VPN&/strong&&/li&&li&裝置擁有者和設定檔擁有者可確保工作應用程式一律透過指定的 VPN 連線。系統會自動在裝置開機時啟動該 VPN。新的 DevicePolicyManager 方法是setAlwaysOnVpnPackage() 與 getAlwaysOnVpnPackage()。因為系統無需透過應用程式互動即可直接連結 VPN 服務,所以 VPN 用戶端需要為「一律開啟的 VPN」處理新的進入點。正如以往,透過符合動作android.net.VpnService 的意圖篩選器向系統指明服務。使用者也可以使用 [設定] & [更多] & [VPN] 手動設定「一律開啟的 VPN」用戶端,這些用戶端在主要使用者中實作 VPNService 方法。&/li&&li&&strong&Customized provisioning&/strong&&/li&&li&An application can customize the profile owner and device owner provisioning flows with corporate colors and logos. DevicePolicyManager.EXTRA_PROVISIONING_MAIN_COLOR customizes flow color.DevicePolicyManager.EXTRA_PROVISIONING_LOGO_URIcustomizes the flow with a corporate logo.&/li&&li&使用者可以自己定義驗證流程的主要顏色,或是放置公司 logo 。。&/li&&/ul&&p&總結:這個我真的連玩都沒玩過,更別說開發。感覺 always-on vpn 還蠻實用的。google 真的越來越重視 BYOD,除了區分工作與個人,安全性更是一大重點。我在看 api 時發現可以直接讀取公司的 calendar, email user contact。感覺很好用啊。&/p&&a href=&///?target=https%3A///guide/platform/j8-jack.html%3Fhl%3Den& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Java 8 Language features JAVA 8 支援&i class=&icon-external&&&/i&&/a&&p&Android does not currently support all Java 8 language features. However, the following features are now available when developing apps targeting the Android N Preview:&/p&&p&須使用 Android Studio 2.1 (預覽版) 與 Android N Preview SDK,其中包括必要的 Jack tool chain 與適用於 Gradle 的已更新 Android 外掛程式。&/p&&ul&&ul&&li&&a href=&///?target=https%3A///javase/tutorial/java/IandI/defaultmethods.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Default and static interface methods&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///javase/tutorial/java/javaOO/lambdaexpressions.html& class=& wrap external& target=&_blank& rel=&nofollow no

我要回帖

更多关于 handlemessage 的文章

 

随机推荐