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

Commit b3ae56b8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Removing unnecessary system RPC for checking flags on every touch...

Merge "Removing unnecessary system RPC for checking flags on every touch event" into ub-launcher3-master
parents 5f094590 c1edfa73
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@ import static androidx.core.util.Preconditions.checkNotNull;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;

import androidx.annotation.GuardedBy;
@@ -256,6 +259,16 @@ abstract class BaseFlags {
        @Override
        public void initialize(Context context) {
            contentResolver = context.getContentResolver();
            contentResolver.registerContentObserver(Settings.Global.getUriFor(getKey()), true,
                    new ContentObserver(new Handler(Looper.getMainLooper())) {
                        @Override
                        public void onChange(boolean selfChange) {
                            superInitialize(context);
                    }});
            superInitialize(context);
        }

        private void superInitialize(Context context) {
            super.initialize(context);
        }

@@ -274,10 +287,5 @@ abstract class BaseFlags {
            }
            return Settings.Global.getInt(contentResolver, getKey(), defaultValue ? 1 : 0) == 1;
        }

        @Override
        public boolean get() {
            return getFromStorage(null, getDefaultValue());
        }
    }
}