@Test public void getEncryptedFilename() { File file = new File("/data/user/0/test.bin"); File encryptedFile = Util.getEncryptedFilename(file); assertEquals(new File("/data/user/0/test.bin.encrypted"), encryptedFile); File decryptedFile = Util.getUnencryptedFilename(encryptedFile); assertEquals(file, decryptedFile); }
public static File getEncryptedFilename(File file) { String filename = file.getName(); return filename.endsWith(ENCRYPTED_FILENAME_SUFFIX) ? file : new File(file.getParent(), filename + ENCRYPTED_FILENAME_SUFFIX); }
Util { public static File getEncryptedFilename(File file) { String filename = file.getName(); return filename.endsWith(ENCRYPTED_FILENAME_SUFFIX) ? file : new File(file.getParent(), filename + ENCRYPTED_FILENAME_SUFFIX); } }
Util { public static File getEncryptedFilename(File file) { String filename = file.getName(); return filename.endsWith(ENCRYPTED_FILENAME_SUFFIX) ? file : new File(file.getParent(), filename + ENCRYPTED_FILENAME_SUFFIX); }  }
Util { public static File getEncryptedFilename(File file) { String filename = file.getName(); return filename.endsWith(ENCRYPTED_FILENAME_SUFFIX) ? file : new File(file.getParent(), filename + ENCRYPTED_FILENAME_SUFFIX); }  static int getStatusBarHeight(Window window); static int pixelsToDips(@NonNull Context context, int px); static float dipsToPixels(@NonNull Context context, float dp); static float dipsToPixelsFloat(@NonNull Context context, int dp); static void hideSoftKeyboard(Context context, View view); static void showSoftKeyboard(Activity activity, View target); static void showToast(final Context context, final String message, final int duration); static boolean isNetworkConnectionPresent(); static void ensureClosed(Closeable stream); static Point getScreenSize(Context context); static String trim(String string); static Integer parseCacheControlHeader(String cacheControlHeader); static boolean isEmailValid(String email); static boolean getPackageMetaDataBoolean(Context context, String key); static Object getPackageMetaData(Context appContext, String key); static String getPackageMetaDataSingleQuotedString(Context appContext, String key); static String stackTraceAsString(Throwable throwable); static String getStackTraceString(Throwable throwable); static double currentTimeSeconds(); static int getUtcOffset(); static String getInstallerPackageName(Context context); static String readStringFromInputStream(InputStream is, String charEncoding); static Integer getMajorOsVersion(); static Integer parseWebColorAsAndroidColor(String input); static void setBackground(View v, Drawable d); static void setBackground(View v, int drawableRes); static Drawable getCompatDrawable(Context c, int drawableRes); static int getResourceIdFromAttribute(Resources.Theme theme, int attr); static int getThemeColor(Context context, int attr); static int getThemeColor(Resources.Theme theme, int attr); static int getThemeColorFromAttrOrRes(Context ctx, int attr, int res); static StateListDrawable getSelectableImageButtonBackground(int selected_color); static int brighter(int color, float factor); static int dimmer(int color, float factor); static int alphaMixColors(int backgroundColor, int foregroundColor); static boolean canLaunchIntent(Context context, Intent intent); static String classToString(Object object); static String getMimeTypeFromUri(Context context, Uri contentUri); static String getRealFilePathFromUri(Context context, Uri contentUri); static long getContentCreationTime(Context context, Uri contentUri); static String generateRandomFilename(); static String generateCacheFileFullPath(String url, File cacheDir); static String generateCacheFileFullPath(Uri fileOriginalUri, File cacheDir, long createdTime); static File getDiskCacheDir(Context context); static String generateCacheFilePathFromNonceOrPrefix(Context context, String nonce, String prefix); static boolean hasPermission(Context context, final String permission); static boolean openFileAttachment(final Context context, final String sourcePath, final String selectedFilePath, final String mimeTypeString); static int copyFile(String from, String to); static void writeBytes(File file, byte[] bytes); static byte[] readBytes(File file); static void writeText(File file, String text); static void writeText(File file, List<String> text); static void writeText(File file, List<String> text, boolean append); static void appendFileToStream(File file, OutputStream outputStream); static void writeAtomically(File file, byte[] bytes); static void writeNullableUTF(DataOutput out, @Nullable String value); static String readNullableUTF(DataInput in); static void writeNullableBoolean(DataOutput out, Boolean value); static Boolean readNullableBoolean(DataInput in); static void writeNullableDouble(DataOutput out, Double value); static Double readNullableDouble(DataInput in); static boolean isMimeTypeImage(String mimeType); static StoredFile createLocalStoredFile(String sourceUrl, String localFilePath, String mimeType); static StoredFile createLocalStoredFile(InputStream is, String sourceUrl, String localFilePath, String mimeType); static Activity castContextToActivity(Context context); static void replaceDefaultFont(Context context, String fontFilePath); static Resources.Theme buildApptentiveInteractionTheme(Context context); static String humanReadableByteCount(long bytes, boolean si); static String getAndroidID(Context context); static File getInternalDir(Context context, String path, boolean createIfNecessary); static String getManifestMetadataString(Context context, String key); static String getClipboardText(Context context); static void setClipboardText(Context context, String text); static @Nullable View.OnClickListener guarded(@Nullable final View.OnClickListener listener); static String currentDateAsFilename(String prefix, String suffix); static @Nullable Intent makeRestartActivityTask(ComponentName cn); static File getEncryptedFilename(File file); static File getUnencryptedFilename(File file); }
Util { public static File getEncryptedFilename(File file) { String filename = file.getName(); return filename.endsWith(ENCRYPTED_FILENAME_SUFFIX) ? file : new File(file.getParent(), filename + ENCRYPTED_FILENAME_SUFFIX); }  static int getStatusBarHeight(Window window); static int pixelsToDips(@NonNull Context context, int px); static float dipsToPixels(@NonNull Context context, float dp); static float dipsToPixelsFloat(@NonNull Context context, int dp); static void hideSoftKeyboard(Context context, View view); static void showSoftKeyboard(Activity activity, View target); static void showToast(final Context context, final String message, final int duration); static boolean isNetworkConnectionPresent(); static void ensureClosed(Closeable stream); static Point getScreenSize(Context context); static String trim(String string); static Integer parseCacheControlHeader(String cacheControlHeader); static boolean isEmailValid(String email); static boolean getPackageMetaDataBoolean(Context context, String key); static Object getPackageMetaData(Context appContext, String key); static String getPackageMetaDataSingleQuotedString(Context appContext, String key); static String stackTraceAsString(Throwable throwable); static String getStackTraceString(Throwable throwable); static double currentTimeSeconds(); static int getUtcOffset(); static String getInstallerPackageName(Context context); static String readStringFromInputStream(InputStream is, String charEncoding); static Integer getMajorOsVersion(); static Integer parseWebColorAsAndroidColor(String input); static void setBackground(View v, Drawable d); static void setBackground(View v, int drawableRes); static Drawable getCompatDrawable(Context c, int drawableRes); static int getResourceIdFromAttribute(Resources.Theme theme, int attr); static int getThemeColor(Context context, int attr); static int getThemeColor(Resources.Theme theme, int attr); static int getThemeColorFromAttrOrRes(Context ctx, int attr, int res); static StateListDrawable getSelectableImageButtonBackground(int selected_color); static int brighter(int color, float factor); static int dimmer(int color, float factor); static int alphaMixColors(int backgroundColor, int foregroundColor); static boolean canLaunchIntent(Context context, Intent intent); static String classToString(Object object); static String getMimeTypeFromUri(Context context, Uri contentUri); static String getRealFilePathFromUri(Context context, Uri contentUri); static long getContentCreationTime(Context context, Uri contentUri); static String generateRandomFilename(); static String generateCacheFileFullPath(String url, File cacheDir); static String generateCacheFileFullPath(Uri fileOriginalUri, File cacheDir, long createdTime); static File getDiskCacheDir(Context context); static String generateCacheFilePathFromNonceOrPrefix(Context context, String nonce, String prefix); static boolean hasPermission(Context context, final String permission); static boolean openFileAttachment(final Context context, final String sourcePath, final String selectedFilePath, final String mimeTypeString); static int copyFile(String from, String to); static void writeBytes(File file, byte[] bytes); static byte[] readBytes(File file); static void writeText(File file, String text); static void writeText(File file, List<String> text); static void writeText(File file, List<String> text, boolean append); static void appendFileToStream(File file, OutputStream outputStream); static void writeAtomically(File file, byte[] bytes); static void writeNullableUTF(DataOutput out, @Nullable String value); static String readNullableUTF(DataInput in); static void writeNullableBoolean(DataOutput out, Boolean value); static Boolean readNullableBoolean(DataInput in); static void writeNullableDouble(DataOutput out, Double value); static Double readNullableDouble(DataInput in); static boolean isMimeTypeImage(String mimeType); static StoredFile createLocalStoredFile(String sourceUrl, String localFilePath, String mimeType); static StoredFile createLocalStoredFile(InputStream is, String sourceUrl, String localFilePath, String mimeType); static Activity castContextToActivity(Context context); static void replaceDefaultFont(Context context, String fontFilePath); static Resources.Theme buildApptentiveInteractionTheme(Context context); static String humanReadableByteCount(long bytes, boolean si); static String getAndroidID(Context context); static File getInternalDir(Context context, String path, boolean createIfNecessary); static String getManifestMetadataString(Context context, String key); static String getClipboardText(Context context); static void setClipboardText(Context context, String text); static @Nullable View.OnClickListener guarded(@Nullable final View.OnClickListener listener); static String currentDateAsFilename(String prefix, String suffix); static @Nullable Intent makeRestartActivityTask(ComponentName cn); static File getEncryptedFilename(File file); static File getUnencryptedFilename(File file);  }