Transferred handling of provider status from activity to fragment.
Not very happy with the design. It would probably be a good
idea to separate provider status handling into a class of
its own.
Change-Id: I18a6ec89620cf2561b3d8549d8bd328cb8cdb0bf
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index c48a1cc..18c3e26 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -374,8 +374,6 @@
private static final int QUERY_MODE_MAILTO = 1;
private static final int QUERY_MODE_TEL = 2;
- public int mProviderStatus = ProviderStatus.STATUS_NORMAL;
-
public boolean mSearchMode;
public boolean mSearchResultsMode;
public boolean mShowNumberOfContacts;
@@ -415,14 +413,6 @@
public int mDisplayOrder;
private int mSortOrder;
- private ContentObserver mProviderStatusObserver = new ContentObserver(new Handler()) {
-
- @Override
- public void onChange(boolean selfChange) {
- checkProviderState(true);
- }
- };
-
private ContactsIntentResolver mIntentResolver;
protected ContactEntryListFragment mListFragment;
@@ -778,23 +768,6 @@
mAdapter = (ContactEntryListAdapter)adapter;
}
- /**
- * Register an observer for provider status changes - we will need to
- * reflect them in the UI.
- */
- private void registerProviderStatusObserver() {
- getContentResolver().registerContentObserver(ProviderStatus.CONTENT_URI,
- false, mProviderStatusObserver);
- }
-
- /**
- * Register an observer for provider status changes - we will need to
- * reflect them in the UI.
- */
- private void unregisterProviderStatusObserver() {
- getContentResolver().unregisterContentObserver(mProviderStatusObserver);
- }
-
public int getSummaryDisplayNameColumnIndex() {
if (mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
return SUMMARY_DISPLAY_NAME_PRIMARY_COLUMN_INDEX;
@@ -831,13 +804,6 @@
Prefs.DISPLAY_ONLY_PHONES_DEFAULT);
}
-
- @Override
- protected void onPause() {
- super.onPause();
- unregisterProviderStatusObserver();
- }
-
@Override
protected void onResume() {
super.onResume();
@@ -847,154 +813,8 @@
mListFragment.setContactNameDisplayOrder(mContactsPrefs.getDisplayOrder());
mListFragment.setSortOrder(mContactsPrefs.getSortOrder());
}
-
- // TODO move this to onAttach of the corresponding fragment
- mListView = (ListView) findViewById(android.R.id.list);
-
- View emptyView = mListView.getEmptyView();
- if (emptyView instanceof ContactListEmptyView) {
- mEmptyView = (ContactListEmptyView)emptyView;
- }
-
- registerProviderStatusObserver();
-
- Activity parent = getParent();
-
- // Do this before setting the filter. The filter thread relies
- // on some state that is initialized in setDefaultMode
- if (mMode == MODE_DEFAULT) {
- // If we're in default mode we need to possibly reset the mode due to a change
- // in the preferences activity while we weren't running
- setDefaultMode();
- }
-
- if (!mSearchMode && !checkProviderState(mJustCreated)) {
- return;
- }
-
- if (mJustCreated) {
- // We need to start a query here the first time the activity is launched, as long
- // as we aren't doing a filter.
- startQuery();
- }
- mJustCreated = false;
- mSearchInitiated = false;
}
- /**
- * Obtains the contacts provider status and configures the UI accordingly.
- *
- * @param loadData true if the method needs to start a query when the
- * provider is in the normal state
- * @return true if the provider status is normal
- */
- private boolean checkProviderState(boolean loadData) {
- View importFailureView = findViewById(R.id.import_failure);
- if (importFailureView == null) {
- return true;
- }
-
- TextView messageView = (TextView) findViewById(R.id.emptyText);
-
- // This query can be performed on the UI thread because
- // the API explicitly allows such use.
- Cursor cursor = getContentResolver().query(ProviderStatus.CONTENT_URI,
- new String[] { ProviderStatus.STATUS, ProviderStatus.DATA1 }, null, null, null);
- if (cursor != null) {
- try {
- if (cursor.moveToFirst()) {
- int status = cursor.getInt(0);
- if (status != mProviderStatus) {
- mProviderStatus = status;
- switch (status) {
- case ProviderStatus.STATUS_NORMAL:
- mAdapter.notifyDataSetInvalidated();
- if (loadData) {
- startQuery();
- }
- break;
-
- case ProviderStatus.STATUS_CHANGING_LOCALE:
- messageView.setText(R.string.locale_change_in_progress);
- mAdapter.changeCursor(null);
- mAdapter.notifyDataSetInvalidated();
- break;
-
- case ProviderStatus.STATUS_UPGRADING:
- messageView.setText(R.string.upgrade_in_progress);
- mAdapter.changeCursor(null);
- mAdapter.notifyDataSetInvalidated();
- break;
-
- case ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY:
- long size = cursor.getLong(1);
- String message = getResources().getString(
- R.string.upgrade_out_of_memory, new Object[] {size});
- messageView.setText(message);
- configureImportFailureView(importFailureView);
- mAdapter.changeCursor(null);
- mAdapter.notifyDataSetInvalidated();
- break;
- }
- }
- }
- } finally {
- cursor.close();
- }
- }
-
- importFailureView.setVisibility(
- mProviderStatus == ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY
- ? View.VISIBLE
- : View.GONE);
- return mProviderStatus == ProviderStatus.STATUS_NORMAL;
- }
-
- private void configureImportFailureView(View importFailureView) {
-
- OnClickListener listener = new OnClickListener(){
-
- public void onClick(View v) {
- switch(v.getId()) {
- case R.id.import_failure_uninstall_apps: {
- startActivity(new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS));
- break;
- }
- case R.id.import_failure_retry_upgrade: {
- // Send a provider status update, which will trigger a retry
- ContentValues values = new ContentValues();
- values.put(ProviderStatus.STATUS, ProviderStatus.STATUS_UPGRADING);
- getContentResolver().update(ProviderStatus.CONTENT_URI, values, null, null);
- break;
- }
- }
- }};
-
- Button uninstallApps = (Button) findViewById(R.id.import_failure_uninstall_apps);
- uninstallApps.setOnClickListener(listener);
-
- Button retryUpgrade = (Button) findViewById(R.id.import_failure_retry_upgrade);
- retryUpgrade.setOnClickListener(listener);
- }
-
- @Override
- protected void onRestart() {
- super.onRestart();
-
- if (!checkProviderState(false)) {
- return;
- }
-
- // The cursor was killed off in onStop(), so we need to get a new one here
- // We do not perform the query if a filter is set on the list because the
- // filter will cause the query to happen anyway
- if (TextUtils.isEmpty(mListFragment.getQueryString())) {
- startQuery();
- } else {
- // Run the filtered query on the adapter
- mAdapter.onContentChanged();
- }
- }
@Override
protected void onStop() {
@@ -1067,9 +887,10 @@
@Override
public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
boolean globalSearch) {
- if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
- return;
- }
+// TODO
+// if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
+// return;
+// }
if (globalSearch) {
super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
diff --git a/src/com/android/contacts/MultiplePhonePickerActivity.java b/src/com/android/contacts/MultiplePhonePickerActivity.java
index 1d1fbbb..1b7f23e 100644
--- a/src/com/android/contacts/MultiplePhonePickerActivity.java
+++ b/src/com/android/contacts/MultiplePhonePickerActivity.java
@@ -241,9 +241,10 @@
@Override
public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
boolean globalSearch) {
- if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
- return;
- }
+ // TODO
+// if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
+// return;
+// }
if (globalSearch) {
super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
diff --git a/src/com/android/contacts/list/ContactEntryListAdapter.java b/src/com/android/contacts/list/ContactEntryListAdapter.java
index b6a4300..b6d8169 100644
--- a/src/com/android/contacts/list/ContactEntryListAdapter.java
+++ b/src/com/android/contacts/list/ContactEntryListAdapter.java
@@ -208,7 +208,7 @@
return false;
} else if (isSearchMode()) {
return TextUtils.isEmpty(getQueryString());
- } else if (mCursor == null || mLoading) {
+ } else if (mLoading) {
// We don't want the empty state to show when loading.
return false;
} else {
diff --git a/src/com/android/contacts/list/ContactEntryListFragment.java b/src/com/android/contacts/list/ContactEntryListFragment.java
index c279fa4..bff729c 100644
--- a/src/com/android/contacts/list/ContactEntryListFragment.java
+++ b/src/com/android/contacts/list/ContactEntryListFragment.java
@@ -32,13 +32,19 @@
import android.app.patterns.Loader;
import android.app.patterns.LoaderManagingFragment;
import android.content.ContentResolver;
+import android.content.ContentValues;
import android.content.Context;
import android.content.IContentService;
+import android.content.Intent;
+import android.database.ContentObserver;
import android.database.Cursor;
import android.os.Bundle;
+import android.os.Handler;
import android.os.Parcelable;
import android.os.RemoteException;
import android.provider.ContactsContract;
+import android.provider.Settings;
+import android.provider.ContactsContract.ProviderStatus;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.Html;
@@ -50,12 +56,14 @@
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.View.OnTouchListener;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.AdapterView;
+import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AbsListView.OnScrollListener;
@@ -100,6 +108,9 @@
private ContactPhotoLoader mPhotoLoader;
private SearchEditText mSearchEditText;
private ContactListEmptyView mEmptyView;
+ private ProviderStatusLoader mProviderStatusLoader;
+
+ private int mProviderStatus = ProviderStatus.STATUS_NORMAL;
protected abstract View inflateView(LayoutInflater inflater, ViewGroup container);
protected abstract T createListAdapter();
@@ -152,10 +163,17 @@
@Override
protected void onInitializeLoaders() {
mLoader = (CursorLoader)startLoading(0, null);
+ if (mProviderStatusLoader == null) {
+ mProviderStatusLoader = new ProviderStatusLoader(mLoader);
+ }
}
@Override
protected void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+ if (!checkProviderStatus(false)) {
+ return;
+ }
+
if (data == null) {
return;
}
@@ -386,6 +404,9 @@
@Override
public void onResume() {
super.onResume();
+
+ registerProviderStatusObserver();
+
if (isPhotoLoaderEnabled()) {
mPhotoLoader.resume();
}
@@ -465,6 +486,12 @@
return false;
}
+ @Override
+ public void onPause() {
+ super.onPause();
+ unregisterProviderStatusObserver();
+ }
+
/**
* Dismisses the search UI along with the keyboard if the filter text is empty.
*/
@@ -499,6 +526,133 @@
}
}
+ private ContentObserver mProviderStatusObserver = new ContentObserver(new Handler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ checkProviderStatus(true);
+ }
+ };
+
+ /**
+ * Register an observer for provider status changes - we will need to
+ * reflect them in the UI.
+ */
+ private void registerProviderStatusObserver() {
+ getActivity().getContentResolver().registerContentObserver(ProviderStatus.CONTENT_URI,
+ false, mProviderStatusObserver);
+ }
+
+ /**
+ * Register an observer for provider status changes - we will need to
+ * reflect them in the UI.
+ */
+ private void unregisterProviderStatusObserver() {
+ getActivity().getContentResolver().unregisterContentObserver(mProviderStatusObserver);
+ }
+
+ /**
+ * Obtains the contacts provider status and configures the UI accordingly.
+ *
+ * @param loadData true if the method needs to start a query when the
+ * provider is in the normal state
+ * @return true if the provider status is normal
+ */
+ private boolean checkProviderStatus(boolean loadData) {
+ View importFailureView = findViewById(R.id.import_failure);
+ if (importFailureView == null) {
+ return true;
+ }
+
+ // This query can be performed on the UI thread because
+ // the API explicitly allows such use.
+ Cursor cursor = getActivity().getContentResolver().query(ProviderStatus.CONTENT_URI,
+ new String[] { ProviderStatus.STATUS, ProviderStatus.DATA1 }, null, null, null);
+ if (cursor != null) {
+ try {
+ if (cursor.moveToFirst()) {
+ int status = cursor.getInt(0);
+ if (status != mProviderStatus) {
+ mProviderStatus = status;
+ switch (status) {
+ case ProviderStatus.STATUS_NORMAL:
+ mAdapter.notifyDataSetInvalidated();
+ if (loadData) {
+ mLoader.forceLoad();
+ }
+ break;
+
+ case ProviderStatus.STATUS_CHANGING_LOCALE:
+ setEmptyText(R.string.locale_change_in_progress);
+ mAdapter.changeCursor(null);
+ mAdapter.notifyDataSetInvalidated();
+ break;
+
+ case ProviderStatus.STATUS_UPGRADING:
+ setEmptyText(R.string.upgrade_in_progress);
+ mAdapter.changeCursor(null);
+ mAdapter.notifyDataSetInvalidated();
+ break;
+
+ case ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY:
+ long size = cursor.getLong(1);
+ String message = getActivity().getResources().getString(
+ R.string.upgrade_out_of_memory, new Object[] {size});
+ TextView messageView = (TextView) findViewById(R.id.emptyText);
+ messageView.setText(message);
+ messageView.setVisibility(View.VISIBLE);
+ configureImportFailureView(importFailureView);
+ mAdapter.changeCursor(null);
+ mAdapter.notifyDataSetInvalidated();
+ break;
+ }
+ }
+ }
+ } finally {
+ cursor.close();
+ }
+ }
+
+ importFailureView.setVisibility(
+ mProviderStatus == ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY
+ ? View.VISIBLE
+ : View.GONE);
+ return mProviderStatus == ProviderStatus.STATUS_NORMAL;
+ }
+
+ private void configureImportFailureView(View importFailureView) {
+
+ OnClickListener listener = new OnClickListener(){
+
+ public void onClick(View v) {
+ switch(v.getId()) {
+ case R.id.import_failure_uninstall_apps: {
+ // TODO break into a separate method
+ getActivity().startActivity(
+ new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS));
+ break;
+ }
+ case R.id.import_failure_retry_upgrade: {
+ // Send a provider status update, which will trigger a retry
+ ContentValues values = new ContentValues();
+ values.put(ProviderStatus.STATUS, ProviderStatus.STATUS_UPGRADING);
+ getActivity().getContentResolver().update(ProviderStatus.CONTENT_URI,
+ values, null, null);
+ break;
+ }
+ }
+ }};
+
+ Button uninstallApps = (Button) findViewById(R.id.import_failure_uninstall_apps);
+ uninstallApps.setOnClickListener(listener);
+
+ Button retryUpgrade = (Button) findViewById(R.id.import_failure_retry_upgrade);
+ retryUpgrade.setOnClickListener(listener);
+ }
+
+ private View findViewById(int id) {
+ return mView.findViewById(id);
+ }
+
// TODO: fix PluralRules to handle zero correctly and use Resources.getQuantityText directly
public String getQuantityText(int count, int zeroResourceId, int pluralResourceId) {
if (count == 0) {
diff --git a/src/com/android/contacts/list/ContactItemListAdapter.java b/src/com/android/contacts/list/ContactItemListAdapter.java
index fb7f942..aca1ac5 100644
--- a/src/com/android/contacts/list/ContactItemListAdapter.java
+++ b/src/com/android/contacts/list/ContactItemListAdapter.java
@@ -112,9 +112,9 @@
@Override
public boolean isEmpty() {
- if (contactsListActivity.mProviderStatus != ProviderStatus.STATUS_NORMAL) {
- return true;
- }
+// if (contactsListActivity.mProviderStatus != ProviderStatus.STATUS_NORMAL) {
+// return true;
+// }
if (contactsListActivity.mSearchMode) {
return TextUtils.isEmpty(getQueryString());
diff --git a/src/com/android/contacts/list/ProviderStatusLoader.java b/src/com/android/contacts/list/ProviderStatusLoader.java
new file mode 100644
index 0000000..c7bd547
--- /dev/null
+++ b/src/com/android/contacts/list/ProviderStatusLoader.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.ContactsUtils;
+import com.android.contacts.PhoneDisambigDialog;
+import com.android.contacts.R;
+
+import android.app.patterns.CursorLoader;
+import android.app.patterns.LoaderManagingFragment;
+import android.content.AsyncQueryHandler;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.Settings;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.ProviderStatus;
+import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.Contacts.Data;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+/**
+ * Checks provider status and configures a list adapter accordingly.
+ */
+public class ProviderStatusLoader {
+
+ private final CursorLoader mLoader;
+
+ public ProviderStatusLoader(CursorLoader loader) {
+ this.mLoader = loader;
+ }
+
+ public int getProviderStatus() {
+ // This query can be performed on the UI thread because
+ // the API explicitly allows such use.
+ Cursor cursor = mLoader.getContext().getContentResolver().query(
+ ProviderStatus.CONTENT_URI,
+ new String[] { ProviderStatus.STATUS, ProviderStatus.DATA1 }, null, null, null);
+ if (cursor != null) {
+ try {
+ if (cursor.moveToFirst()) {
+ return cursor.getInt(0);
+ }
+ } finally {
+ cursor.close();
+ }
+ }
+
+ return ProviderStatus.STATUS_NORMAL;
+ }
+
+
+// View importFailureView = findViewById(R.id.import_failure);
+// if (importFailureView == null) {
+// return true;
+// }
+//
+// TextView messageView = (TextView) findViewById(R.id.emptyText);
+//
+// // This query can be performed on the UI thread because
+// // the API explicitly allows such use.
+// Cursor cursor = getContentResolver().query(ProviderStatus.CONTENT_URI,
+// new String[] { ProviderStatus.STATUS, ProviderStatus.DATA1 }, null, null, null);
+// if (cursor != null) {
+// try {
+// if (cursor.moveToFirst()) {
+// int status = cursor.getInt(0);
+// if (status != mProviderStatus) {
+// mProviderStatus = status;
+// switch (status) {
+// case ProviderStatus.STATUS_NORMAL:
+// mAdapter.notifyDataSetInvalidated();
+// if (loadData) {
+// startQuery();
+// }
+// break;
+//
+// case ProviderStatus.STATUS_CHANGING_LOCALE:
+// messageView.setText(R.string.locale_change_in_progress);
+// mAdapter.changeCursor(null);
+// mAdapter.notifyDataSetInvalidated();
+// break;
+//
+// case ProviderStatus.STATUS_UPGRADING:
+// messageView.setText(R.string.upgrade_in_progress);
+// mAdapter.changeCursor(null);
+// mAdapter.notifyDataSetInvalidated();
+// break;
+//
+// case ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY:
+// long size = cursor.getLong(1);
+// String message = getResources().getString(
+// R.string.upgrade_out_of_memory, new Object[] {size});
+// messageView.setText(message);
+// configureImportFailureView(importFailureView);
+// mAdapter.changeCursor(null);
+// mAdapter.notifyDataSetInvalidated();
+// break;
+// }
+// }
+// }
+// } finally {
+// cursor.close();
+// }
+// }
+//
+// importFailureView.setVisibility(
+// mProviderStatus == ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY
+// ? View.VISIBLE
+// : View.GONE);
+// return mProviderStatus == ProviderStatus.STATUS_NORMAL;
+//}
+
+//
+// /**
+// * Obtains the contacts provider status and configures the UI accordingly.
+// *
+// * @param loadData true if the method needs to start a query when the
+// * provider is in the normal state
+// * @return true if the provider status is normal
+// */
+// private boolean checkProviderState(boolean loadData) {
+// View importFailureView = findViewById(R.id.import_failure);
+// if (importFailureView == null) {
+// return true;
+// }
+//
+// TextView messageView = (TextView) findViewById(R.id.emptyText);
+//
+// // This query can be performed on the UI thread because
+// // the API explicitly allows such use.
+// Cursor cursor = getContentResolver().query(ProviderStatus.CONTENT_URI,
+// new String[] { ProviderStatus.STATUS, ProviderStatus.DATA1 }, null, null, null);
+// if (cursor != null) {
+// try {
+// if (cursor.moveToFirst()) {
+// int status = cursor.getInt(0);
+// if (status != mProviderStatus) {
+// mProviderStatus = status;
+// switch (status) {
+// case ProviderStatus.STATUS_NORMAL:
+// mAdapter.notifyDataSetInvalidated();
+// if (loadData) {
+// startQuery();
+// }
+// break;
+//
+// case ProviderStatus.STATUS_CHANGING_LOCALE:
+// messageView.setText(R.string.locale_change_in_progress);
+// mAdapter.changeCursor(null);
+// mAdapter.notifyDataSetInvalidated();
+// break;
+//
+// case ProviderStatus.STATUS_UPGRADING:
+// messageView.setText(R.string.upgrade_in_progress);
+// mAdapter.changeCursor(null);
+// mAdapter.notifyDataSetInvalidated();
+// break;
+//
+// case ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY:
+// long size = cursor.getLong(1);
+// String message = getResources().getString(
+// R.string.upgrade_out_of_memory, new Object[] {size});
+// messageView.setText(message);
+// configureImportFailureView(importFailureView);
+// mAdapter.changeCursor(null);
+// mAdapter.notifyDataSetInvalidated();
+// break;
+// }
+// }
+// }
+// } finally {
+// cursor.close();
+// }
+// }
+//
+// importFailureView.setVisibility(
+// mProviderStatus == ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY
+// ? View.VISIBLE
+// : View.GONE);
+// return mProviderStatus == ProviderStatus.STATUS_NORMAL;
+// }
+//
+// private void configureImportFailureView(View importFailureView) {
+//
+// OnClickListener listener = new OnClickListener(){
+//
+// public void onClick(View v) {
+// switch(v.getId()) {
+// case R.id.import_failure_uninstall_apps: {
+// startActivity(new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS));
+// break;
+// }
+// case R.id.import_failure_retry_upgrade: {
+// // Send a provider status update, which will trigger a retry
+// ContentValues values = new ContentValues();
+// values.put(ProviderStatus.STATUS, ProviderStatus.STATUS_UPGRADING);
+// getContentResolver().update(ProviderStatus.CONTENT_URI, values, null, null);
+// break;
+// }
+// }
+// }};
+//
+// Button uninstallApps = (Button) findViewById(R.id.import_failure_uninstall_apps);
+// uninstallApps.setOnClickListener(listener);
+//
+// Button retryUpgrade = (Button) findViewById(R.id.import_failure_retry_upgrade);
+// retryUpgrade.setOnClickListener(listener);
+// }
+
+}