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

Commit d3f0f2c7 authored by Song Chun Fan's avatar Song Chun Fan Committed by Automerger Merge Worker
Browse files

Merge "[SettingsProvider] force close MemoryIntArray before garbage...

Merge "[SettingsProvider] force close MemoryIntArray before garbage collection" into udc-dev am: 48645e27

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22683998



Change-Id: I646741c251a5a87fb4457325f2cc6bc7b4b46769
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 664f795d 48645e27
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -3037,14 +3037,23 @@ public final class Settings {
        public void destroy() {
            try {
                // If this process is the system server process, mArray is the same object as
                // the memory int array kept inside SetingsProvider, so skipping the close()
                if (!Settings.isInSystemServer()) {
                // the memory int array kept inside SettingsProvider, so skipping the close()
                if (!Settings.isInSystemServer() && !mArray.isClosed()) {
                    mArray.close();
                }
            } catch (IOException e) {
                Log.e(TAG, "Error closing backing array", e);
            }
        }
        @Override
        protected void finalize() throws Throwable {
            try {
                destroy();
            } finally {
                super.finalize();
            }
        }
    }
    private static final class ContentProviderHolder {