diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 39f687cb..7bef5e7d 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="org.microg.gms.api"> - + diff --git a/SafeParcel b/SafeParcel index a650ca5b..462316b1 160000 --- a/SafeParcel +++ b/SafeParcel @@ -1 +1 @@ -Subproject commit a650ca5beac2a374460d820935b40f9539e692db +Subproject commit 462316b18e2620bd5c0cb843abd67671d941300d diff --git a/src/com/google/android/gms/common/data/DataHolder.java b/src/com/google/android/gms/common/data/DataHolder.java index 6ec81e9e..335a004a 100644 --- a/src/com/google/android/gms/common/data/DataHolder.java +++ b/src/com/google/android/gms/common/data/DataHolder.java @@ -1,11 +1,91 @@ package com.google.android.gms.common.data; +import android.database.Cursor; +import android.database.CursorWindow; +import android.os.Bundle; + import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Class for accessing collections of data, organized into columns. This provides the backing + * support for DataBuffer. Much like a cursor, the holder supports the notion of a current + * position, and has methods for extracting various types of data from named columns. + */ public class DataHolder extends AutoSafeParcelable { @SafeParceled(1000) private int versionCode = 1; + @SafeParceled(1) + private String[] columns; + + @SafeParceled(2) + private CursorWindow[] windows; + + @SafeParceled(3) + private int statusCode; + + @SafeParceled(4) + private Bundle metadata; + + public DataHolder(String[] columns, CursorWindow[] windows, int statusCode, Bundle metadata) { + this.columns = columns; + this.windows = windows; + this.statusCode = statusCode; + this.metadata = metadata; + } + + + public static DataHolder fromCursor(Cursor cursor, int statusCode, Bundle metadata) { + List windows = new ArrayList<>(); + CursorWindow cursorWindow = null; + int row = 0; + while (cursor.moveToNext()) { + if (cursorWindow == null || !cursorWindow.allocRow()) { + cursorWindow = new CursorWindow(false); + cursorWindow.setNumColumns(cursor.getColumnCount()); + windows.add(cursorWindow); + row = 0; + } + for (int i = 0; i < cursor.getColumnCount(); i++) { + switch (cursor.getType(i)) { + case Cursor.FIELD_TYPE_NULL: + cursorWindow.putNull(row, i); + break; + case Cursor.FIELD_TYPE_BLOB: + cursorWindow.putBlob(cursor.getBlob(i), row, i); + break; + case Cursor.FIELD_TYPE_FLOAT: + cursorWindow.putDouble(cursor.getDouble(i), row, i); + break; + case Cursor.FIELD_TYPE_INTEGER: + cursorWindow.putLong(cursor.getLong(i), row, i); + break; + case Cursor.FIELD_TYPE_STRING: + cursorWindow.putString(cursor.getString(i), row, i); + break; + } + } + row++; + } + DataHolder dataHolder = new DataHolder(cursor.getColumnNames(), windows.toArray(new CursorWindow[windows.size()]), statusCode, metadata); + cursor.close(); + return dataHolder; + } + + @Override + public String toString() { + return "DataHolder{" + + "columns=" + Arrays.toString(columns) + + ", windows=" + Arrays.toString(windows) + + ", statusCode=" + statusCode + + ", metadata=" + metadata + + '}'; + } + public static final Creator CREATOR = new AutoCreator<>(DataHolder.class); } diff --git a/src/com/google/android/gms/common/internal/ISignInButtonCreator.aidl b/src/com/google/android/gms/common/internal/ISignInButtonCreator.aidl new file mode 100644 index 00000000..f6c53996 --- /dev/null +++ b/src/com/google/android/gms/common/internal/ISignInButtonCreator.aidl @@ -0,0 +1,7 @@ +package com.google.android.gms.common.internal; + +import com.google.android.gms.dynamic.IObjectWrapper; + +interface ISignInButtonCreator { + IObjectWrapper createSignInButton(IObjectWrapper context, int size, int color); // returns View +} diff --git a/src/com/google/android/gms/people/internal/IPeopleCallbacks.aidl b/src/com/google/android/gms/people/internal/IPeopleCallbacks.aidl index 43d52a41..8738a9ea 100644 --- a/src/com/google/android/gms/people/internal/IPeopleCallbacks.aidl +++ b/src/com/google/android/gms/people/internal/IPeopleCallbacks.aidl @@ -3,5 +3,6 @@ package com.google.android.gms.people.internal; import com.google.android.gms.common.data.DataHolder; interface IPeopleCallbacks { - void onDataHolders(int code, in Bundle meta, in DataHolder[] data) = 3; + void onDataHolder(int code, in Bundle resolution, in DataHolder holder) = 1; + void onDataHolders(int code, in Bundle resolution, in DataHolder[] holders) = 3; }