Merge "Enforcing grid customization permission in manifest instead of code" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
da7d6aff2e
@@ -131,13 +131,11 @@
|
||||
android:writePermission="${applicationId}.permission.WRITE_SETTINGS"
|
||||
android:readPermission="${applicationId}.permission.READ_SETTINGS" />
|
||||
|
||||
<!--
|
||||
The content provider for exposing various launcher grid options.
|
||||
TODO: Add proper permissions
|
||||
-->
|
||||
<!-- The content provider for exposing various launcher grid options. -->
|
||||
<provider
|
||||
android:name="com.android.launcher3.graphics.LauncherCustomizationProvider"
|
||||
android:authorities="${applicationId}.grid_control"
|
||||
android:permission="android.permission.BIND_WALLPAPER"
|
||||
android:exported="true" />
|
||||
|
||||
<!--
|
||||
|
||||
@@ -24,11 +24,9 @@ import static java.util.Objects.requireNonNullElse;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder.DeathRecipient;
|
||||
@@ -297,12 +295,6 @@ public class GridCustomizationsProxy implements ProxyProvider {
|
||||
|
||||
@Override
|
||||
public Bundle call(@NonNull String method, String arg, Bundle extras) {
|
||||
if (mContext.checkPermission("android.permission.BIND_WALLPAPER",
|
||||
Binder.getCallingPid(), Binder.getCallingUid())
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (METHOD_GET_PREVIEW.equals(method)) {
|
||||
return getPreview(extras);
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.net.Uri;
|
||||
@@ -37,6 +36,7 @@ import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.allapps.AllAppsRecyclerView;
|
||||
import com.android.launcher3.celllayout.FavoriteItemsTransaction;
|
||||
import com.android.launcher3.dagger.LauncherComponentProvider;
|
||||
import com.android.launcher3.icons.mono.ThemedIconDrawable;
|
||||
import com.android.launcher3.popup.ArrowPopup;
|
||||
import com.android.launcher3.util.BaseLauncherActivityTest;
|
||||
@@ -139,7 +139,7 @@ public class ThemeIconsTest extends BaseLauncherActivityTest<Launcher> {
|
||||
return icon;
|
||||
}
|
||||
|
||||
private void setThemeEnabled(boolean isEnabled) throws Exception {
|
||||
private void setThemeEnabled(boolean isEnabled) {
|
||||
Uri uri = new Uri.Builder()
|
||||
.scheme(ContentResolver.SCHEME_CONTENT)
|
||||
.authority(targetContext().getPackageName() + ".grid_control")
|
||||
@@ -147,11 +147,10 @@ public class ThemeIconsTest extends BaseLauncherActivityTest<Launcher> {
|
||||
.build();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("boolean_value", isEnabled);
|
||||
try (ContentProviderClient client = targetContext().getContentResolver()
|
||||
.acquireContentProviderClient(uri)) {
|
||||
int result = client.update(uri, values, null);
|
||||
assertTrue(result > 0);
|
||||
}
|
||||
|
||||
int result = LauncherComponentProvider.get(targetContext()).getGridCustomizationsProxy()
|
||||
.update(uri, values, null, null);
|
||||
assertTrue(result > 0);
|
||||
}
|
||||
|
||||
private void switchToAllApps() {
|
||||
|
||||
Reference in New Issue
Block a user