蜂巢最近应用自动截图缓存

发布于 2024-11-04 19:25:20 字数 379 浏览 0 评论 0原文

在Android 3.0中,“最近使用的应用程序”列表中会自动截取应用程序的屏幕截图。看起来 SurfaceFlinger 负责根据以下日志输出来获取这些屏幕截图:

D/SurfaceFlinger(  133): screenshot: sw=216, sh=135, minZ=0, maxZ=21020
D/SurfaceFlinger(  133): screenshot: result = OK

这些图像缓存在文件系统的何处(如果有的话)? iOS也有类似的功能,当应用程序发送到后台时会自动截取屏幕截图,并且图像缓存在/private/var/root/Library/Caches/Snapshots中,我想知道Android是否也保留这些图像在可访问的地方。

In Android 3.0, there are automatic screenshots taken of applications for use in the "Recent Apps" list. It looks like SurfaceFlinger is responsible for taking these screenshots based on the following log output:

D/SurfaceFlinger(  133): screenshot: sw=216, sh=135, minZ=0, maxZ=21020
D/SurfaceFlinger(  133): screenshot: result = OK

Where (if at all) on the filesystem are these images cached? iOS has a similar feature where screenshots are automatically taken when an application is sent to the background, and the images are cached in /private/var/root/Library/Caches/Snapshots, and I'd like to know if Android also keeps these images somewhere accessible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

随心而道 2024-11-11 19:25:20

应用程序无法访问这些缩略图。

These thumbnails are not accessible by applications.

却一份温柔 2024-11-11 19:25:20
private void getRecentTaskThumbnails() {
    if (mBitmaps != null) {
        mBitmaps.clear();
    } else {
        mBitmaps = new LinkedList<Bitmap>();
    }
    mCurIndex = 0;

    ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);

    List<ActivityManager.RecentTaskInfo> recentTasks = am.getRecentTasks(
            20, ActivityManager.RECENT_IGNORE_UNAVAILABLE);
    for (ActivityManager.RecentTaskInfo task : recentTasks) {
        Log.e(TAG, "task:"
                + task.baseIntent.getComponent().getPackageName() + "="
                + task.persistentId);

        ActivityManager.TaskThumbnails thumbs = am
                .getTaskThumbnails(task.persistentId);
        if(thumbs != null && thumbs.mainThumbnail != null) {
            mBitmaps.add(thumbs.mainThumbnail);
            Log.e(TAG, "thumbs=" + thumbs + "size="+thumbs.mainThumbnail.getWidth()+","+thumbs.mainThumbnail.getHeight());              
        }
    }
}
private void getRecentTaskThumbnails() {
    if (mBitmaps != null) {
        mBitmaps.clear();
    } else {
        mBitmaps = new LinkedList<Bitmap>();
    }
    mCurIndex = 0;

    ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);

    List<ActivityManager.RecentTaskInfo> recentTasks = am.getRecentTasks(
            20, ActivityManager.RECENT_IGNORE_UNAVAILABLE);
    for (ActivityManager.RecentTaskInfo task : recentTasks) {
        Log.e(TAG, "task:"
                + task.baseIntent.getComponent().getPackageName() + "="
                + task.persistentId);

        ActivityManager.TaskThumbnails thumbs = am
                .getTaskThumbnails(task.persistentId);
        if(thumbs != null && thumbs.mainThumbnail != null) {
            mBitmaps.add(thumbs.mainThumbnail);
            Log.e(TAG, "thumbs=" + thumbs + "size="+thumbs.mainThumbnail.getWidth()+","+thumbs.mainThumbnail.getHeight());              
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文