From 98a8e24148f1f6b693f01b1d6c59870bae8286aa Mon Sep 17 00:00:00 2001 From: Robert Berry Date: Thu, 25 Jan 2018 13:29:16 +0000 Subject: [PATCH] Add flag indicating transport is device-to-device transfer This flag allows BackupAgent instances to optionally backup more data for a device-to-device transfer. i.e., an app developer might want to only backup certain sensitive data if the transport is either client-side encrypted or a direct device-to-device transfer. Test: none, as it is just adding a flag Bug: 72486408 Change-Id: I7512ed0b1510f48789fe47cb8b7379674c315e76 --- api/current.txt | 19 ++++++++++--------- core/java/android/app/backup/BackupAgent.java | 9 +++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/api/current.txt b/api/current.txt index c38690c4ba8d0..cd5a408af8cde 100644 --- a/api/current.txt +++ b/api/current.txt @@ -6894,6 +6894,7 @@ package android.app.backup { method public void onRestoreFile(android.os.ParcelFileDescriptor, long, java.io.File, int, long, long) throws java.io.IOException; method public void onRestoreFinished(); field public static final int FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED = 1; // 0x1 + field public static final int FLAG_DEVICE_TO_DEVICE_TRANSFER = 2; // 0x2 field public static final int TYPE_DIRECTORY = 2; // 0x2 field public static final int TYPE_FILE = 1; // 0x1 } @@ -11558,15 +11559,15 @@ package android.content.res { public final class AssetManager implements java.lang.AutoCloseable { method public void close(); - method public final java.lang.String[] getLocales(); - method public final java.lang.String[] list(java.lang.String) throws java.io.IOException; - method public final java.io.InputStream open(java.lang.String) throws java.io.IOException; - method public final java.io.InputStream open(java.lang.String, int) throws java.io.IOException; - method public final android.content.res.AssetFileDescriptor openFd(java.lang.String) throws java.io.IOException; - method public final android.content.res.AssetFileDescriptor openNonAssetFd(java.lang.String) throws java.io.IOException; - method public final android.content.res.AssetFileDescriptor openNonAssetFd(int, java.lang.String) throws java.io.IOException; - method public final android.content.res.XmlResourceParser openXmlResourceParser(java.lang.String) throws java.io.IOException; - method public final android.content.res.XmlResourceParser openXmlResourceParser(int, java.lang.String) throws java.io.IOException; + method public java.lang.String[] getLocales(); + method public java.lang.String[] list(java.lang.String) throws java.io.IOException; + method public java.io.InputStream open(java.lang.String) throws java.io.IOException; + method public java.io.InputStream open(java.lang.String, int) throws java.io.IOException; + method public android.content.res.AssetFileDescriptor openFd(java.lang.String) throws java.io.IOException; + method public android.content.res.AssetFileDescriptor openNonAssetFd(java.lang.String) throws java.io.IOException; + method public android.content.res.AssetFileDescriptor openNonAssetFd(int, java.lang.String) throws java.io.IOException; + method public android.content.res.XmlResourceParser openXmlResourceParser(java.lang.String) throws java.io.IOException; + method public android.content.res.XmlResourceParser openXmlResourceParser(int, java.lang.String) throws java.io.IOException; field public static final int ACCESS_BUFFER = 3; // 0x3 field public static final int ACCESS_RANDOM = 1; // 0x1 field public static final int ACCESS_STREAMING = 2; // 0x2 diff --git a/core/java/android/app/backup/BackupAgent.java b/core/java/android/app/backup/BackupAgent.java index 6259d86367c11..72eb4948f0f93 100644 --- a/core/java/android/app/backup/BackupAgent.java +++ b/core/java/android/app/backup/BackupAgent.java @@ -154,6 +154,15 @@ public abstract class BackupAgent extends ContextWrapper { */ public static final int FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED = 1; + /** + * Flag for {@link BackupDataOutput#getTransportFlags()} and + * {@link FullBackupDataOutput#getTransportFlags()} only. + * + *

The transport is for a device-to-device transfer. There is no third party or intermediate + * storage. The user's backup data is sent directly to another device over e.g., USB or WiFi. + */ + public static final int FLAG_DEVICE_TO_DEVICE_TRANSFER = 2; + Handler mHandler = null; Handler getHandler() {