Search in sources :

Example 16 with IBackupManager

use of android.app.backup.IBackupManager in project android_packages_apps_Settings by DirtyUnicorns.

the class PrivacySettings method getNonVisibleKeys.

private static void getNonVisibleKeys(Context context, Collection<String> nonVisibleKeys) {
    final IBackupManager backupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
    boolean isServiceActive = false;
    try {
        isServiceActive = backupManager.isBackupServiceActive(UserHandle.myUserId());
    } catch (RemoteException e) {
        Log.w(TAG, "Failed querying backup manager service activity status. " + "Assuming it is inactive.");
    }
    boolean vendorSpecific = context.getPackageManager().resolveContentProvider(GSETTINGS_PROVIDER, 0) == null;
    if (vendorSpecific || isServiceActive) {
        nonVisibleKeys.add(BACKUP_INACTIVE);
    }
    if (vendorSpecific || !isServiceActive) {
        nonVisibleKeys.add(BACKUP_DATA);
        nonVisibleKeys.add(AUTO_RESTORE);
        nonVisibleKeys.add(CONFIGURE_ACCOUNT);
    }
    if (RestrictedLockUtils.hasBaseUserRestriction(context, UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
        nonVisibleKeys.add(FACTORY_RESET);
    }
}
Also used : IBackupManager(android.app.backup.IBackupManager) RemoteException(android.os.RemoteException)

Example 17 with IBackupManager

use of android.app.backup.IBackupManager in project cornerstone by Onskreen.

the class ActivityManagerService method processStartTimedOutLocked.

private final void processStartTimedOutLocked(ProcessRecord app) {
    final int pid = app.pid;
    boolean gone = false;
    synchronized (mPidsSelfLocked) {
        ProcessRecord knownApp = mPidsSelfLocked.get(pid);
        if (knownApp != null && knownApp.thread == null) {
            mPidsSelfLocked.remove(pid);
            gone = true;
        }
    }
    if (gone) {
        Slog.w(TAG, "Process " + app + " failed to attach");
        EventLog.writeEvent(EventLogTags.AM_PROCESS_START_TIMEOUT, pid, app.uid, app.processName);
        mProcessNames.remove(app.processName, app.uid);
        mIsolatedProcesses.remove(app.uid);
        if (mHeavyWeightProcess == app) {
            mHeavyWeightProcess = null;
            mHandler.sendEmptyMessage(CANCEL_HEAVY_NOTIFICATION_MSG);
        }
        // Take care of any launching providers waiting for this process.
        checkAppInLaunchingProvidersLocked(app, true);
        // Take care of any services that are waiting for the process.
        for (int i = 0; i < mPendingServices.size(); i++) {
            ServiceRecord sr = mPendingServices.get(i);
            if ((app.uid == sr.appInfo.uid && app.processName.equals(sr.processName)) || sr.isolatedProc == app) {
                Slog.w(TAG, "Forcing bringing down service: " + sr);
                sr.isolatedProc = null;
                mPendingServices.remove(i);
                i--;
                bringDownServiceLocked(sr, true);
            }
        }
        EventLog.writeEvent(EventLogTags.AM_KILL, pid, app.processName, app.setAdj, "start timeout");
        Process.killProcessQuiet(pid);
        if (mBackupTarget != null && mBackupTarget.app.pid == pid) {
            Slog.w(TAG, "Unattached app died before backup, skipping");
            try {
                IBackupManager bm = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
                bm.agentDisconnected(app.info.packageName);
            } catch (RemoteException e) {
            // Can't happen; the backup manager is local
            }
        }
        if (isPendingBroadcastProcessLocked(pid)) {
            Slog.w(TAG, "Unattached app died before broadcast acknowledged, skipping");
            skipPendingBroadcastLocked(pid);
        }
    } else {
        Slog.w(TAG, "Spurious process start timeout - pid not known for " + app);
    }
}
Also used : IBackupManager(android.app.backup.IBackupManager) RemoteException(android.os.RemoteException)

Example 18 with IBackupManager

use of android.app.backup.IBackupManager in project cornerstone by Onskreen.

the class ActivityManagerService method cleanUpApplicationRecordLocked.

/**
 * Main code for cleaning up a process when it has gone away.  This is
 * called both as a result of the process dying, or directly when stopping
 * a process when running in single process mode.
 */
private final void cleanUpApplicationRecordLocked(ProcessRecord app, boolean restarting, boolean allowRestart, int index) {
    if (index >= 0) {
        mLruProcesses.remove(index);
    }
    mProcessesToGc.remove(app);
    // Dismiss any open dialogs.
    if (app.crashDialog != null) {
        app.crashDialog.dismiss();
        app.crashDialog = null;
    }
    if (app.anrDialog != null) {
        app.anrDialog.dismiss();
        app.anrDialog = null;
    }
    if (app.waitDialog != null) {
        app.waitDialog.dismiss();
        app.waitDialog = null;
    }
    app.crashing = false;
    app.notResponding = false;
    app.resetPackageList();
    app.unlinkDeathRecipient();
    app.thread = null;
    app.forcingToForeground = null;
    app.foregroundServices = false;
    app.foregroundActivities = false;
    app.hasShownUi = false;
    app.hasAboveClient = false;
    killServicesLocked(app, allowRestart);
    boolean restart = false;
    // Remove published content providers.
    if (!app.pubProviders.isEmpty()) {
        Iterator<ContentProviderRecord> it = app.pubProviders.values().iterator();
        while (it.hasNext()) {
            ContentProviderRecord cpr = it.next();
            final boolean always = app.bad || !allowRestart;
            if (removeDyingProviderLocked(app, cpr, always) || always) {
                // We left the provider in the launching list, need to
                // restart it.
                restart = true;
            }
            cpr.provider = null;
            cpr.proc = null;
        }
        app.pubProviders.clear();
    }
    // Take care of any launching providers waiting for this process.
    if (checkAppInLaunchingProvidersLocked(app, false)) {
        restart = true;
    }
    // Unregister from connected content providers.
    if (!app.conProviders.isEmpty()) {
        for (int i = 0; i < app.conProviders.size(); i++) {
            ContentProviderConnection conn = app.conProviders.get(i);
            conn.provider.connections.remove(conn);
        }
        app.conProviders.clear();
    }
    // the actual situation to identify what is actually going on.
    if (false) {
        for (int i = 0; i < mLaunchingProviders.size(); i++) {
            ContentProviderRecord cpr = (ContentProviderRecord) mLaunchingProviders.get(i);
            if (cpr.connections.size() <= 0 && !cpr.hasExternalProcessHandles()) {
                synchronized (cpr) {
                    cpr.launchingApp = null;
                    cpr.notifyAll();
                }
            }
        }
    }
    skipCurrentReceiverLocked(app);
    // Unregister any receivers.
    if (app.receivers.size() > 0) {
        Iterator<ReceiverList> it = app.receivers.iterator();
        while (it.hasNext()) {
            removeReceiverLocked(it.next());
        }
        app.receivers.clear();
    }
    // If the app is undergoing backup, tell the backup manager about it
    if (mBackupTarget != null && app.pid == mBackupTarget.app.pid) {
        if (DEBUG_BACKUP)
            Slog.d(TAG, "App " + mBackupTarget.appInfo + " died during backup");
        try {
            IBackupManager bm = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
            bm.agentDisconnected(app.info.packageName);
        } catch (RemoteException e) {
        // can't happen; backup manager is local
        }
    }
    for (int i = mPendingProcessChanges.size() - 1; i >= 0; i--) {
        ProcessChangeItem item = mPendingProcessChanges.get(i);
        if (item.pid == app.pid) {
            mPendingProcessChanges.remove(i);
            mAvailProcessChanges.add(item);
        }
    }
    mHandler.obtainMessage(DISPATCH_PROCESS_DIED, app.pid, app.info.uid, null).sendToTarget();
    // current lists and let the caller take care of it.
    if (restarting) {
        return;
    }
    if (!app.persistent || app.isolated) {
        if (DEBUG_PROCESSES)
            Slog.v(TAG, "Removing non-persistent process during cleanup: " + app);
        mProcessNames.remove(app.processName, app.uid);
        mIsolatedProcesses.remove(app.uid);
        if (mHeavyWeightProcess == app) {
            mHeavyWeightProcess = null;
            mHandler.sendEmptyMessage(CANCEL_HEAVY_NOTIFICATION_MSG);
        }
    } else if (!app.removed) {
        // and start a new process for it.
        if (mPersistentStartingProcesses.indexOf(app) < 0) {
            mPersistentStartingProcesses.add(app);
            restart = true;
        }
    }
    if (DEBUG_PROCESSES && mProcessesOnHold.contains(app))
        Slog.v(TAG, "Clean-up removing on hold: " + app);
    mProcessesOnHold.remove(app);
    if (app == mHomeProcess) {
        mHomeProcess = null;
    }
    if (app == mPreviousProcess) {
        mPreviousProcess = null;
    }
    if (restart && !app.isolated) {
        // We have components that still need to be running in the
        // process, so re-launch it.
        mProcessNames.put(app.processName, app.uid, app);
        startProcessLocked(app, "restart", app.processName);
    } else if (app.pid > 0 && app.pid != MY_PID) {
        // Goodbye!
        synchronized (mPidsSelfLocked) {
            mPidsSelfLocked.remove(app.pid);
            mHandler.removeMessages(PROC_START_TIMEOUT_MSG, app);
        }
        app.setPid(0);
    }
}
Also used : IBackupManager(android.app.backup.IBackupManager) RemoteException(android.os.RemoteException)

Example 19 with IBackupManager

use of android.app.backup.IBackupManager in project android_packages_apps_Settings by SudaMod.

the class PrivacySettings method getNonVisibleKeys.

private static void getNonVisibleKeys(Context context, Collection<String> nonVisibleKeys) {
    final IBackupManager backupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
    boolean isServiceActive = false;
    try {
        isServiceActive = backupManager.isBackupServiceActive(UserHandle.myUserId());
    } catch (RemoteException e) {
        Log.w(TAG, "Failed querying backup manager service activity status. " + "Assuming it is inactive.");
    }
    boolean vendorSpecific = context.getPackageManager().resolveContentProvider(GSETTINGS_PROVIDER, 0) == null;
    if (vendorSpecific || isServiceActive) {
        nonVisibleKeys.add(BACKUP_INACTIVE);
    }
    if (vendorSpecific || !isServiceActive) {
        nonVisibleKeys.add(BACKUP_DATA);
        nonVisibleKeys.add(AUTO_RESTORE);
        nonVisibleKeys.add(CONFIGURE_ACCOUNT);
    }
    if (RestrictedLockUtils.hasBaseUserRestriction(context, UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
        nonVisibleKeys.add(FACTORY_RESET);
    }
}
Also used : IBackupManager(android.app.backup.IBackupManager) RemoteException(android.os.RemoteException)

Example 20 with IBackupManager

use of android.app.backup.IBackupManager in project platform_packages_apps_Settings by BlissRoms.

the class PrivacySettings method getNonVisibleKeys.

private static void getNonVisibleKeys(Context context, Collection<String> nonVisibleKeys) {
    final IBackupManager backupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
    boolean isServiceActive = false;
    try {
        isServiceActive = backupManager.isBackupServiceActive(UserHandle.myUserId());
    } catch (RemoteException e) {
        Log.w(TAG, "Failed querying backup manager service activity status. " + "Assuming it is inactive.");
    }
    boolean vendorSpecific = context.getPackageManager().resolveContentProvider(GSETTINGS_PROVIDER, 0) == null;
    if (vendorSpecific || isServiceActive) {
        nonVisibleKeys.add(BACKUP_INACTIVE);
    }
    if (vendorSpecific || !isServiceActive) {
        nonVisibleKeys.add(BACKUP_DATA);
        nonVisibleKeys.add(AUTO_RESTORE);
        nonVisibleKeys.add(CONFIGURE_ACCOUNT);
    }
    if (RestrictedLockUtils.hasBaseUserRestriction(context, UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
        nonVisibleKeys.add(FACTORY_RESET);
    }
}
Also used : IBackupManager(android.app.backup.IBackupManager) RemoteException(android.os.RemoteException)

Aggregations

IBackupManager (android.app.backup.IBackupManager)23 RemoteException (android.os.RemoteException)22 ActivityNotFoundException (android.content.ActivityNotFoundException)4 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)4 Point (android.graphics.Point)4 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)3 TransactionTooLargeException (android.os.TransactionTooLargeException)2 Intent (android.content.Intent)1 InstallerException (com.android.internal.os.InstallerConnection.InstallerException)1 InstallerException (com.android.server.pm.Installer.InstallerException)1 URISyntaxException (java.net.URISyntaxException)1 TreeSet (java.util.TreeSet)1