api-impl: misc stubs and fixes for Spotify

This commit is contained in:
Daniel Panero
2024-11-01 14:21:15 +01:00
committed by Mis012
parent 6dfd0d1d4b
commit e541d87fc2
14 changed files with 229 additions and 95 deletions

View File

@@ -7,6 +7,7 @@ import android.util.Log;
public class BaseBundle {
protected static final String TAG = "Bundle";
static final boolean DEBUG = false;
// Invariant - exactly one of mMap / mParcelledData will be null
// (except inside a call to unparcel)
@@ -198,6 +199,57 @@ public class BaseBundle {
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
* no mapping of the desired type exists for the given key.