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

Commit d9662a84 authored by Daniel Lehmann's avatar Daniel Lehmann
Browse files

Fix crash in QC during orientation change

 - Also made the ContactLoader a little more robust. The cached result
   is now a new instance so that it is recognized by the LoaderManager
   as new data

Bug:6356584

Change-Id: I4e2eca92501308a8724b00771038555fa59b3260
parent 9b22fe19
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1297,6 +1297,9 @@ public class ContactLoader extends AsyncTaskLoader<ContactLoader.Result> {
     * new result will be delivered
     */
    public void upgradeToFullContact() {
        // Everything requested already? Nothing to do, so let's bail out
        if (mLoadGroupMetaData && mLoadInvitableAccountTypes && mLoadStreamItems) return;

        mLoadGroupMetaData = true;
        mLoadInvitableAccountTypes = true;
        mLoadStreamItems = true;
@@ -1346,6 +1349,6 @@ public class ContactLoader extends AsyncTaskLoader<ContactLoader.Result> {
     * contact. If the next load is for a different contact, the cached result will be dropped
     */
    public void cacheResult() {
        sCachedResult = mContact;
        sCachedResult = new Result(mContact);
    }
}
+3 −4
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.LoaderManager.LoaderCallbacks;
import android.app.TaskStackBuilder;
import android.content.ActivityNotFoundException;
import android.content.ContentUris;
import android.content.ContentValues;
@@ -225,7 +224,8 @@ public class QuickContactActivity extends Activity {
        mPhotoContainer = findViewById(R.id.photo_container);
        setHeaderNameText(R.id.name, R.string.missing_name);

        getLoaderManager().initLoader(LOADER_ID, null, mLoaderCallbacks);
        mContactLoader = (ContactLoader) getLoaderManager().initLoader(
                LOADER_ID, null, mLoaderCallbacks);
    }

    private boolean handleOutsideTouch() {
@@ -523,8 +523,7 @@ public class QuickContactActivity extends Activity {
            if (mLookupUri == null) {
                Log.wtf(TAG, "Lookup uri wasn't initialized. Loader was started too early");
            }
            mContactLoader = new ContactLoader(getApplicationContext(), mLookupUri);
            return mContactLoader;
            return new ContactLoader(getApplicationContext(), mLookupUri);
        }
    };