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
This commit is contained in:
@@ -8,4 +8,8 @@ public class KeyguardManager {
|
|||||||
public boolean isKeyguardLocked() {
|
public boolean isKeyguardLocked() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isKeyguardSecure() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
src/api-impl/android/app/backup/BackupAgent.java
Normal file
9
src/api-impl/android/app/backup/BackupAgent.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package android.app.backup;
|
||||||
|
|
||||||
|
import android.content.ContextWrapper;
|
||||||
|
|
||||||
|
public abstract class BackupAgent extends ContextWrapper {
|
||||||
|
public BackupAgent() {
|
||||||
|
super(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/api-impl/android/app/backup/BackupAgentHelper.java
Normal file
5
src/api-impl/android/app/backup/BackupAgentHelper.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package android.app.backup;
|
||||||
|
|
||||||
|
public class BackupAgentHelper extends BackupAgent {
|
||||||
|
|
||||||
|
}
|
||||||
8
src/api-impl/android/app/backup/BackupManager.java
Normal file
8
src/api-impl/android/app/backup/BackupManager.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package android.app.backup;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class BackupManager {
|
||||||
|
public BackupManager(Context context) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,15 +10,7 @@ public class JobInfo {
|
|||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
public Builder(int jobId, ComponentName jobService) {}
|
public Builder(int jobId, ComponentName jobService) {}
|
||||||
|
|
||||||
public Builder setMinimumLatency(long minLatencyMillis) {
|
public Builder setBackoffCriteria(long initialBackoffMillis, int backoffPolicy) {
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder setRequiredNetworkType(int networkType) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder setOverrideDeadline(long a) {
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,15 +18,15 @@ public class JobInfo {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setRequiresCharging(boolean requiresCharging) {
|
public Builder setMinimumLatency(long minLatencyMillis) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setRequiresDeviceIdle(boolean requiresDeviceIdle) {
|
public Builder setOverrideDeadline(long a) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setBackoffCriteria(long initialBackoffMillis, int backoffPolicy) {
|
public Builder setPeriodic(long dummy) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +34,18 @@ public class JobInfo {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setRequiredNetworkType(int networkType) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setRequiresCharging(boolean requires_charging) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setRequiresDeviceIdle(boolean requires_device_idle) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public JobInfo build() {
|
public JobInfo build() {
|
||||||
return new JobInfo();
|
return new JobInfo();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,7 @@ public class JobScheduler {
|
|||||||
public int schedule(JobInfo job) {
|
public int schedule(JobInfo job) {
|
||||||
return 1; //RESULT_SUCCESS
|
return 1; //RESULT_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cancel(int dummy) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,6 +238,8 @@ public class Context extends Object {
|
|||||||
return new JobScheduler();
|
return new JobScheduler();
|
||||||
case "appops":
|
case "appops":
|
||||||
return new AppOpsManager();
|
return new AppOpsManager();
|
||||||
|
case "user":
|
||||||
|
return new UserManager();
|
||||||
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;
|
||||||
@@ -717,4 +719,9 @@ public class Context extends Object {
|
|||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Context createDeviceProtectedStorageContext() {
|
||||||
|
/* FIXME: should be a different context, and return different storage locations */
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ public class IntentFilter {
|
|||||||
|
|
||||||
public void addDataPath(String path, int type) {}
|
public void addDataPath(String path, int type) {}
|
||||||
|
|
||||||
|
public final void addDataSchemeSpecificPart(String ssp, int type) {
|
||||||
|
/* FIXME */
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasDataScheme(String dataScheme) {
|
public boolean hasDataScheme(String dataScheme) {
|
||||||
return dataSchemes.contains(dataScheme);
|
return dataSchemes.contains(dataScheme);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,8 @@ public class PathMeasure {
|
|||||||
public boolean getSegment(float start, float end, Path dst, boolean forceClosed) {
|
public boolean getSegment(float start, float end, Path dst, boolean forceClosed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getPosTan(float distance, float[] pos, float[] tan) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,22 +66,24 @@ public class DrawableContainer extends Drawable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
state.drawables[curIndex].draw(canvas);
|
if (curIndex != -1)
|
||||||
|
state.drawables[curIndex].draw(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIntrinsicHeight() {
|
public int getIntrinsicHeight() {
|
||||||
return state.drawables[curIndex].getIntrinsicHeight();
|
return curIndex != -1 ? state.drawables[curIndex].getIntrinsicHeight() : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIntrinsicWidth() {
|
public int getIntrinsicWidth() {
|
||||||
return state.drawables[curIndex].getIntrinsicWidth();
|
return curIndex != -1 ? state.drawables[curIndex].getIntrinsicWidth() : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBounds(int left, int top, int right, int bottom) {
|
public void setBounds(int left, int top, int right, int bottom) {
|
||||||
state.drawables[curIndex].setBounds(left, top, right, bottom);
|
if (curIndex != -1)
|
||||||
|
state.drawables[curIndex].setBounds(left, top, right, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnterFadeDuration(int duration) {}
|
public void setEnterFadeDuration(int duration) {}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package android.net;
|
|||||||
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
|
||||||
class NetworkCapabilities {}
|
|
||||||
|
|
||||||
public class ConnectivityManager {
|
public class ConnectivityManager {
|
||||||
|
|
||||||
public class NetworkCallback {
|
public class NetworkCallback {
|
||||||
@@ -35,10 +33,14 @@ public class ConnectivityManager {
|
|||||||
return new Network();
|
return new Network();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerDefaultNetworkCallback(NetworkCallback cb, Handler hdl) {}
|
public Network[] getAllNetworks() {
|
||||||
|
return new Network[] { getActiveNetwork() };
|
||||||
|
}
|
||||||
|
|
||||||
public NetworkCapabilities getNetworkCapabilities(Network network) {
|
public NetworkCapabilities getNetworkCapabilities(Network network) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerDefaultNetworkCallback(NetworkCallback cb, Handler hdl) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
7
src/api-impl/android/net/NetworkCapabilities.java
Normal file
7
src/api-impl/android/net/NetworkCapabilities.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package android.net;
|
||||||
|
|
||||||
|
public final class NetworkCapabilities {
|
||||||
|
public boolean hasCapability(int capability) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,12 @@ public class BaseBundle {
|
|||||||
// 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)
|
||||||
|
|
||||||
/* package */ ArrayMap<String, Object> mMap = new ArrayMap<>();
|
/* package */ ArrayMap<String, Object> mMap;
|
||||||
|
|
||||||
|
public BaseBundle() {
|
||||||
|
mMap = new ArrayMap<String, Object>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Log a message if the value was non-null but not of the expected type
|
// Log a message if the value was non-null but not of the expected type
|
||||||
void typeWarning(String key, Object value, String className,
|
void typeWarning(String key, Object value, String className,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
|
|||||||
* Constructs a new, empty Bundle.
|
* Constructs a new, empty Bundle.
|
||||||
*/
|
*/
|
||||||
public Bundle() {
|
public Bundle() {
|
||||||
mMap = new ArrayMap<String, Object>();
|
super();
|
||||||
mClassLoader = getClass().getClassLoader();
|
mClassLoader = getClass().getClassLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,27 @@ package android.os;
|
|||||||
|
|
||||||
public class SystemProperties {
|
public class SystemProperties {
|
||||||
public static String get(String prop) {
|
public static String get(String prop) {
|
||||||
android.util.Log.i("SystemProperties", "Grabbing prop " + prop);
|
android.util.Log.i("SystemProperties", "Grabbing String prop " + prop);
|
||||||
return null;
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String get(String prop, String def) {
|
||||||
|
android.util.Log.i("SystemProperties", "Grabbing String prop " + prop + ", default " + def);
|
||||||
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getBoolean(String prop, boolean def) {
|
public boolean getBoolean(String prop, boolean def) {
|
||||||
android.util.Log.i("SystemProperties", "Grabbing prop " + prop + ", default " + def);
|
android.util.Log.i("SystemProperties", "Grabbing boolean prop " + prop + ", default " + def);
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getInt(String prop, int def) {
|
||||||
|
android.util.Log.i("SystemProperties", "Grabbing int prop " + prop + ", default " + def);
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getLong(String prop, long def) {
|
||||||
|
android.util.Log.i("SystemProperties", "Grabbing long prop " + prop + ", default " + def);
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
package android.provider;
|
package android.provider;
|
||||||
|
|
||||||
public interface BaseColumns {}
|
public interface BaseColumns {
|
||||||
|
public static final String _ID = "_id";
|
||||||
|
public static final String _COUNT = "_count";
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ public class ContactsContract {
|
|||||||
|
|
||||||
public static final class CommonDataKinds {
|
public static final class CommonDataKinds {
|
||||||
|
|
||||||
public static class Phone {
|
public static final class Phone {
|
||||||
public static final Uri CONTENT_URI = Uri.parse("content://com.android.contacts/phones");
|
public static final Uri CONTENT_URI = Uri.parse("content://com.android.contacts/phones");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class Email {
|
||||||
|
public static final Uri CONTENT_URI = Uri.parse("content://com.android.contacts/emails");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Profile {
|
public static final class Profile {
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ import android.util.AndroidException;
|
|||||||
|
|
||||||
public class Settings {
|
public class Settings {
|
||||||
public static final class Secure {
|
public static final class Secure {
|
||||||
|
public static final Uri CONTENT_URI = Uri.parse("content://settings/secure");
|
||||||
|
|
||||||
|
public static Uri getUriFor(String name) {
|
||||||
|
return Uri.withAppendedPath(CONTENT_URI, name);
|
||||||
|
}
|
||||||
|
|
||||||
public static String getString(ContentResolver content_resolver, String key) {
|
public static String getString(ContentResolver content_resolver, String key) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "android_id":
|
case "android_id":
|
||||||
@@ -25,6 +31,8 @@ public class Settings {
|
|||||||
switch (key) {
|
switch (key) {
|
||||||
case "limit_ad_tracking":
|
case "limit_ad_tracking":
|
||||||
return 1; // obviously, duh
|
return 1; // obviously, duh
|
||||||
|
case "user_setup_complete":
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
java.lang.System.out.println("!!!! Settings$Secure.getInt: unknown key: >" + key + "<");
|
java.lang.System.out.println("!!!! Settings$Secure.getInt: unknown key: >" + key + "<");
|
||||||
return def;
|
return def;
|
||||||
|
|||||||
10
src/api-impl/android/text/AutoText.java
Normal file
10
src/api-impl/android/text/AutoText.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package android.text;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
public class AutoText {
|
||||||
|
|
||||||
|
public static String get(CharSequence src, final int start, final int end, View view) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* most of this file:
|
* most of this file:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 The Android Open Source Project
|
* Copyright (C) 2006 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@@ -18,11 +18,11 @@
|
|||||||
|
|
||||||
package android.text;
|
package android.text;
|
||||||
|
|
||||||
|
import com.android.internal.util.ArrayUtils;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.android.internal.util.ArrayUtils;
|
|
||||||
|
|
||||||
public class TextUtils {
|
public class TextUtils {
|
||||||
public static int getLayoutDirectionFromLocale(Locale locale) {
|
public static int getLayoutDirectionFromLocale(Locale locale) {
|
||||||
return 0 /*LTR*/; // FIXME
|
return 0 /*LTR*/; // FIXME
|
||||||
@@ -255,7 +255,7 @@ public class TextUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (buf == null || buf.length < len)
|
if (buf == null || buf.length < len)
|
||||||
buf = ArrayUtils.newUnpaddedCharArray(len);
|
buf = ArrayUtils.newUnpaddedCharArray(len);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -377,4 +377,80 @@ public class TextUtils {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface for splitting strings according to rules that are opaque to the user of this
|
||||||
|
* interface. This also has less overhead than split, which uses regular expressions and
|
||||||
|
* allocates an array to hold the results.
|
||||||
|
*
|
||||||
|
* <p>The most efficient way to use this class is:
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* // Once
|
||||||
|
* TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(delimiter);
|
||||||
|
*
|
||||||
|
* // Once per string to split
|
||||||
|
* splitter.setString(string);
|
||||||
|
* for (String s : splitter) {
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public interface StringSplitter extends Iterable<String> {
|
||||||
|
public void setString(String string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple string splitter.
|
||||||
|
*
|
||||||
|
* <p>If the final character in the string to split is the delimiter then no empty string will
|
||||||
|
* be returned for the empty string after that delimeter. That is, splitting <tt>"a,b,"</tt> on
|
||||||
|
* comma will return <tt>"a", "b"</tt>, not <tt>"a", "b", ""</tt>.
|
||||||
|
*/
|
||||||
|
public static class SimpleStringSplitter implements StringSplitter, Iterator<String> {
|
||||||
|
private String mString;
|
||||||
|
private char mDelimiter;
|
||||||
|
private int mPosition;
|
||||||
|
private int mLength;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the splitter. setString may be called later.
|
||||||
|
* @param delimiter the delimeter on which to split
|
||||||
|
*/
|
||||||
|
public SimpleStringSplitter(char delimiter) {
|
||||||
|
mDelimiter = delimiter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the string to split
|
||||||
|
* @param string the string to split
|
||||||
|
*/
|
||||||
|
public void setString(String string) {
|
||||||
|
mString = string;
|
||||||
|
mPosition = 0;
|
||||||
|
mLength = mString.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Iterator<String> iterator() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasNext() {
|
||||||
|
return mPosition < mLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String next() {
|
||||||
|
int end = mString.indexOf(mDelimiter, mPosition);
|
||||||
|
if (end == -1) {
|
||||||
|
end = mLength;
|
||||||
|
}
|
||||||
|
String nextString = mString.substring(mPosition, end);
|
||||||
|
mPosition = end + 1; // Skip the delimiter.
|
||||||
|
return nextString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user