Loading core/java/android/app/PropertyInvalidatedCache.java +30 −23 Original line number Diff line number Diff line Loading @@ -974,8 +974,8 @@ public class PropertyInvalidatedCache<Query, Result> { // // If the "update" boolean is true, then the property is registered with the nonce store // before the associated handle is fetched. private int initialize(boolean update) { synchronized (mLock) { @GuardedBy("mLock") private int initializeLocked(boolean update) { int handle = mHandle; if (handle == NonceStore.INVALID_NONCE_INDEX) { if (mStore == null) { Loading @@ -996,7 +996,6 @@ public class PropertyInvalidatedCache<Query, Result> { } return handle; } } // Fetch the nonce from shared memory. If the shared memory is not available, return // UNSET. If the shared memory is available but the nonce name is not known (it may not Loading @@ -1005,11 +1004,13 @@ public class PropertyInvalidatedCache<Query, Result> { long getNonceInternal() { int handle = mHandle; if (handle == NonceStore.INVALID_NONCE_INDEX) { handle = initialize(false); synchronized (mLock) { handle = initializeLocked(false); if (handle == NonceStore.INVALID_NONCE_INDEX) { return NONCE_UNSET; } } } return mStore.getNonce(handle); } Loading @@ -1019,10 +1020,16 @@ public class PropertyInvalidatedCache<Query, Result> { void setNonceInternal(long value) { int handle = mHandle; if (handle == NonceStore.INVALID_NONCE_INDEX) { handle = initialize(true); synchronized (mLock) { handle = initializeLocked(true); if (handle == NonceStore.INVALID_NONCE_INDEX) { throw new IllegalStateException("unable to assign nonce handle: " + mName); } // Note that we set the value within the lock, ensuring it takes effect // immediately upon initialization, before any pending getNonce reads. mStore.setNonce(handle, value); return; } } mStore.setNonce(handle, value); } Loading Loading
core/java/android/app/PropertyInvalidatedCache.java +30 −23 Original line number Diff line number Diff line Loading @@ -974,8 +974,8 @@ public class PropertyInvalidatedCache<Query, Result> { // // If the "update" boolean is true, then the property is registered with the nonce store // before the associated handle is fetched. private int initialize(boolean update) { synchronized (mLock) { @GuardedBy("mLock") private int initializeLocked(boolean update) { int handle = mHandle; if (handle == NonceStore.INVALID_NONCE_INDEX) { if (mStore == null) { Loading @@ -996,7 +996,6 @@ public class PropertyInvalidatedCache<Query, Result> { } return handle; } } // Fetch the nonce from shared memory. If the shared memory is not available, return // UNSET. If the shared memory is available but the nonce name is not known (it may not Loading @@ -1005,11 +1004,13 @@ public class PropertyInvalidatedCache<Query, Result> { long getNonceInternal() { int handle = mHandle; if (handle == NonceStore.INVALID_NONCE_INDEX) { handle = initialize(false); synchronized (mLock) { handle = initializeLocked(false); if (handle == NonceStore.INVALID_NONCE_INDEX) { return NONCE_UNSET; } } } return mStore.getNonce(handle); } Loading @@ -1019,10 +1020,16 @@ public class PropertyInvalidatedCache<Query, Result> { void setNonceInternal(long value) { int handle = mHandle; if (handle == NonceStore.INVALID_NONCE_INDEX) { handle = initialize(true); synchronized (mLock) { handle = initializeLocked(true); if (handle == NonceStore.INVALID_NONCE_INDEX) { throw new IllegalStateException("unable to assign nonce handle: " + mName); } // Note that we set the value within the lock, ensuring it takes effect // immediately upon initialization, before any pending getNonce reads. mStore.setNonce(handle, value); return; } } mStore.setNonce(handle, value); } Loading