You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
add more stubs to make exoplayer not crash
This commit is contained in:
@@ -1,8 +1,146 @@
|
||||
package android.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.session.MediaSession;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
public class Notification {
|
||||
|
||||
public static final AudioAttributes AUDIO_ATTRIBUTES_DEFAULT = new AudioAttributes();
|
||||
|
||||
public long when;
|
||||
|
||||
public int audioStreamType;
|
||||
|
||||
public int icon;
|
||||
|
||||
public PendingIntent deleteIntent;
|
||||
|
||||
public CharSequence tickerText;
|
||||
|
||||
public int iconLevel;
|
||||
|
||||
public RemoteViews contentView;
|
||||
|
||||
public long[] vibrate;
|
||||
|
||||
public int ledARGB;
|
||||
|
||||
public int ledOnMS;
|
||||
|
||||
public int ledOffMS;
|
||||
|
||||
public int flags;
|
||||
|
||||
public int defaults;
|
||||
|
||||
public Uri sound;
|
||||
|
||||
public AudioAttributes audioAttributes;
|
||||
|
||||
public Bundle extras;
|
||||
|
||||
public static class Builder {
|
||||
public Builder(Context context) {}
|
||||
|
||||
public Builder setWhen(long when) {return this;}
|
||||
|
||||
public Builder setSmallIcon(int icon, int level) {return this;}
|
||||
|
||||
public Builder setContent(RemoteViews contentView) {return this;}
|
||||
|
||||
public Builder setTicker(CharSequence tickerText, RemoteViews contentView) {return this;}
|
||||
|
||||
public Builder setVibrate(long[] pattern) {return this;}
|
||||
|
||||
public Builder setLights(int argb, int onMs, int offMs) {return this;}
|
||||
|
||||
public Builder setOngoing(boolean ongoing) {return this;}
|
||||
|
||||
public Builder setOnlyAlertOnce(boolean onlyAlertOnce) {return this;}
|
||||
|
||||
public Builder setAutoCancel(boolean autoCancel) {return this;}
|
||||
|
||||
public Builder setDefaults(int defaults) {return this;}
|
||||
|
||||
public Builder setContentTitle(CharSequence title) {return this;}
|
||||
|
||||
public Builder setContentText(CharSequence text) {return this;}
|
||||
|
||||
public Builder setContentInfo(CharSequence info) {return this;}
|
||||
|
||||
public Builder setContentIntent(PendingIntent intent) {return this;}
|
||||
|
||||
public Builder setDeleteIntent(PendingIntent intent) {return this;}
|
||||
|
||||
public Builder setFullScreenIntent(PendingIntent intent, boolean highPriority) {return this;}
|
||||
|
||||
public Builder setLargeIcon(Bitmap icon) {return this;}
|
||||
|
||||
public Builder setNumber(int number) {return this;}
|
||||
|
||||
public Builder setProgress(int max, int progress, boolean indeterminate) {return this;}
|
||||
|
||||
public Builder setSubText(CharSequence subText) {return this;}
|
||||
|
||||
public Builder setUsesChronometer(boolean useChronometer) {return this;}
|
||||
|
||||
public Builder setPriority(int priority) {return this;}
|
||||
|
||||
public Builder setShowWhen(boolean showWhen) {return this;}
|
||||
|
||||
public Builder setLocalOnly(boolean localOnly) {return this;}
|
||||
|
||||
public Builder setGroup(String group) {return this;}
|
||||
|
||||
public Builder setSortKey(String sortKey) {return this;}
|
||||
|
||||
public Builder setGroupSummary(boolean isGroupSummary) {return this;}
|
||||
|
||||
public Builder setCategory(String category) {return this;}
|
||||
|
||||
public Builder setColor(int argb) {return this;}
|
||||
|
||||
public Builder setVisibility(int visibility) {return this;}
|
||||
|
||||
public Builder setPublicVersion(Notification notification) {return this;}
|
||||
|
||||
public Builder setSound(Uri sound, AudioAttributes audioAttributes) {return this;}
|
||||
|
||||
public Builder addAction(Action action) {return this;}
|
||||
|
||||
public Builder setStyle(Style style) {return this;}
|
||||
|
||||
public Builder setExtras(Bundle extras) {return this;}
|
||||
|
||||
public Notification build() {
|
||||
return new Notification();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Action {
|
||||
public static final class Builder {
|
||||
|
||||
public Builder(int icon, CharSequence title, PendingIntent intent) {}
|
||||
|
||||
public Builder addExtras(Bundle extras) {return this;}
|
||||
|
||||
public Action build() {
|
||||
return new Action();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class Style {}
|
||||
|
||||
public static class MediaStyle extends Style {
|
||||
|
||||
public MediaStyle setShowActionsInCompactView(int... viewActions) {return this;}
|
||||
|
||||
public MediaStyle setMediaSession(MediaSession.Token token) {return this;}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,8 @@ package android.app;
|
||||
|
||||
public class NotificationManager {
|
||||
public void cancelAll() {}
|
||||
|
||||
public void notify(String tag, int id, Notification notification) {
|
||||
System.out.println("notify(" + tag + ", " + id + ", " + notification + ") called");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,10 @@ public class PendingIntent {
|
||||
|
||||
public void send(Context context, int code, Intent intent) {}
|
||||
|
||||
public static PendingIntent getActivity(Context context, int requestCode, Intent intent, int flags) {
|
||||
return new PendingIntent();
|
||||
}
|
||||
|
||||
public class CanceledException extends Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,8 @@ public abstract class Service extends Context {
|
||||
|
||||
public abstract int onStartCommand(Intent intent, int flags, int startId);
|
||||
|
||||
public void startForeground(int id, Notification notification) {
|
||||
System.out.println("startForeground(" + id + ", " + notification + ") called");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2298,7 +2298,7 @@ public class PackageManager {
|
||||
*/
|
||||
public List<ResolveInfo> queryBroadcastReceivers(Intent intent,
|
||||
int flags) {
|
||||
return null;
|
||||
return new ArrayList<ResolveInfo>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -379,6 +379,10 @@ public class Canvas {
|
||||
|
||||
public void drawPath(Path path, Paint paint) {}
|
||||
|
||||
public boolean clipPath(Path path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static native void native_drawText(long skia_canvas, CharSequence text, int start, int end, float x, float y, long skia_font, long skia_paint);
|
||||
private static native void native_drawRect(long skia_canvas, float left, float top, float right, float bottom, long skia_paint);
|
||||
private static native void native_drawLine(long skia_canvas, long widget, float startX, float startY, float stopX, float stopY, long skia_paint);
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
package android.media;
|
||||
|
||||
public class AudioAttributes {
|
||||
|
||||
public int getFlags() {return 0;}
|
||||
|
||||
public int getUsage() {return 0;}
|
||||
|
||||
public class Builder {
|
||||
|
||||
public Builder setUsage(int usage) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AudioAttributes build() {
|
||||
return new AudioAttributes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,12 @@ public class AudioManager {
|
||||
public int getStreamVolume(int streamType) {
|
||||
return 0; // arbitrary, shouldn't matter too much?
|
||||
}
|
||||
|
||||
public int getStreamMaxVolume(int streamType) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
public int requestAudioFocus(OnAudioFocusChangeListener listener, int streamType, int durationHint) {
|
||||
return /*AUDIOFOCUS_REQUEST_GRANTED*/1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public class AudioTrack {
|
||||
int audioFormat;
|
||||
int bufferSizeInBytes;
|
||||
int mode;
|
||||
private int sessionId;
|
||||
|
||||
// for native code's use
|
||||
long pcm_handle;
|
||||
@@ -45,6 +46,11 @@ public class AudioTrack {
|
||||
native_constructor(streamType, sampleRateInHz, num_channels, audioFormat, bufferSizeInBytes, mode);
|
||||
}
|
||||
|
||||
public AudioTrack(int streamType, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes, int mode, int sessionId) {
|
||||
this(streamType, sampleRateInHz, channelConfig, audioFormat, bufferSizeInBytes, mode);
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public static native int getMinBufferSize(int sampleRateInHz, int channelConfig, int audioFormat);
|
||||
|
||||
public void setPlaybackPositionUpdateListener(OnPlaybackPositionUpdateListener listener) {
|
||||
@@ -79,4 +85,8 @@ public class AudioTrack {
|
||||
}
|
||||
|
||||
public native int write(byte[] audioData, int offsetInBytes, int sizeInBytes);
|
||||
|
||||
public int getAudioSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
}
|
||||
|
||||
9
src/api-impl/android/media/MediaCodec.java
Normal file
9
src/api-impl/android/media/MediaCodec.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package android.media;
|
||||
|
||||
public class MediaCodec {
|
||||
|
||||
public static final class CryptoInfo {}
|
||||
|
||||
public static final class BufferInfo {}
|
||||
|
||||
}
|
||||
9
src/api-impl/android/media/MediaCodecList.java
Normal file
9
src/api-impl/android/media/MediaCodecList.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package android.media;
|
||||
|
||||
public class MediaCodecList {
|
||||
|
||||
public static int getCodecCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
30
src/api-impl/android/media/MediaDescription.java
Normal file
30
src/api-impl/android/media/MediaDescription.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package android.media;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MediaDescription {
|
||||
|
||||
public static class Builder {
|
||||
|
||||
public Builder setMediaId(String mediaId) {return this;}
|
||||
|
||||
public Builder setTitle(CharSequence title) {return this;}
|
||||
|
||||
public Builder setSubtitle(CharSequence subtitle) {return this;}
|
||||
|
||||
public Builder setDescription(CharSequence description) {return this;}
|
||||
|
||||
public Builder setIconBitmap(Bitmap iconBitmap) {return this;}
|
||||
|
||||
public Builder setIconUri(Uri iconUri) {return this;}
|
||||
|
||||
public Builder setExtras(Bundle extras) {return this;}
|
||||
|
||||
public MediaDescription build() {
|
||||
return new MediaDescription();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
16
src/api-impl/android/media/MediaMetadata.java
Normal file
16
src/api-impl/android/media/MediaMetadata.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package android.media;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable.Creator;
|
||||
|
||||
public class MediaMetadata {
|
||||
|
||||
public static final Creator<MediaMetadata> CREATOR = new Creator<MediaMetadata>() {
|
||||
@Override
|
||||
public MediaMetadata createFromParcel(Parcel source) {
|
||||
return new MediaMetadata();
|
||||
}
|
||||
};
|
||||
|
||||
public void writeToParcel(Parcel dest, int flags) {}
|
||||
}
|
||||
13
src/api-impl/android/media/session/MediaController.java
Normal file
13
src/api-impl/android/media/session/MediaController.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package android.media.session;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.MediaMetadata;
|
||||
|
||||
public class MediaController {
|
||||
|
||||
public MediaController(Context context, MediaSession.Token token) {}
|
||||
|
||||
public MediaMetadata getMetadata() {
|
||||
return new MediaMetadata();
|
||||
}
|
||||
}
|
||||
40
src/api-impl/android/media/session/MediaSession.java
Normal file
40
src/api-impl/android/media/session/MediaSession.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package android.media.session;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.media.MediaDescription;
|
||||
import android.media.MediaMetadata;
|
||||
import android.os.Handler;
|
||||
|
||||
public class MediaSession {
|
||||
|
||||
public static final class Token {}
|
||||
|
||||
public static abstract class Callback {}
|
||||
|
||||
public static class QueueItem {
|
||||
public QueueItem(MediaDescription description, long id) {}
|
||||
}
|
||||
|
||||
public MediaSession(Context context, String tag) {}
|
||||
|
||||
public Token getSessionToken() {
|
||||
return new Token();
|
||||
}
|
||||
|
||||
public void setFlags(int flags) {}
|
||||
|
||||
public void setCallback(Callback callback, Handler handler) {}
|
||||
|
||||
public void setMediaButtonReceiver(PendingIntent pendingIntent) {}
|
||||
|
||||
public void setActive(boolean active) {}
|
||||
|
||||
public void setPlaybackState(PlaybackState state) {}
|
||||
|
||||
public void setMetadata(MediaMetadata metadata) {}
|
||||
|
||||
public void setQueue(List<QueueItem> queue) {}
|
||||
}
|
||||
23
src/api-impl/android/media/session/PlaybackState.java
Normal file
23
src/api-impl/android/media/session/PlaybackState.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package android.media.session;
|
||||
|
||||
public class PlaybackState {
|
||||
|
||||
public class Builder {
|
||||
|
||||
public Builder setState(int state, long position, float playbackSpeed, long updateTime) {return this;}
|
||||
|
||||
public Builder setBufferedPosition(long bufferedPosition) {return this;}
|
||||
|
||||
public Builder setActions(long actions) {return this;}
|
||||
|
||||
public Builder setErrorMessage(CharSequence errorMessage) {return this;}
|
||||
|
||||
public Builder setActiveQueueItemId(long activeQueueItemId) {return this;}
|
||||
|
||||
public PlaybackState build() {
|
||||
return new PlaybackState();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -93,4 +93,46 @@ public class BaseBundle {
|
||||
final String s = getString(key);
|
||||
return (s == null) ? defaultValue : s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a long value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @param value a long
|
||||
*/
|
||||
public void putLong(String key, long value) {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an int value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @param value an int, or null
|
||||
*/
|
||||
public void putInt(String key, int value) {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a String value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key. Either key or value may be null.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @param value a String, or null
|
||||
*/
|
||||
public void putString(String key, String value) {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of mappings contained in this Bundle.
|
||||
*
|
||||
* @return the number of mappings as an int.
|
||||
*/
|
||||
public int size() {
|
||||
return mMap.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
package android.os;
|
||||
|
||||
public class Binder extends IBinder {
|
||||
|
||||
public void attachInterface(IInterface owner, String descriptor) {}
|
||||
}
|
||||
|
||||
@@ -179,15 +179,6 @@ public final class Bundle extends BaseBundle implements Cloneable {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of mappings contained in this Bundle.
|
||||
*
|
||||
* @return the number of mappings as an int.
|
||||
*/
|
||||
public int size() {
|
||||
return mMap.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all elements from the mapping of this Bundle.
|
||||
*/
|
||||
@@ -334,28 +325,6 @@ public final class Bundle extends BaseBundle implements Cloneable {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an int value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @param value an int, or null
|
||||
*/
|
||||
public void putInt(String key, int value) {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a long value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @param value a long
|
||||
*/
|
||||
public void putLong(String key, long value) {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a float value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key.
|
||||
@@ -378,17 +347,6 @@ public final class Bundle extends BaseBundle implements Cloneable {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a String value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key. Either key or value may be null.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @param value a String, or null
|
||||
*/
|
||||
public void putString(String key, String value) {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a CharSequence value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key. Either key or value may be null.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
package android.os;
|
||||
|
||||
public class IBinder {
|
||||
|
||||
public interface DeathRecipient {}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user