Prevent launch while extras in unpacking
This commit is contained in:
parent
d35d54afa4
commit
2c73f5a0fa
1 changed files with 18 additions and 15 deletions
|
@ -18,12 +18,14 @@ public class InstallReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
public static SharedPreferences mPref = null;
|
public static SharedPreferences mPref = null;
|
||||||
private static final int PAK_VERSION = 5;
|
private static final int PAK_VERSION = 5;
|
||||||
public static void extractPAK(Context context, Boolean force) {
|
public static synchronized void extractPAK(Context context, Boolean force) {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
FileOutputStream os = null;
|
FileOutputStream os = null;
|
||||||
try {
|
try {
|
||||||
if( mPref == null )
|
if( mPref == null )
|
||||||
mPref = context.getSharedPreferences("engine", 0);
|
mPref = context.getSharedPreferences("engine", 0);
|
||||||
|
synchronized( mPref )
|
||||||
|
{
|
||||||
if( mPref.getInt( "pakversion", 0 ) == PAK_VERSION && !force )
|
if( mPref.getInt( "pakversion", 0 ) == PAK_VERSION && !force )
|
||||||
return;
|
return;
|
||||||
String path = context.getFilesDir().getPath()+"/extras.pak";
|
String path = context.getFilesDir().getPath()+"/extras.pak";
|
||||||
|
@ -40,6 +42,7 @@ public class InstallReceiver extends BroadcastReceiver {
|
||||||
SharedPreferences.Editor editor = mPref.edit();
|
SharedPreferences.Editor editor = mPref.edit();
|
||||||
editor.putInt( "pakversion", PAK_VERSION );
|
editor.putInt( "pakversion", PAK_VERSION );
|
||||||
editor.commit();
|
editor.commit();
|
||||||
|
}
|
||||||
} catch( Exception e )
|
} catch( Exception e )
|
||||||
{
|
{
|
||||||
Log.e( TAG, "Failed to extract PAK:" + e.toString() );
|
Log.e( TAG, "Failed to extract PAK:" + e.toString() );
|
||||||
|
|
Loading…
Add table
Reference in a new issue