diff options
author | Jeff Sharkey <jsharkey@android.com> | 2018-12-01 18:26:43 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2018-12-03 12:57:09 -0700 |
commit | cb394993547697cfc45053f8a7fc656dffea8630 (patch) | |
tree | 1069b9c0c22f171b59dd5075d724fe7ce7871948 /cmds/content/src | |
parent | bd9669cd6a7cd47dabf050479bdf8b9b0e2b6669 (diff) |
Redact location Exif tags when no permission.
When the caller doesn't hold the ACCESS_MEDIA_LOCATION permission,
any location Exif tags should be redacted for privacy reasons. We
still allow unredacted raw file access if the media is owned by the
calling app, since they should be able to see data they contributed.
Certain backup apps really want to see the original contents without
any redaction, so provide them a setRequireOriginal() API so they
get a strong exception whenever the original bits can't be provided.
Add the ability to open a redacted file for read/write access by
stopping redaction for any ranges that have been overwritten with
new data, along with tests to verify this behavior.
Extend "content" tool to bind null values.
Bug: 111892141
Test: atest android.os.RedactingFileDescriptorTest
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: I47b220036a712d9d49547196b90e031b10760f84
Diffstat (limited to 'cmds/content/src')
-rw-r--r-- | cmds/content/src/com/android/commands/content/Content.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmds/content/src/com/android/commands/content/Content.java b/cmds/content/src/com/android/commands/content/Content.java index 1597c8c9c2b2..52a2ab407f91 100644 --- a/cmds/content/src/com/android/commands/content/Content.java +++ b/cmds/content/src/com/android/commands/content/Content.java @@ -77,7 +77,7 @@ public class Content { + " <BINDING> binds a typed value to a column and is formatted:\n" + " <COLUMN_NAME>:<TYPE>:<COLUMN_VALUE> where:\n" + " <TYPE> specifies data type such as:\n" - + " b - boolean, s - string, i - integer, l - long, f - float, d - double\n" + + " b - boolean, s - string, i - integer, l - long, f - float, d - double, n - null\n" + " Note: Omit the value for passing an empty string, e.g column:s:\n" + " Example:\n" + " # Add \"new_setting\" secure setting with value \"new_value\".\n" @@ -153,6 +153,7 @@ public class Content { private static final String TYPE_LONG = "l"; private static final String TYPE_FLOAT = "f"; private static final String TYPE_DOUBLE = "d"; + private static final String TYPE_NULL = "n"; private static final String COLON = ":"; private static final String ARGUMENT_PREFIX = "--"; @@ -410,6 +411,8 @@ public class Content { values.put(column, Long.parseLong(value)); } else if (TYPE_FLOAT.equalsIgnoreCase(type) || TYPE_DOUBLE.equalsIgnoreCase(type)) { values.put(column, Double.parseDouble(value)); + } else if (TYPE_NULL.equalsIgnoreCase(type)) { + values.putNull(column); } else { throw new IllegalArgumentException("Unsupported type: " + type); } |