Search in sources :

Example 1 with BackupManager

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;
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) BackupManager(android.app.backup.BackupManager)

Example 2 with BackupManager

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;
}
Also used : Context(android.content.Context) SharedPreferences(android.content.SharedPreferences) Editor(android.content.SharedPreferences.Editor) BackupManager(android.app.backup.BackupManager)

Example 3 with BackupManager

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();
}
Also used : RandomAccessFile(java.io.RandomAccessFile) File(java.io.File) BackupManager(android.app.backup.BackupManager)

Example 4 with BackupManager

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();
}
Also used : RandomAccessFile(java.io.RandomAccessFile) File(java.io.File) BackupManager(android.app.backup.BackupManager)

Example 5 with BackupManager

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);
}
Also used : Context(android.content.Context) OnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener) SharedPreferences(android.content.SharedPreferences) BackupManager(android.app.backup.BackupManager)

Aggregations

BackupManager (android.app.backup.BackupManager)10 File (java.io.File)6 RandomAccessFile (java.io.RandomAccessFile)5 Context (android.content.Context)3 SharedPreferences (android.content.SharedPreferences)3 Intent (android.content.Intent)2 Feed (de.danoeh.antennapod.core.feed.Feed)2 BroadcastReceiver (android.content.BroadcastReceiver)1 IntentFilter (android.content.IntentFilter)1 Editor (android.content.SharedPreferences.Editor)1 OnSharedPreferenceChangeListener (android.content.SharedPreferences.OnSharedPreferenceChangeListener)1 FeedImage (de.danoeh.antennapod.core.feed.FeedImage)1 FeedItem (de.danoeh.antennapod.core.feed.FeedItem)1 ArrayList (java.util.ArrayList)1