我需要在不获取SecurityException的情况下执行这三个代码块。
Google Play建议提供商:
SearchRecentSuggestions query = new SearchRecentSuggestions(getActivity(),
"com.google.android.finsky.RecentSuggestionsProvider", SearchRecentSuggestions.QUERIES_PROJECTION_DATE_INDEX);
query.clearHistory();
Google地图搜索历史记录提供商:
SearchRecentSuggestions query = new SearchRecentSuggestions(getActivity(),
"com.google.android.maps.SearchHistoryProvider", SearchRecentSuggestions.QUERIES_PROJECTION_DATE_INDEX);
query.clearHistory();
YouTube建议提供商:
SearchRecentSuggestions query = new SearchRecentSuggestions(getActivity(),
"com.google.android.youtube.SuggestionProvider", SearchRecentSuggestions.QUERIES_PROJECTION_DATE_INDEX);
query.clearHistory();
我与任何提供商都收到此例外:
java.lang.SecurityException: Permission Denial: opening provider com.google.android.finsky.providers.RecentSuggestionsProvider from ProcessRecord{451afbb0 16510:org.proverbio.history.cleaner/u0a230} (pid=16510, uid=10230) that is not exported from uid 10033
at android.os.Parcel.readException(Parcel.java:1465)
at android.os.Parcel.readException(Parcel.java:1419)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3279)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:4839)