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
api-impl: misc stubs and fixes for Spotify
This commit is contained in:
@@ -97,6 +97,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app_label = r.getText(pkg.applicationInfo.labelRes);
|
app_label = r.getText(pkg.applicationInfo.labelRes);
|
||||||
if (label != null) {
|
if (label != null) {
|
||||||
setTitle(label);
|
setTitle(label);
|
||||||
@@ -568,4 +569,6 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
public static native void nativeOpenURI(String uri);
|
public static native void nativeOpenURI(String uri);
|
||||||
public native void nativeFileChooser(int action, String type, String title, int requestCode);
|
public native void nativeFileChooser(int action, String type, String title, int requestCode);
|
||||||
public void reportFullyDrawn() {}
|
public void reportFullyDrawn() {}
|
||||||
|
public void setVisible(boolean visible) {}
|
||||||
|
public Uri getReferrer() { return null; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ package android.app;
|
|||||||
|
|
||||||
import android.content.pm.ConfigurationInfo;
|
import android.content.pm.ConfigurationInfo;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ActivityManager {
|
public class ActivityManager {
|
||||||
@@ -46,4 +50,32 @@ public class ActivityManager {
|
|||||||
public static void getMyMemoryState(RunningAppProcessInfo outInfo) {}
|
public static void getMyMemoryState(RunningAppProcessInfo outInfo) {}
|
||||||
|
|
||||||
public boolean clearApplicationUserData() {return false;}
|
public boolean clearApplicationUserData() {return false;}
|
||||||
|
|
||||||
|
public static class AppTask {}
|
||||||
|
public List<ActivityManager.AppTask> getAppTasks() {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class RunningServiceInfo implements Parcelable {
|
||||||
|
public RunningServiceInfo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readFromParcel(Parcel source) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<RunningServiceInfo> getRunningServices(int maxNum)
|
||||||
|
throws SecurityException {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
package android.bluetooth;
|
package android.bluetooth;
|
||||||
|
|
||||||
public class BluetoothManager {
|
public class BluetoothManager {
|
||||||
|
public BluetoothAdapter getAdapter(){
|
||||||
|
return new BluetoothAdapter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import android.app.NotificationManager;
|
|||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.app.SharedPreferencesImpl;
|
import android.app.SharedPreferencesImpl;
|
||||||
import android.app.UiModeManager;
|
import android.app.UiModeManager;
|
||||||
|
import android.bluetooth.BluetoothManager;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageParser;
|
import android.content.pm.PackageParser;
|
||||||
@@ -104,7 +105,13 @@ public class Context extends Object {
|
|||||||
application_info = new ApplicationInfo();
|
application_info = new ApplicationInfo();
|
||||||
try (XmlResourceParser parser = assets.openXmlResourceParser("AndroidManifest.xml")) {
|
try (XmlResourceParser parser = assets.openXmlResourceParser("AndroidManifest.xml")) {
|
||||||
PackageParser packageParser = new PackageParser(native_get_apk_path());
|
PackageParser packageParser = new PackageParser(native_get_apk_path());
|
||||||
pkg = packageParser.parsePackage(r, parser, 0, new String[1]);
|
String[] parseError = new String[1];
|
||||||
|
pkg = packageParser.parsePackage(r, parser, 0, parseError);
|
||||||
|
if (parseError[0] != null) {
|
||||||
|
Slog.e(TAG, parseError[0]);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
packageParser.collectCertificates(pkg, 0);
|
packageParser.collectCertificates(pkg, 0);
|
||||||
application_info = pkg.applicationInfo;
|
application_info = pkg.applicationInfo;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -212,12 +219,18 @@ public class Context extends Object {
|
|||||||
return new LayoutInflater(getApplicationContext());
|
return new LayoutInflater(getApplicationContext());
|
||||||
case "wifi":
|
case "wifi":
|
||||||
return new WifiManager();
|
return new WifiManager();
|
||||||
|
case "bluetooth":
|
||||||
|
return new BluetoothManager();
|
||||||
default:
|
default:
|
||||||
Slog.e(TAG, "!!!!!!! getSystemService: case >" + name + "< is not implemented yet");
|
Slog.e(TAG, "!!!!!!! getSystemService: case >" + name + "< is not implemented yet");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final <T> T getSystemService(Class<T> serviceClass) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
|
public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
|
||||||
receiverMap.put(filter, receiver);
|
receiverMap.put(filter, receiver);
|
||||||
return new Intent();
|
return new Intent();
|
||||||
|
|||||||
@@ -342,4 +342,9 @@ public class Intent implements Parcelable {
|
|||||||
return new ShortcutIconResource();
|
return new ShortcutIconResource();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setExtrasClassLoader(ClassLoader loader) {}
|
||||||
|
public Intent setClassName(Context packageContext, String className) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ public class PackageInfo {
|
|||||||
*/
|
*/
|
||||||
public String packageName = "com.example.app"; // FIXME
|
public String packageName = "com.example.app"; // FIXME
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The names of any installed split APKs for this package.
|
||||||
|
*/
|
||||||
|
public String[] splitNames;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The version number of this package, as specified by the <manifest>
|
* The version number of this package, as specified by the <manifest>
|
||||||
* tag's {@link android.R.styleable#AndroidManifest_versionCode versionCode}
|
* tag's {@link android.R.styleable#AndroidManifest_versionCode versionCode}
|
||||||
|
|||||||
@@ -831,6 +831,11 @@ public class Resources {
|
|||||||
return csl.getDefaultColor();
|
return csl.getDefaultColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getColor(int id, Theme theme) throws NotFoundException {
|
||||||
|
// TODO fix it
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a color state list associated with a particular resource ID. The
|
* Return a color state list associated with a particular resource ID. The
|
||||||
* resource may contain either a single raw color value, or a complex
|
* resource may contain either a single raw color value, or a complex
|
||||||
@@ -1594,7 +1599,7 @@ public class Resources {
|
|||||||
mConfiguration.smallestScreenWidthDp,
|
mConfiguration.smallestScreenWidthDp,
|
||||||
mConfiguration.screenWidthDp, mConfiguration.screenHeightDp,
|
mConfiguration.screenWidthDp, mConfiguration.screenHeightDp,
|
||||||
mConfiguration.screenLayout, mConfiguration.uiMode,
|
mConfiguration.screenLayout, mConfiguration.uiMode,
|
||||||
24);
|
25);
|
||||||
|
|
||||||
if (DEBUG_CONFIG) {
|
if (DEBUG_CONFIG) {
|
||||||
Slog.i(TAG, "**** Updating config of " + this + ": final config is " + mConfiguration + " final compat is " + mCompatibilityInfo);
|
Slog.i(TAG, "**** Updating config of " + this + ": final config is " + mConfiguration + " final compat is " + mCompatibilityInfo);
|
||||||
@@ -2310,50 +2315,50 @@ public class Resources {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
/* if (id != 0) {
|
/* if (id != 0) {
|
||||||
try {
|
try {
|
||||||
// These may be compiled...
|
// These may be compiled...
|
||||||
synchronized (mCachedXmlBlockIds) {
|
synchronized (mCachedXmlBlockIds) {
|
||||||
// First see if this block is in our cache.
|
// First see if this block is in our cache.
|
||||||
final int num = mCachedXmlBlockIds.length;
|
final int num = mCachedXmlBlockIds.length;
|
||||||
for (int i=0; i<num; i++) {
|
for (int i=0; i<num; i++) {
|
||||||
if (mCachedXmlBlockIds[i] == id) {
|
if (mCachedXmlBlockIds[i] == id) {
|
||||||
//System.out.println("**** REUSING XML BLOCK! id="
|
//System.out.println("**** REUSING XML BLOCK! id="
|
||||||
// + id + ", index=" + i);
|
// + id + ", index=" + i);
|
||||||
return mCachedXmlBlocks[i].newParser();
|
return mCachedXmlBlocks[i].newParser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not in the cache, create a new block and put it at
|
// Not in the cache, create a new block and put it at
|
||||||
// the next slot in the cache.
|
// the next slot in the cache.
|
||||||
XmlBlock block = mAssets.openXmlBlockAsset(
|
XmlBlock block = mAssets.openXmlBlockAsset(
|
||||||
assetCookie, file);
|
assetCookie, file);
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
int pos = mLastCachedXmlBlockIndex+1;
|
int pos = mLastCachedXmlBlockIndex+1;
|
||||||
if (pos >= num) pos = 0;
|
if (pos >= num) pos = 0;
|
||||||
mLastCachedXmlBlockIndex = pos;
|
mLastCachedXmlBlockIndex = pos;
|
||||||
XmlBlock oldBlock = mCachedXmlBlocks[pos];
|
XmlBlock oldBlock = mCachedXmlBlocks[pos];
|
||||||
if (oldBlock != null) {
|
if (oldBlock != null) {
|
||||||
oldBlock.close();
|
oldBlock.close();
|
||||||
}
|
}
|
||||||
mCachedXmlBlockIds[pos] = id;
|
mCachedXmlBlockIds[pos] = id;
|
||||||
mCachedXmlBlocks[pos] = block;
|
mCachedXmlBlocks[pos] = block;
|
||||||
//System.out.println("**** CACHING NEW XML BLOCK! id="
|
//System.out.println("**** CACHING NEW XML BLOCK! id="
|
||||||
// + id + ", index=" + pos);
|
// + id + ", index=" + pos);
|
||||||
return block.newParser();
|
return block.newParser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
NotFoundException rnf = new NotFoundException(
|
NotFoundException rnf = new NotFoundException(
|
||||||
"File " + file + " from xml type " + type + " resource ID #0x"
|
"File " + file + " from xml type " + type + " resource ID #0x"
|
||||||
+ Integer.toHexString(id));
|
+ Integer.toHexString(id));
|
||||||
rnf.initCause(e);
|
rnf.initCause(e);
|
||||||
throw rnf;
|
throw rnf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new NotFoundException(
|
throw new NotFoundException(
|
||||||
"File " + file + " from xml type " + type + " resource ID #0x"
|
"File " + file + " from xml type " + type + " resource ID #0x"
|
||||||
+ Integer.toHexString(id));
|
+ Integer.toHexString(id));
|
||||||
*/ }
|
*/ }
|
||||||
|
|
||||||
private TypedArray getCachedStyledAttributes(int len) {
|
private TypedArray getCachedStyledAttributes(int len) {
|
||||||
|
|||||||
@@ -3,4 +3,6 @@ package android.graphics;
|
|||||||
public class LinearGradient extends Shader {
|
public class LinearGradient extends Shader {
|
||||||
|
|
||||||
public LinearGradient(float x0, float y0, float x1, float y1, int[] colors, float[] positions, TileMode mode) {}
|
public LinearGradient(float x0, float y0, float x1, float y1, int[] colors, float[] positions, TileMode mode) {}
|
||||||
|
public LinearGradient(float x0, float y0, float x1, float y1, long[] colors, float[] positions, TileMode tile) {}
|
||||||
|
public LinearGradient(float x0, float y0, float x1, float y1, int color0, int color1, TileMode tile) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ public class Paint {
|
|||||||
}
|
}
|
||||||
public void getTextBounds(String text, int start, int end, Rect bounds) {}
|
public void getTextBounds(String text, int start, int end, Rect bounds) {}
|
||||||
public void getTextBounds(char[] text, int index, int count, Rect bounds) {}
|
public void getTextBounds(char[] text, int index, int count, Rect bounds) {}
|
||||||
|
public int getTextWidths(String text, int start, int end, float[] widths) {
|
||||||
|
// TODO fix it
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
public void setFilterBitmap(boolean filter) {}
|
public void setFilterBitmap(boolean filter) {}
|
||||||
|
|
||||||
public void setFlags(int flags) {
|
public void setFlags(int flags) {
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ public class Typeface {
|
|||||||
return typeface;
|
return typeface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Typeface createFromFile(String path) {
|
||||||
|
return DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
private static native long native_create(CharSequence family_name, int style);
|
private static native long native_create(CharSequence family_name, int style);
|
||||||
|
|
||||||
public int getStyle() {
|
public int getStyle() {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
public class BaseBundle {
|
public class BaseBundle {
|
||||||
protected static final String TAG = "Bundle";
|
protected static final String TAG = "Bundle";
|
||||||
|
static final boolean DEBUG = false;
|
||||||
|
|
||||||
// Invariant - exactly one of mMap / mParcelledData will be null
|
// Invariant - exactly one of mMap / mParcelledData will be null
|
||||||
// (except inside a call to unparcel)
|
// (except inside a call to unparcel)
|
||||||
@@ -198,6 +199,57 @@ public class BaseBundle {
|
|||||||
return mMap.size();
|
return mMap.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value associated with the given key, or defaultValue if
|
||||||
|
* no mapping of the desired type exists for the given key.
|
||||||
|
*
|
||||||
|
* @param key a String
|
||||||
|
* @param defaultValue Value to return if key does not exist
|
||||||
|
* @return a boolean value
|
||||||
|
*/
|
||||||
|
public boolean getBoolean(String key, boolean defaultValue) {
|
||||||
|
Object o = mMap.get(key);
|
||||||
|
System.out.println("bundle.getBoolean(" + key + ", " + defaultValue + ") called");
|
||||||
|
/* the default for this is very scummy */
|
||||||
|
if(key.equals("com.facebook.sdk.AutoLogAppEventsEnabled")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (o == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return (Boolean)o;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
typeWarning(key, o, "Boolean", defaultValue, e);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value associated with the given key, or false if
|
||||||
|
* no mapping of the desired type exists for the given key.
|
||||||
|
*
|
||||||
|
* @param key a String
|
||||||
|
* @return a boolean value
|
||||||
|
*/
|
||||||
|
public boolean getBoolean(String key) {
|
||||||
|
if (DEBUG)
|
||||||
|
Log.d(TAG, "Getting boolean in " + Integer.toHexString(System.identityHashCode(this)));
|
||||||
|
return getBoolean(key, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserts a Boolean 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 Boolean, or null
|
||||||
|
*/
|
||||||
|
public void putBoolean(String key, boolean value) {
|
||||||
|
mMap.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value associated with the given key, or defaultValue if
|
* Returns the value associated with the given key, or defaultValue if
|
||||||
* no mapping of the desired type exists for the given key.
|
* no mapping of the desired type exists for the given key.
|
||||||
|
|||||||
@@ -262,17 +262,6 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Inserts a Boolean 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 Boolean, or null
|
|
||||||
*/
|
|
||||||
public void putBoolean(String key, boolean value) {
|
|
||||||
mMap.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inserts a byte value into the mapping of this Bundle, replacing
|
* Inserts a byte value into the mapping of this Bundle, replacing
|
||||||
* any existing value for the given key.
|
* any existing value for the given key.
|
||||||
@@ -587,45 +576,6 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
|
|||||||
mMap.put(key, value);
|
mMap.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value associated with the given key, or false if
|
|
||||||
* no mapping of the desired type exists for the given key.
|
|
||||||
*
|
|
||||||
* @param key a String
|
|
||||||
* @return a boolean value
|
|
||||||
*/
|
|
||||||
public boolean getBoolean(String key) {
|
|
||||||
if (DEBUG)
|
|
||||||
Log.d(TAG, "Getting boolean in " + Integer.toHexString(System.identityHashCode(this)));
|
|
||||||
return getBoolean(key, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value associated with the given key, or defaultValue if
|
|
||||||
* no mapping of the desired type exists for the given key.
|
|
||||||
*
|
|
||||||
* @param key a String
|
|
||||||
* @param defaultValue Value to return if key does not exist
|
|
||||||
* @return a boolean value
|
|
||||||
*/
|
|
||||||
public boolean getBoolean(String key, boolean defaultValue) {
|
|
||||||
Object o = mMap.get(key);
|
|
||||||
System.out.println("bundle.getBoolean(" + key + ", " + defaultValue + ") called");
|
|
||||||
/* the default for this is very scummy */
|
|
||||||
if(key.equals("com.facebook.sdk.AutoLogAppEventsEnabled")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (o == null) {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return (Boolean)o;
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
typeWarning(key, o, "Boolean", defaultValue, e);
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value associated with the given key, or (byte) 0 if
|
* Returns the value associated with the given key, or (byte) 0 if
|
||||||
* no mapping of the desired type exists for the given key.
|
* no mapping of the desired type exists for the given key.
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package android.os;
|
package android.os;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
public final class StrictMode {
|
public final class StrictMode {
|
||||||
public static void setThreadPolicy(final ThreadPolicy policy) {}
|
public static void setThreadPolicy(final ThreadPolicy policy) {}
|
||||||
public static void setVmPolicy(final VmPolicy policy) {}
|
public static void setVmPolicy(final VmPolicy policy) {}
|
||||||
@@ -9,9 +11,50 @@ public final class StrictMode {
|
|||||||
public static ThreadPolicy allowThreadDiskReads() {
|
public static ThreadPolicy allowThreadDiskReads() {
|
||||||
return new ThreadPolicy();
|
return new ThreadPolicy();
|
||||||
}
|
}
|
||||||
|
public static ThreadPolicy getThreadPolicy() {
|
||||||
|
return new ThreadPolicy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnThreadViolationListener {
|
||||||
|
}
|
||||||
|
|
||||||
public static final class ThreadPolicy {
|
public static final class ThreadPolicy {
|
||||||
|
final int mask;
|
||||||
|
final OnThreadViolationListener listener;
|
||||||
|
final Executor callbackExecutor;
|
||||||
|
|
||||||
|
private ThreadPolicy(int mask, OnThreadViolationListener listener, Executor executor) {
|
||||||
|
this.mask = mask;
|
||||||
|
this.listener = listener;
|
||||||
|
this.callbackExecutor = executor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ThreadPolicy() {
|
||||||
|
this.mask = 0;
|
||||||
|
this.listener = new OnThreadViolationListener() {};
|
||||||
|
this.callbackExecutor = new Executor() {
|
||||||
|
@Override
|
||||||
|
public void execute(Runnable command) {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
|
private int mask = 0;
|
||||||
|
private OnThreadViolationListener listener;
|
||||||
|
private Executor executor;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
mask = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder(ThreadPolicy policy) {
|
||||||
|
if(policy != null) {
|
||||||
|
mask = policy.mask;
|
||||||
|
listener = policy.listener;
|
||||||
|
executor = policy.callbackExecutor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Builder detectAll() {
|
public Builder detectAll() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -24,11 +67,14 @@ public final class StrictMode {
|
|||||||
public Builder permitDiskWrites() {
|
public Builder permitDiskWrites() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
public Builder detectResourceMismatches() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
public Builder penaltyLog() {
|
public Builder penaltyLog() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public ThreadPolicy build() {
|
public ThreadPolicy build() {
|
||||||
return new ThreadPolicy();
|
return new ThreadPolicy(mask, listener, executor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package android.text;
|
package android.text;
|
||||||
|
|
||||||
|
import org.xml.sax.XMLReader;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
public class Html {
|
public class Html {
|
||||||
@@ -29,4 +31,12 @@ public class Html {
|
|||||||
}
|
}
|
||||||
return out.toString();
|
return out.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static interface TagHandler {
|
||||||
|
/**
|
||||||
|
* This method will be called whenn the HTML parser encounters
|
||||||
|
* a tag that it does not know how to interpret.
|
||||||
|
*/
|
||||||
|
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user