1 /* 2 * Copyright (C) 2021 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 com.android.providers.media.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 @Override onCreate()34 public boolean onCreate() { 35 return true; 36 } 37 38 @Override onQueryMedia(Bundle extras)39 public Cursor onQueryMedia(Bundle extras) { 40 throw new UnsupportedOperationException("onQueryMedia not supported"); 41 } 42 43 @Override onQueryDeletedMedia(Bundle extras)44 public Cursor onQueryDeletedMedia(Bundle extras) { 45 throw new UnsupportedOperationException("onQueryDeletedMedia not supported"); 46 } 47 48 @Override onOpenPreview(String mediaId, Point size, Bundle extras, CancellationSignal signal)49 public AssetFileDescriptor onOpenPreview(String mediaId, Point size, Bundle extras, 50 CancellationSignal signal) throws FileNotFoundException { 51 throw new UnsupportedOperationException("onOpenPreview not supported"); 52 } 53 54 @Override onOpenMedia(String mediaId, Bundle extras, CancellationSignal signal)55 public ParcelFileDescriptor onOpenMedia(String mediaId, Bundle extras, 56 CancellationSignal signal) throws FileNotFoundException { 57 throw new UnsupportedOperationException("onOpenMedia not supported"); 58 } 59 60 @Override onGetMediaCollectionInfo(Bundle extras)61 public Bundle onGetMediaCollectionInfo(Bundle extras) { 62 throw new UnsupportedOperationException("onGetMediaCollectionInfo not supported"); 63 } 64 } 65