Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0cc800c6 authored by Keun-young Park's avatar Keun-young Park Committed by Android (Google) Code Review
Browse files

Merge "add cancellation to background dexopt"

parents 073f23ec f992cb31
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -598,12 +598,6 @@ interface IPackageManager {

    void forceDexOpt(String packageName);

    /**
     * Execute the background dexopt job immediately on packages in packageNames.
     * If null, then execute on all packages.
     */
    boolean runBackgroundDexoptJob(in List<String> packageNames);

    /**
     * Reconcile the information we have about the secondary dex files belonging to
     * {@code packagName} and the actual dex files. For all dex files that were
+1 −1
Original line number Diff line number Diff line
@@ -6311,7 +6311,7 @@
                 android:permission="android.permission.BIND_JOB_SERVICE" >
        </service>

        <service android:name="com.android.server.pm.BackgroundDexOptService"
        <service android:name="com.android.server.pm.BackgroundDexOptJobService"
                 android:exported="true"
                 android:permission="android.permission.BIND_JOB_SERVICE">
        </service>
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.pm;

import android.app.job.JobParameters;
import android.app.job.JobService;

/**
 * JobService to run background dex optimization. This is a thin wrapper and most logic exits in
 * {@link BackgroundDexOptService}.
 */
public final class BackgroundDexOptJobService extends JobService {

    @Override
    public boolean onStartJob(JobParameters params) {
        return BackgroundDexOptService.getService().onStartJob(this, params);
    }

    @Override
    public boolean onStopJob(JobParameters params) {
        return BackgroundDexOptService.getService().onStopJob(this, params);
    }
}
+617 −357

File changed.

Preview size limit exceeded, changes collapsed.

+6 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ public class ComputerEngine implements Computer {
    private final PackageDexOptimizer mPackageDexOptimizer;
    private final DexManager mDexManager;
    private final CompilerStats mCompilerStats;
    private final BackgroundDexOptService mBackgroundDexOptService;

    // PackageManagerService attributes that are primitives are referenced through the
    // pms object directly.  Primitives are the only attributes so referenced.
@@ -228,6 +229,7 @@ public class ComputerEngine implements Computer {
        mPackageDexOptimizer = args.service.mPackageDexOptimizer;
        mDexManager = args.service.getDexManager();
        mCompilerStats = args.service.mCompilerStats;
        mBackgroundDexOptService = args.service.mBackgroundDexOptService;

        // Used to reference PMS attributes that are primitives and which are not
        // updated under control of the PMS lock.
@@ -2929,6 +2931,10 @@ public class ComputerEngine implements Computer {
                            mDexManager.getPackageUseInfoOrDefault(pkgName));
                    ipw.decreaseIndent();
                }
                ipw.println("BgDexopt state:");
                ipw.increaseIndent();
                mBackgroundDexOptService.dump(ipw);
                ipw.decreaseIndent();
                break;
            }

Loading