use of android.app.backup.BackupManager in project android_frameworks_base by ParanoidAndroid.
the class SettingsProvider method onCreate.
@Override
public boolean onCreate() {
mBackupManager = new BackupManager(getContext());
mUserManager = UserManager.get(getContext());
setAppOps(AppOpsManager.OP_NONE, AppOpsManager.OP_WRITE_SETTINGS);
establishDbTracking(UserHandle.USER_OWNER);
IntentFilter userFilter = new IntentFilter();
userFilter.addAction(Intent.ACTION_USER_REMOVED);
getContext().registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_USER_REMOVED)) {
final int userHandle = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_OWNER);
if (userHandle != UserHandle.USER_OWNER) {
onUserRemoved(userHandle);
}
}
}
}, userFilter);
return true;
}
use of android.app.backup.BackupManager in project coursera-android by aporter.
the class BrowserProvider method onCreate.
@Override
public boolean onCreate() {
final Context context = getContext();
boolean xlargeScreenSize = (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
boolean isPortrait = (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);
if (xlargeScreenSize && isPortrait) {
mMaxSuggestionLongSize = MAX_SUGGEST_LONG_LARGE;
mMaxSuggestionShortSize = MAX_SUGGEST_SHORT_LARGE;
} else {
mMaxSuggestionLongSize = MAX_SUGGEST_LONG_SMALL;
mMaxSuggestionShortSize = MAX_SUGGEST_SHORT_SMALL;
}
mOpenHelper = new DatabaseHelper(context);
mBackupManager = new BackupManager(context);
// version 18 and 19 as in the other cases, we will erase the table.
if (DATABASE_VERSION == 18 || DATABASE_VERSION == 19) {
SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context);
boolean fix = p.getBoolean("fix_picasa", true);
if (fix) {
fixPicasaBookmark();
Editor ed = p.edit();
ed.putBoolean("fix_picasa", false);
ed.apply();
}
}
mSettings = BrowserSettings.getInstance();
return true;
}
use of android.app.backup.BackupManager in project android_frameworks_base by DirtyUnicorns.
the class HugeBackupActivity method onCreate.
/** Set up the activity and populate its UI from the persistent data. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/** Establish the activity's UI */
setContentView(R.layout.backup_restore);
/** Once the UI has been inflated, cache the controls for later */
mFillingGroup = (RadioGroup) findViewById(R.id.filling_group);
mAddMayoCheckbox = (CheckBox) findViewById(R.id.mayo);
mAddTomatoCheckbox = (CheckBox) findViewById(R.id.tomato);
/** Set up our file bookkeeping */
mDataFile = new File(getFilesDir(), HugeBackupActivity.DATA_FILE_NAME);
/** It is handy to keep a BackupManager cached */
mBackupManager = new BackupManager(this);
/**
* Finally, build the UI from the persistent store
*/
populateUI();
}
use of android.app.backup.BackupManager in project android_frameworks_base by ResurrectionRemix.
the class HugeBackupActivity method onCreate.
/** Set up the activity and populate its UI from the persistent data. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/** Establish the activity's UI */
setContentView(R.layout.backup_restore);
/** Once the UI has been inflated, cache the controls for later */
mFillingGroup = (RadioGroup) findViewById(R.id.filling_group);
mAddMayoCheckbox = (CheckBox) findViewById(R.id.mayo);
mAddTomatoCheckbox = (CheckBox) findViewById(R.id.tomato);
/** Set up our file bookkeeping */
mDataFile = new File(getFilesDir(), HugeBackupActivity.DATA_FILE_NAME);
/** It is handy to keep a BackupManager cached */
mBackupManager = new BackupManager(this);
/**
* Finally, build the UI from the persistent store
*/
populateUI();
}
use of android.app.backup.BackupManager in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class SubScreenFragment method onCreate.
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSharedPreferenceChangeListener = new OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(final SharedPreferences prefs, final String key) {
final SubScreenFragment fragment = SubScreenFragment.this;
final Context context = fragment.getActivity();
if (context == null || fragment.getPreferenceScreen() == null) {
final String tag = fragment.getClass().getSimpleName();
// TODO: Introduce a static function to register this class and ensure that
// onCreate must be called before "onSharedPreferenceChanged" is called.
Log.w(tag, "onSharedPreferenceChanged called before activity starts.");
return;
}
new BackupManager(context).dataChanged();
fragment.onSharedPreferenceChanged(prefs, key);
}
};
getSharedPreferences().registerOnSharedPreferenceChangeListener(mSharedPreferenceChangeListener);
}
Aggregations