diff options
author | sail <sail@google.com> | 2017-06-29 08:46:43 -0700 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2017-06-30 14:41:54 -0700 |
commit | 3331545bd3fb769ae3f9246c0bd92fe35c6308ab (patch) | |
tree | 2b5082a7e55335c4ea0e91d82f90d34fa54acd05 /java/com/android/dialer/app/calllog | |
parent | 8fd3656537f791c05d24d68281e8f2282d4d1711 (diff) |
Automated g4 rollback of changelist 160202511.
*** Reason for rollback ***
Causes crash, see b/63127884
*** Original change description ***
All Fragments are now support library Fragments.
Switch a bunch of imports to support library Fragments (and Loaders) instead of framework Fragments (and Loaders). This was needed to use FragmentManager.isStateSaved() instead of manually tracking that state. This should reduce errors around committing after state is saved.
Also adds METADATA presubmit to prevent new usages of framework Fragments or Loaders.
***
Bug: 38241305,63127884
Test: N/A
PiperOrigin-RevId: 160530287
Change-Id: Ie2c4d3561ebea2d0f05097ce89bdd9bc8767c8cf
Diffstat (limited to 'java/com/android/dialer/app/calllog')
6 files changed, 25 insertions, 22 deletions
diff --git a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java index 7c324ffb2..28082df2b 100644 --- a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java +++ b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java @@ -16,11 +16,11 @@ package com.android.dialer.app.calllog; +import android.app.FragmentManager; import android.content.ContentValues; import android.content.Context; import android.net.Uri; import android.support.annotation.NonNull; -import android.support.v4.app.FragmentManager; import android.support.v7.widget.RecyclerView; import com.android.dialer.blocking.BlockReportSpamDialogs; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; diff --git a/java/com/android/dialer/app/calllog/CallLogActivity.java b/java/com/android/dialer/app/calllog/CallLogActivity.java index 449e45742..35e05bc39 100644 --- a/java/com/android/dialer/app/calllog/CallLogActivity.java +++ b/java/com/android/dialer/app/calllog/CallLogActivity.java @@ -15,14 +15,14 @@ */ package com.android.dialer.app.calllog; +import android.app.Fragment; +import android.app.FragmentManager; import android.content.Intent; import android.os.Bundle; import android.provider.CallLog; import android.provider.CallLog.Calls; import android.support.design.widget.Snackbar; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; +import android.support.v13.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; import android.view.Menu; @@ -84,14 +84,14 @@ public class CallLogActivity extends TransactionSafeActivity mTabTitles[0] = getString(R.string.call_log_all_title); mTabTitles[1] = getString(R.string.call_log_missed_title); - mViewPager = findViewById(R.id.call_log_pager); + mViewPager = (ViewPager) findViewById(R.id.call_log_pager); - mViewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager()); + mViewPagerAdapter = new ViewPagerAdapter(getFragmentManager()); mViewPager.setAdapter(mViewPagerAdapter); mViewPager.setOffscreenPageLimit(1); mViewPager.setOnPageChangeListener(this); - mViewPagerTabs = findViewById(R.id.viewpager_header); + mViewPagerTabs = (ViewPagerTabs) findViewById(R.id.viewpager_header); mViewPagerTabs.setViewPager(mViewPager); mViewPager.setCurrentItem(startingTab); @@ -148,7 +148,7 @@ public class CallLogActivity extends TransactionSafeActivity startActivity(intent); return true; } else if (item.getItemId() == R.id.delete_all) { - ClearCallLogDialog.show(getSupportFragmentManager(), this); + ClearCallLogDialog.show(getFragmentManager(), this); return true; } return super.onOptionsItemSelected(item); diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index d7a27dfca..c4156d5c6 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -35,7 +35,6 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.support.annotation.WorkerThread; -import android.support.v4.app.FragmentActivity; import android.support.v7.app.AlertDialog; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.ViewHolder; @@ -515,7 +514,7 @@ public class CallLogAdapter extends GroupingListAdapter mBlockReportSpamListener = new BlockReportSpamListener( mActivity, - ((FragmentActivity) mActivity).getSupportFragmentManager(), + ((Activity) mActivity).getFragmentManager(), this, mFilteredNumberAsyncQueryHandler); setHasStableIds(true); diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index 49ed31e3f..aa765d90e 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -19,6 +19,7 @@ package com.android.dialer.app.calllog; import static android.Manifest.permission.READ_CALL_LOG; import android.app.Activity; +import android.app.Fragment; import android.app.KeyguardManager; import android.content.ContentResolver; import android.content.Context; @@ -33,7 +34,9 @@ import android.provider.CallLog.Calls; import android.provider.ContactsContract; import android.support.annotation.CallSuper; import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; +import android.support.v13.app.FragmentCompat; +import android.support.v13.app.FragmentCompat.OnRequestPermissionsResultCallback; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -77,6 +80,7 @@ public class CallLogFragment extends Fragment CallFetcher, MultiSelectRemoveView, OnEmptyViewActionButtonClickedListener, + OnRequestPermissionsResultCallback, CallLogModalAlertManager.Listener, OnClickListener { private static final String KEY_FILTER_TYPE = "filter_type"; @@ -302,21 +306,21 @@ public class CallLogFragment extends Fragment } protected void setupView(View view) { - mRecyclerView = view.findViewById(R.id.recycler_view); + mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(getActivity()); mRecyclerView.setLayoutManager(mLayoutManager); PerformanceReport.logOnScrollStateChange(mRecyclerView); - mEmptyListView = view.findViewById(R.id.empty_list_view); + mEmptyListView = (EmptyContentView) view.findViewById(R.id.empty_list_view); mEmptyListView.setImage(R.drawable.empty_call_log); mEmptyListView.setActionClickedListener(this); - mModalAlertView = view.findViewById(R.id.modal_message_container); + mModalAlertView = (ViewGroup) view.findViewById(R.id.modal_message_container); mModalAlertManager = new CallLogModalAlertManager(LayoutInflater.from(getContext()), mModalAlertView, this); mMultiSelectUnSelectAllViewContent = view.findViewById(R.id.multi_select_select_all_view_content); - mSelectUnselectAllViewText = view.findViewById(R.id.select_all_view_text); - mSelectUnselectAllIcon = view.findViewById(R.id.select_all_view_icon); + mSelectUnselectAllViewText = (TextView) view.findViewById(R.id.select_all_view_text); + mSelectUnselectAllIcon = (ImageView) view.findViewById(R.id.select_all_view_icon); mMultiSelectUnSelectAllViewContent.setOnClickListener(null); mSelectUnselectAllIcon.setOnClickListener(this); mSelectUnselectAllViewText.setOnClickListener(this); @@ -331,7 +335,8 @@ public class CallLogFragment extends Fragment mContactInfoCache = new ContactInfoCache( - ExpirableCacheHeadlessFragment.attach(this).getRetainedCache(), + ExpirableCacheHeadlessFragment.attach((AppCompatActivity) getActivity()) + .getRetainedCache(), new ContactInfoHelper(getActivity(), currentCountryIso), mOnContactInfoChangedListener); mAdapter = @@ -570,7 +575,7 @@ public class CallLogFragment extends Fragment LogUtil.i( "CallLogFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - requestPermissions(deniedPermissions, PHONE_PERMISSIONS_REQUEST_CODE); + FragmentCompat.requestPermissions(this, deniedPermissions, PHONE_PERMISSIONS_REQUEST_CODE); } else if (!mIsCallLogActivity) { // Show dialpad if we are not in the call log activity. ((HostInterface) activity).showDialpad(); diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 2e61848d2..27aa82577 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -30,7 +30,6 @@ import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; -import android.support.v4.app.FragmentActivity; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.telecom.PhoneAccount; @@ -998,7 +997,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder private void maybeShowBlockNumberMigrationDialog(BlockedNumbersMigrator.Listener listener) { if (!FilteredNumberCompat.maybeShowBlockNumberMigrationDialog( - mContext, ((FragmentActivity) mContext).getSupportFragmentManager(), listener)) { + mContext, ((Activity) mContext).getFragmentManager(), listener)) { listener.onComplete(); } } diff --git a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java index c100fa0e0..5c3d4d9fa 100644 --- a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java +++ b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java @@ -19,6 +19,8 @@ package com.android.dialer.app.calllog; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; +import android.app.DialogFragment; +import android.app.FragmentManager; import android.app.ProgressDialog; import android.content.ContentResolver; import android.content.Context; @@ -28,8 +30,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.provider.CallLog.Calls; import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentManager; import com.android.dialer.app.R; import com.android.dialer.common.Assert; import com.android.dialer.phonenumbercache.CachedNumberLookupService; |