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

Commit 76ae57cb authored by mrulhania's avatar mrulhania
Browse files

Rename xml historical registry as legacy one

Bug: 377584611
Test: presubmit
Flag: EXEMPT bug fix
Change-Id: I88bbe8b739ef6b833be5240ce89866a1425cbaff
parent 04b421bc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1059,7 +1059,7 @@ public class AppOpsService extends IAppOpsService.Stub {
        if (Flags.enableAllSqliteAppopsAccesses()) {
            mHistoricalRegistry = new HistoricalRegistrySql(context);
        } else {
            mHistoricalRegistry = new HistoricalRegistry(this, context);
            mHistoricalRegistry = new LegacyHistoricalRegistry(this, context);
        }
    }

@@ -7011,7 +7011,8 @@ public class AppOpsService extends IAppOpsService.Stub {
            mHistoricalRegistry = new HistoricalRegistrySql(
                    (HistoricalRegistrySql) mHistoricalRegistry);
        } else {
            mHistoricalRegistry = new HistoricalRegistry((HistoricalRegistry) mHistoricalRegistry);
            mHistoricalRegistry = new LegacyHistoricalRegistry(
                    (LegacyHistoricalRegistry) mHistoricalRegistry);
        }

        mHistoricalRegistry.systemReady(mContext.getContentResolver());
+2 −3
Original line number Diff line number Diff line
@@ -82,9 +82,8 @@ import java.util.Set;
 * INITIALIZATION: We can initialize persistence only after the system is ready
 * as we need to check the optional configuration override from the settings
 * database which is not initialized at the time the app ops service is created. This class
 * relies on {@link HistoricalRegistry} for controlling that no calls are allowed until then. All
 * outside calls are going through {@link HistoricalRegistry}.
 *
 * relies on {@link LegacyHistoricalRegistry} for controlling that no calls are allowed until then.
 * All outside calls are going through {@link LegacyHistoricalRegistry}.
 */
abstract class DiscreteOpsRegistry {
    private static final String TAG = DiscreteOpsRegistry.class.getSimpleName();
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ import java.util.Set;
 * THREADING AND LOCKING:
 * For in-memory transactions this class relies on {@link DiscreteOpsXmlRegistry#mInMemoryLock}.
 * It is assumed that the same lock is used for in-memory transactions in {@link AppOpsService},
 * {@link HistoricalRegistry}, and {@link DiscreteOpsXmlRegistry }.
 * {@link LegacyHistoricalRegistry}, and {@link DiscreteOpsXmlRegistry }.
 * {@link DiscreteOpsRegistry#recordDiscreteAccess} must only be called while holding this lock.
 * {@link DiscreteOpsXmlRegistry#mOnDiskLock} is used when disk transactions are performed.
 * It is very important to release {@link DiscreteOpsXmlRegistry#mInMemoryLock} as soon as
+10 −10
Original line number Diff line number Diff line
@@ -128,11 +128,11 @@ import java.util.concurrent.TimeUnit;
 */
// TODO (bug:122218838): Make sure we handle start of epoch time
// TODO (bug:122218838): Validate changed time is handled correctly
final class HistoricalRegistry implements HistoricalRegistryInterface {
final class LegacyHistoricalRegistry implements HistoricalRegistryInterface {
    private static final boolean DEBUG = false;
    private static final boolean KEEP_WTF_LOG = Build.IS_DEBUGGABLE;

    private static final String LOG_TAG = HistoricalRegistry.class.getSimpleName();
    private static final String LOG_TAG = LegacyHistoricalRegistry.class.getSimpleName();

    private static final String PARAMETER_DELIMITER = ",";
    private static final String PARAMETER_ASSIGNMENT = "=";
@@ -200,7 +200,7 @@ final class HistoricalRegistry implements HistoricalRegistryInterface {

    private final Context mContext;

    HistoricalRegistry(@NonNull Object lock, Context context) {
    LegacyHistoricalRegistry(@NonNull Object lock, Context context) {
        mInMemoryLock = lock;
        mContext = context;
        if (Flags.enableSqliteAppopsAccesses()) {
@@ -210,7 +210,7 @@ final class HistoricalRegistry implements HistoricalRegistryInterface {
        }
    }

    HistoricalRegistry(@NonNull HistoricalRegistry other) {
    LegacyHistoricalRegistry(@NonNull LegacyHistoricalRegistry other) {
        this(other.mInMemoryLock, other.mContext);
        mMode = other.mMode;
        mBaseSnapshotInterval = other.mBaseSnapshotInterval;
@@ -805,7 +805,7 @@ final class HistoricalRegistry implements HistoricalRegistryInterface {

    private void schedulePersistHistoricalOpsMLocked(@NonNull HistoricalOps ops) {
        final Message message = PooledLambda.obtainMessage(
                HistoricalRegistry::persistPendingHistory, HistoricalRegistry.this);
                LegacyHistoricalRegistry::persistPendingHistory, LegacyHistoricalRegistry.this);
        message.what = MSG_WRITE_PENDING_HISTORY;
        IoThread.getHandler().sendMessage(message);
        mPendingWrites.offerFirst(ops);