Fix a couple static leaks.
Change-Id: If2564dc822fbcb3bb3baf270ad2b3c29c78bf421
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user