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;
18 
19 import android.net.Uri;
20 import android.os.Bundle;
21 
22 import java.io.PrintWriter;
23 import java.util.ArrayList;
24 import java.util.List;
25 
26 /**
27  * No-op transcode helper to avoid loading MediaTranscodeManager classes in Android R
28  */
29 public final class TranscodeHelperNoOp implements TranscodeHelper {
30 
31     @Override
freeCache(long bytes)32     public void freeCache(long bytes) {}
33 
34     @Override
onAnrDelayStarted(String packageName, int uid, int tid, int reason)35     public void onAnrDelayStarted(String packageName, int uid, int tid, int reason) {}
36 
37     @Override
transcode(String src, String dst, int uid, int reason)38     public boolean transcode(String src, String dst, int uid, int reason) {
39         return false;
40     }
41 
42     @Override
prepareIoPath(String path, int uid)43     public String prepareIoPath(String path, int uid) {
44         return null;
45     }
46 
47     @Override
shouldTranscode(String path, int uid, Bundle bundle)48     public int shouldTranscode(String path, int uid, Bundle bundle) {
49         return 0;
50     }
51     @Override
supportsTranscode(String path)52     public boolean supportsTranscode(String path) {
53         return false;
54     }
55 
56     @Override
onUriPublished(Uri uri)57     public void onUriPublished(Uri uri) {}
58 
59     @Override
onFileOpen(String path, String ioPath, int uid, int transformsReason)60     public void onFileOpen(String path, String ioPath, int uid, int transformsReason) {}
61 
62     @Override
isTranscodeFileCached(String path, String transcodePath)63     public boolean isTranscodeFileCached(String path, String transcodePath) {
64         return false;
65     }
66 
67     @Override
deleteCachedTranscodeFile(long rowId)68     public boolean deleteCachedTranscodeFile(long rowId) {
69         return false;
70     }
71 
72     @Override
dump(PrintWriter writer)73     public void dump(PrintWriter writer) {}
74 
75     @Override
getSupportedRelativePaths()76     public List<String> getSupportedRelativePaths() {
77         return new ArrayList<String>();
78     }
79 }
80