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

Commit 066836fc authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Fix a couple static leaks."

parents 1078609d de4c26fa
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -114,6 +114,23 @@ public class LockPatternUtils {
    private static final AtomicBoolean sHaveNonZeroPasswordFile = new AtomicBoolean(false);
    private static FileObserver sPasswordObserver;

    private static class PasswordFileObserver extends FileObserver {
        public PasswordFileObserver(String path, int mask) {
            super(path, mask);
        }

        @Override
        public void onEvent(int event, String path) {
            if (LOCK_PATTERN_FILE.equals(path)) {
                Log.d(TAG, "lock pattern file changed");
                sHaveNonZeroPatternFile.set(new File(sLockPatternFilename).length() > 0);
            } else if (LOCK_PASSWORD_FILE.equals(path)) {
                Log.d(TAG, "lock password file changed");
                sHaveNonZeroPasswordFile.set(new File(sLockPasswordFilename).length() > 0);
            }
        }
    }

    public DevicePolicyManager getDevicePolicyManager() {
        if (mDevicePolicyManager == null) {
            mDevicePolicyManager =
@@ -143,18 +160,7 @@ public class LockPatternUtils {
            sHaveNonZeroPasswordFile.set(new File(sLockPasswordFilename).length() > 0);
            int fileObserverMask = FileObserver.CLOSE_WRITE | FileObserver.DELETE |
                    FileObserver.MOVED_TO | FileObserver.CREATE;
            sPasswordObserver = new FileObserver(dataSystemDirectory, fileObserverMask) {
                    @Override
                    public void onEvent(int event, String path) {
                        if (LOCK_PATTERN_FILE.equals(path)) {
                            Log.d(TAG, "lock pattern file changed");
                            sHaveNonZeroPatternFile.set(new File(sLockPatternFilename).length() > 0);
                        } else if (LOCK_PASSWORD_FILE.equals(path)) {
                            Log.d(TAG, "lock password file changed");
                            sHaveNonZeroPasswordFile.set(new File(sLockPasswordFilename).length() > 0);
                        }
                    }
                };
            sPasswordObserver = new PasswordFileObserver(dataSystemDirectory, fileObserverMask);
            sPasswordObserver.startWatching();
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public class TelephonyManager {
    /** @hide */
    public TelephonyManager(Context context) {
        if (sContext == null) {
            sContext = context;
            sContext = context.getApplicationContext();

            sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
                    "telephony.registry"));