1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.photopicker.cts.cloudproviders; 18 19 import android.content.res.AssetFileDescriptor; 20 import android.database.Cursor; 21 import android.graphics.Point; 22 import android.os.Bundle; 23 import android.os.CancellationSignal; 24 import android.os.ParcelFileDescriptor; 25 import android.provider.CloudMediaProvider; 26 27 import java.io.FileNotFoundException; 28 29 /** 30 * Implements a placeholder {@link CloudMediaProvider}. 31 */ 32 public class CloudProviderNoPermission extends CloudMediaProvider { 33 public static final String AUTHORITY = 34 "android.photopicker.cts.cloudproviders.cloud_no_permission"; 35 36 @Override onCreate()37 public boolean onCreate() { 38 return true; 39 } 40 41 @Override onQueryMedia(Bundle extras)42 public Cursor onQueryMedia(Bundle extras) { 43 throw new UnsupportedOperationException("onQueryMedia not supported"); 44 } 45 46 @Override onQueryDeletedMedia(Bundle extras)47 public Cursor onQueryDeletedMedia(Bundle extras) { 48 throw new UnsupportedOperationException("onQueryDeletedMedia not supported"); 49 } 50 51 @Override onOpenPreview(String mediaId, Point size, Bundle extras, CancellationSignal signal)52 public AssetFileDescriptor onOpenPreview(String mediaId, Point size, Bundle extras, 53 CancellationSignal signal) throws FileNotFoundException { 54 throw new UnsupportedOperationException("onOpenPreview not supported"); 55 } 56 57 @Override onOpenMedia(String mediaId, Bundle extras, CancellationSignal signal)58 public ParcelFileDescriptor onOpenMedia(String mediaId, Bundle extras, 59 CancellationSignal signal) throws FileNotFoundException { 60 throw new UnsupportedOperationException("onOpenMedia not supported"); 61 } 62 63 @Override onGetMediaCollectionInfo(Bundle extras)64 public Bundle onGetMediaCollectionInfo(Bundle extras) { 65 throw new UnsupportedOperationException("onGetMediaCollectionInfo not supported"); 66 } 67 } 68