File tree Expand file tree Collapse file tree 1 file changed +8
-20
lines changed
firebase-installations/src/main/java/com/google/firebase/installations/local Expand file tree Collapse file tree 1 file changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -92,33 +92,21 @@ private File getDataFile() {
9292 new File (
9393 firebaseApp .getApplicationContext ().getNoBackupFilesDir (),
9494 SETTINGS_FILE_NAME_PREFIX + "." + firebaseApp .getPersistenceKey () + ".json" );
95- }
96- }
97- } else {
98- synchronized (this ) {
99- try {
100- String noBackUpFilePath =
101- firebaseApp .getApplicationContext ().getNoBackupFilesDir ().getCanonicalPath ();
102- if (dataFile .getCanonicalPath ().startsWith (noBackUpFilePath )) {
95+ if (dataFile .exists ()) {
10396 return dataFile ;
104- } else {
105- // Move the file to the no back up directory.
106- File dataFileNonBackup =
107- new File (
108- firebaseApp .getApplicationContext ().getNoBackupFilesDir (),
109- SETTINGS_FILE_NAME_PREFIX + "." + firebaseApp .getPersistenceKey () + ".json" );
110-
111- if (!dataFile .renameTo (dataFileNonBackup )) {
97+ }
98+ File dataFileBackup =
99+ new File (
100+ firebaseApp .getApplicationContext ().getFilesDir (),
101+ SETTINGS_FILE_NAME_PREFIX + "." + firebaseApp .getPersistenceKey () + ".json" );
102+ if (dataFileBackup .exists ()) {
103+ if (!dataFileBackup .renameTo (dataFile )) {
112104 Log .e (
113105 TAG ,
114106 "Unable to move the file from back up to non back up directory" ,
115107 new IOException ("Unable to move the file from back up to non back up directory" ));
116- } else {
117- dataFile = dataFileNonBackup ;
118108 }
119109 }
120- } catch (IOException e ) {
121- Log .e (TAG , "Error copying data file to non back up directory" , e );
122110 }
123111 }
124112 }
You can’t perform that action at this time.
0 commit comments