Java Code Examples for android.os.Environment#getDataSystemDirectory()

The following examples show how to use android.os.Environment#getDataSystemDirectory() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public PackageInstallerService(Context context, PackageManagerService pm) {
    mContext = context;
    mPm = pm;
    mPermissionManager = LocalServices.getService(PermissionManagerInternal.class);

    mInstallThread = new HandlerThread(TAG);
    mInstallThread.start();

    mInstallHandler = new Handler(mInstallThread.getLooper());

    mCallbacks = new Callbacks(mInstallThread.getLooper());

    mSessionsFile = new AtomicFile(
            new File(Environment.getDataSystemDirectory(), "install_sessions.xml"),
            "package-session");
    mSessionsDir = new File(Environment.getDataSystemDirectory(), "install_sessions");
    mSessionsDir.mkdirs();
}
 
Example 2
public SystemUpdateManagerService(Context context) {
    mContext = context;
    mFile = new AtomicFile(new File(Environment.getDataSystemDirectory(), INFO_FILE));

    // Populate mLastUid and mLastStatus.
    synchronized (mLock) {
        loadSystemUpdateInfoLocked();
    }
}
 
Example 3
public OverlayManagerService(@NonNull final Context context,
        @NonNull final Installer installer) {
    super(context);
    mSettingsFile =
        new AtomicFile(new File(Environment.getDataSystemDirectory(), "overlays.xml"), "overlays");
    mPackageManager = new PackageManagerHelper();
    mUserManager = UserManagerService.getInstance();
    IdmapManager im = new IdmapManager(installer);
    mSettings = new OverlayManagerSettings();
    mImpl = new OverlayManagerServiceImpl(mPackageManager, im, mSettings,
            getDefaultOverlayPackages(), new OverlayChangeListener());
    mInitCompleteSignal = SystemServerInitThreadPool.get().submit(() -> {
        final IntentFilter packageFilter = new IntentFilter();
        packageFilter.addAction(ACTION_PACKAGE_ADDED);
        packageFilter.addAction(ACTION_PACKAGE_CHANGED);
        packageFilter.addAction(ACTION_PACKAGE_REMOVED);
        packageFilter.addDataScheme("package");
        getContext().registerReceiverAsUser(new PackageReceiver(), UserHandle.ALL,
                packageFilter, null, null);

        final IntentFilter userFilter = new IntentFilter();
        userFilter.addAction(ACTION_USER_ADDED);
        userFilter.addAction(ACTION_USER_REMOVED);
        getContext().registerReceiverAsUser(new UserReceiver(), UserHandle.ALL,
                userFilter, null, null);

        restoreSettings();

        initIfNeeded();
        onSwitchUser(UserHandle.USER_SYSTEM);

        publishBinderService(Context.OVERLAY_SERVICE, mService);
        publishLocalService(OverlayManagerService.class, this);
    }, "Init OverlayManagerService");
}
 
Example 4
Source Project: android_9.0.0_r45   File: RecentTasks.java    License: Apache License 2.0 5 votes vote down vote up
RecentTasks(ActivityManagerService service, ActivityStackSupervisor stackSupervisor) {
    final File systemDir = Environment.getDataSystemDirectory();
    final Resources res = service.mContext.getResources();
    mService = service;
    mUserController = service.mUserController;
    mTaskPersister = new TaskPersister(systemDir, stackSupervisor, service, this);
    mGlobalMaxNumTasks = ActivityManager.getMaxRecentTasksStatic();
    mHasVisibleRecentTasks = res.getBoolean(com.android.internal.R.bool.config_hasRecents);
    loadParametersFromResources(res);
}
 
Example 5
/**
 * Constructs a new StorageManagerService instance
 *
 * @param context  Binder context for this service
 */
public StorageManagerService(Context context) {
    sSelf = this;

    mContext = context;
    mCallbacks = new Callbacks(FgThread.get().getLooper());
    mLockPatternUtils = new LockPatternUtils(mContext);

    // XXX: This will go away soon in favor of IMountServiceObserver
    mPms = (PackageManagerService) ServiceManager.getService("package");

    HandlerThread hthread = new HandlerThread(TAG);
    hthread.start();
    mHandler = new StorageManagerServiceHandler(hthread.getLooper());

    // Add OBB Action Handler to StorageManagerService thread.
    mObbActionHandler = new ObbActionHandler(IoThread.get().getLooper());

    // Initialize the last-fstrim tracking if necessary
    File dataDir = Environment.getDataDirectory();
    File systemDir = new File(dataDir, "system");
    mLastMaintenanceFile = new File(systemDir, LAST_FSTRIM_FILE);
    if (!mLastMaintenanceFile.exists()) {
        // Not setting mLastMaintenance here means that we will force an
        // fstrim during reboot following the OTA that installs this code.
        try {
            (new FileOutputStream(mLastMaintenanceFile)).close();
        } catch (IOException e) {
            Slog.e(TAG, "Unable to create fstrim record " + mLastMaintenanceFile.getPath());
        }
    } else {
        mLastMaintenance = mLastMaintenanceFile.lastModified();
    }

    mSettingsFile = new AtomicFile(
            new File(Environment.getDataSystemDirectory(), "storage.xml"), "storage-settings");

    synchronized (mLock) {
        readSettingsLocked();
    }

    LocalServices.addService(StorageManagerInternal.class, mStorageManagerInternal);

    final IntentFilter userFilter = new IntentFilter();
    userFilter.addAction(Intent.ACTION_USER_ADDED);
    userFilter.addAction(Intent.ACTION_USER_REMOVED);
    mContext.registerReceiver(mUserReceiver, userFilter, null, mHandler);

    synchronized (mLock) {
        addInternalVolumeLocked();
    }

    // Add ourself to the Watchdog monitors if enabled.
    if (WATCHDOG_ENABLE) {
        Watchdog.getInstance().addMonitor(this);
    }
}
 
Example 6
Source Project: android_9.0.0_r45   File: FileUpdater.java    License: Apache License 2.0 4 votes vote down vote up
File injectDefaultValuesFilename() {
    final File dir = new File(Environment.getDataSystemDirectory(), "battery-saver");
    dir.mkdirs();
    return new File(dir, "default-values.xml");
}
 
Example 7
Source Project: android_9.0.0_r45   File: SyncLogger.java    License: Apache License 2.0 4 votes vote down vote up
RotatingFileLogger() {
    mLogPath = new File(Environment.getDataSystemDirectory(), "syncmanager-log");
}
 
Example 8
@VisibleForTesting
File injectSystemDataPath() {
    return Environment.getDataSystemDirectory();
}
 
Example 9
static File getSystemWatchlistFile() {
    return new File(Environment.getDataSystemDirectory(), FILE_NAME);
}
 
Example 10
static File getSystemWatchlistDbFile() {
    return new File(Environment.getDataSystemDirectory(), NAME);
}