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 check out the related API usage on the sidebar.
Example 1
public PackageInstallerService(Context context, PackageManagerService pm) {
    mContext = context;
    mPm = pm;
    mPermissionManager = LocalServices.getService(PermissionManagerInternal.class);

    mInstallThread = new HandlerThread(TAG);

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

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

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

    // Populate mLastUid and mLastStatus.
    synchronized (mLock) {
Example 3
public OverlayManagerService(@NonNull final Context context,
        @NonNull final Installer installer) {
    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();
        getContext().registerReceiverAsUser(new PackageReceiver(), UserHandle.ALL,
                packageFilter, null, null);

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



        publishBinderService(Context.OVERLAY_SERVICE, mService);
        publishLocalService(OverlayManagerService.class, this);
    }, "Init OverlayManagerService");
Example 4
Source Project: android_9.0.0_r45   File:    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(;
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);
    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) {

    LocalServices.addService(StorageManagerInternal.class, mStorageManagerInternal);

    final IntentFilter userFilter = new IntentFilter();
    mContext.registerReceiver(mUserReceiver, userFilter, null, mHandler);

    synchronized (mLock) {

    // Add ourself to the Watchdog monitors if enabled.
Example 6
Source Project: android_9.0.0_r45   File:    License: Apache License 2.0 4 votes vote down vote up
File injectDefaultValuesFilename() {
    final File dir = new File(Environment.getDataSystemDirectory(), "battery-saver");
    return new File(dir, "default-values.xml");
Example 7
Source Project: android_9.0.0_r45   File:    License: Apache License 2.0 4 votes vote down vote up
RotatingFileLogger() {
    mLogPath = new File(Environment.getDataSystemDirectory(), "syncmanager-log");
Example 8
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);