fixup! SaveImage: Check and strip userID from URI before accessing

Use encodedAuthority instead of authority to match behavior in other
areas of AOSP and prevent potential URI-related shenanigans.

Change-Id: Ia9ce58130ca080a9912a21e94dbfa81fcca94399
diff --git a/src/com/android/gallery3d/filtershow/tools/SaveImage.java b/src/com/android/gallery3d/filtershow/tools/SaveImage.java
index 56f213a..c7fa6dc 100755
--- a/src/com/android/gallery3d/filtershow/tools/SaveImage.java
+++ b/src/com/android/gallery3d/filtershow/tools/SaveImage.java
@@ -935,7 +935,7 @@
     }
 
     private static UserHandle getUserHandleFromUri(Uri uri) {
-        if (uri == null || uri.getAuthority() == null) return null;
+        if (uri == null || uri.getEncodedAuthority() == null) return null;
         final String userIdString = uri.getUserInfo();
         try {
             return UserHandle.getUserHandleForUid(Integer.parseInt(userIdString) * PER_UID_RANGE);
@@ -946,10 +946,10 @@
     }
 
     private static Uri getUriWithoutUserId(Uri uri) {
-        if (uri == null || uri.getAuthority() == null) return null;
-        int end = uri.getAuthority().lastIndexOf('@');
+        if (uri == null || uri.getEncodedAuthority() == null) return null;
+        int end = uri.getEncodedAuthority().lastIndexOf('@');
         Uri.Builder builder = uri.buildUpon();
-        builder.authority(uri.getAuthority().substring(end+1));
+        builder.encodedAuthority(uri.getEncodedAuthority().substring(end+1));
         return builder.build();
     }