android.os.Environment#getDataSystemDirectory ( )源码实例Demo

下面列出了android.os.Environment#getDataSystemDirectory ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

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();
}
 
public SystemUpdateManagerService(Context context) {
    mContext = context;
    mFile = new AtomicFile(new File(Environment.getDataSystemDirectory(), INFO_FILE));

    // Populate mLastUid and mLastStatus.
    synchronized (mLock) {
        loadSystemUpdateInfoLocked();
    }
}
 
源代码3 项目: android_9.0.0_r45   文件: OverlayManagerService.java
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");
}
 
源代码4 项目: android_9.0.0_r45   文件: RecentTasks.java
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);
}
 
源代码5 项目: android_9.0.0_r45   文件: StorageManagerService.java
/**
 * 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);
    }
}
 
源代码6 项目: android_9.0.0_r45   文件: FileUpdater.java
File injectDefaultValuesFilename() {
    final File dir = new File(Environment.getDataSystemDirectory(), "battery-saver");
    dir.mkdirs();
    return new File(dir, "default-values.xml");
}
 
源代码7 项目: android_9.0.0_r45   文件: SyncLogger.java
RotatingFileLogger() {
    mLogPath = new File(Environment.getDataSystemDirectory(), "syncmanager-log");
}
 
源代码8 项目: android_9.0.0_r45   文件: ShortcutService.java
@VisibleForTesting
File injectSystemDataPath() {
    return Environment.getDataSystemDirectory();
}
 
源代码9 项目: android_9.0.0_r45   文件: WatchlistSettings.java
static File getSystemWatchlistFile() {
    return new File(Environment.getDataSystemDirectory(), FILE_NAME);
}
 
static File getSystemWatchlistDbFile() {
    return new File(Environment.getDataSystemDirectory(), NAME);
}