diff options
author | Dmitry Dementyev <dementyev@google.com> | 2016-12-02 14:09:27 -0800 |
---|---|---|
committer | Dmitry Dementyev <dementyev@google.com> | 2016-12-05 14:35:04 -0800 |
commit | d9fc9adf221d014798cc64d4d1bc8196e3afa43a (patch) | |
tree | 1ebf3ef02d3b4d5b86a88997ca6d2474f40f4519 /apps | |
parent | 47fde50bf6c8ba73d2e2ab2813ad9b23d7effd47 (diff) | |
download | android_development-d9fc9adf221d014798cc64d4d1bc8196e3afa43a.tar.gz android_development-d9fc9adf221d014798cc64d4d1bc8196e3afa43a.tar.bz2 android_development-d9fc9adf221d014798cc64d4d1bc8196e3afa43a.zip |
Temporary remove account visibility support pushapiauthenticator.
Refactor push api test apps to have more similar code and use another
manifest entry.
Bug: https://b.corp.google.com/issues/33046496
Test: none
Change-Id: I2c87ccae0e73892eb15fb3e6f98bbb7372e0a24a
Diffstat (limited to 'apps')
9 files changed, 64 insertions, 69 deletions
diff --git a/apps/PushApiAuthenticator/src/com/example/android/pushapiauthenticator/MainActivity.java b/apps/PushApiAuthenticator/src/com/example/android/pushapiauthenticator/MainActivity.java index 2d547e92f..9f7b55a41 100644 --- a/apps/PushApiAuthenticator/src/com/example/android/pushapiauthenticator/MainActivity.java +++ b/apps/PushApiAuthenticator/src/com/example/android/pushapiauthenticator/MainActivity.java @@ -132,6 +132,8 @@ public class MainActivity extends Activity { selectOption.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + //TODO update Authenticator once AccountManager API is updated + /* Account currentAccount = terraAccount; int checkedAccount = accountChooser.getCheckedRadioButtonId(); int checkedOption = optionChooser.getCheckedRadioButtonId(); @@ -211,7 +213,8 @@ public class MainActivity extends Activity { authStatus.setText("----"); } } + */ } }); } -}
\ No newline at end of file +} diff --git a/apps/PushApiTestAppOne/AndroidManifest.xml b/apps/PushApiTestAppOne/AndroidManifest.xml index 3999fdc57..54be509d3 100644 --- a/apps/PushApiTestAppOne/AndroidManifest.xml +++ b/apps/PushApiTestAppOne/AndroidManifest.xml @@ -31,7 +31,7 @@ </intent-filter> </receiver> <meta-data - android:name="android.accounts.SupportedLoginTypes" + android:name="android.accounts.SupportedAccountTypes" android:value="com.google;com.whatsapp;com.example.android.pushapiauthenticator" /> </application> -</manifest>
\ No newline at end of file +</manifest> diff --git a/apps/PushApiTestAppOne/res/layout/activity_main.xml b/apps/PushApiTestAppOne/res/layout/activity_main.xml index 952e35352..30273e446 100644 --- a/apps/PushApiTestAppOne/res/layout/activity_main.xml +++ b/apps/PushApiTestAppOne/res/layout/activity_main.xml @@ -32,7 +32,7 @@ android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="Test Application One" - android:id="@+id/testapponetext" + android:id="@+id/testapptext" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="27dp" /> @@ -44,7 +44,7 @@ android:text="Visible Accounts" android:id="@+id/visibleaccountstext" android:layout_marginTop="58dp" - android:layout_below="@+id/testapponetext" + android:layout_below="@+id/testapptext" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /> @@ -89,4 +89,4 @@ </RelativeLayout> -</ScrollView>
\ No newline at end of file +</ScrollView> diff --git a/apps/PushApiTestAppOne/src/com/example/android/pushapithirdpartyone/MainActivity.java b/apps/PushApiTestAppOne/src/com/example/android/pushapithirdpartyone/MainActivity.java index 7513f0b9a..d9ddcaafd 100644 --- a/apps/PushApiTestAppOne/src/com/example/android/pushapithirdpartyone/MainActivity.java +++ b/apps/PushApiTestAppOne/src/com/example/android/pushapithirdpartyone/MainActivity.java @@ -72,7 +72,7 @@ public class MainActivity extends Activity { ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA); Bundle bundle = ai.metaData; - supportedPackages = bundle.getString("android.accounts.SupportedLoginTypes"); + supportedPackages = bundle.getString("android.accounts.SupportedAccountTypes"); } catch (PackageManager.NameNotFoundException e) { Log.e("PushApiTestAppOne", "Failed to load meta-data, NameNotFound: " + e.getMessage()); @@ -109,4 +109,4 @@ public class MainActivity extends Activity { } }); } -}
\ No newline at end of file +} diff --git a/apps/PushApiTestAppOne/src/com/example/android/pushapithirdpartyone/MessageReceiver.java b/apps/PushApiTestAppOne/src/com/example/android/pushapithirdpartyone/MessageReceiver.java index 21951f322..754c3d84b 100644 --- a/apps/PushApiTestAppOne/src/com/example/android/pushapithirdpartyone/MessageReceiver.java +++ b/apps/PushApiTestAppOne/src/com/example/android/pushapithirdpartyone/MessageReceiver.java @@ -14,18 +14,21 @@ * limitations under the License. */ -package com.example.android.pushapithirdpartyone; +package com.example.android.pushapithirdpartytwo; import android.accounts.Account; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.util.Log; import android.widget.Toast; public class MessageReceiver extends BroadcastReceiver{ + private static final String TAG = "PushApiTestAppOne"; + public void onReceive(Context context, Intent intent) { - Account account = (Account) intent.getParcelableExtra("android.accounts.KEY_ACCOUNT"); - Toast.makeText(context, "Account " + account.name + " received by Test App 1", + Toast.makeText(context, " android.accounts.VISIBLE_ACCOUNTS_CHANGED Broadcast received", Toast.LENGTH_LONG).show(); + Log.i(TAG, "android.accounts.VISIBLE_ACCOUNTS_CHANGED Broadcast received"); } -}
\ No newline at end of file +} diff --git a/apps/PushApiTestAppTwo/AndroidManifest.xml b/apps/PushApiTestAppTwo/AndroidManifest.xml index 7f1d000cf..8ff970da4 100644 --- a/apps/PushApiTestAppTwo/AndroidManifest.xml +++ b/apps/PushApiTestAppTwo/AndroidManifest.xml @@ -17,7 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.pushapithirdpartytwo"> - <uses-permission android:name="android.permission.GET_ACCOUNTS"/> + <!-- <uses-permission android:name="android.permission.GET_ACCOUNTS"/> --> <application android:label="3P App 2" android:icon="@drawable/push"> <activity android:name="MainActivity"> <intent-filter> @@ -27,11 +27,11 @@ </activity> <receiver android:name="com.example.android.pushapithirdpartytwo.MessageReceiver"> <intent-filter> - <action android:name="android.accounts.NEW_ACCOUNT_VISIBLE"/> + <action android:name="android.accounts.VISIBLE_ACCOUNTS_CHANGED"/> </intent-filter> </receiver> <meta-data - android:name="android.accounts.SupportedLoginTypes" + android:name="android.accounts.SupportedAccountTypes" android:value="com.google;com.whatsapp;com.example.android.pushapiauthenticator" /> </application> -</manifest>
\ No newline at end of file +</manifest> diff --git a/apps/PushApiTestAppTwo/res/layout/activity_main.xml b/apps/PushApiTestAppTwo/res/layout/activity_main.xml index 23d3fe848..fe91a9015 100644 --- a/apps/PushApiTestAppTwo/res/layout/activity_main.xml +++ b/apps/PushApiTestAppTwo/res/layout/activity_main.xml @@ -18,48 +18,33 @@ <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="#ADE6B4" + android:background="#ADD8E6" android:orientation="vertical" android:fillViewport="false"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent" - android:paddingBottom="16dp" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:paddingTop="16dp" + android:layout_height="wrap_content" android:id="@+id/relativelayout"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:text="----" - android:id="@+id/logintypesregistered2" - android:layout_below="@+id/logintypesregisteredtext" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" /> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" - android:text="Accounts Registered to Support:" - android:id="@+id/logintypesregisteredtext" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_marginTop="34dp" - android:layout_below="@+id/placeholder" /> + android:text="Test Application Two" + android:id="@+id/testapptext" + android:layout_alignParentTop="true" + android:layout_centerHorizontal="true" + android:layout_marginTop="27dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="Visible Accounts" - android:id="@+id/textView5" - android:layout_alignTop="@+id/getvisibleaccounts2" + android:id="@+id/visibleaccountstext" + android:layout_marginTop="58dp" + android:layout_below="@+id/testapptext" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /> @@ -68,38 +53,39 @@ android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="----" - android:id="@+id/visibleaccounts2" - android:layout_below="@+id/getvisibleaccounts2" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" /> - - <EditText - android:layout_width="1dp" - android:layout_height="wrap_content" - android:id="@+id/placeholder" - android:layout_alignRight="@+id/logintypesregistered2" - android:layout_alignEnd="@+id/logintypesregistered2" - android:layout_below="@+id/visibleaccounts2" /> + android:id="@+id/visibleaccounts" + android:layout_below="@+id/visibleaccountstext" + android:layout_alignLeft="@+id/visibleaccountstext" + android:layout_alignStart="@+id/visibleaccountstext" /> <Button style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Get!" - android:id="@+id/getvisibleaccounts2" - android:layout_below="@+id/textView" + android:id="@+id/getvisibleaccounts" + android:layout_alignTop="@+id/visibleaccountstext" android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" - android:layout_marginTop="37dp" /> + android:layout_alignParentEnd="true" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceSmall" + android:text="----" + android:id="@+id/logintypesregistered" + android:layout_below="@+id/logintypesregisteredtext" + android:layout_alignLeft="@+id/logintypesregisteredtext" + android:layout_alignStart="@+id/logintypesregisteredtext" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" - android:text="Test Application Two" - android:id="@+id/textView" - android:layout_alignParentTop="true" - android:layout_centerHorizontal="true" /> + android:text="Accounts Registered to Support" + android:id="@+id/logintypesregisteredtext" + android:layout_marginTop="58dp" + android:layout_below="@+id/getvisibleaccounts" /> </RelativeLayout> diff --git a/apps/PushApiTestAppTwo/src/com/example/android/pushapithirdpartytwo/MainActivity.java b/apps/PushApiTestAppTwo/src/com/example/android/pushapithirdpartytwo/MainActivity.java index 2288d851b..0eaf98344 100644 --- a/apps/PushApiTestAppTwo/src/com/example/android/pushapithirdpartytwo/MainActivity.java +++ b/apps/PushApiTestAppTwo/src/com/example/android/pushapithirdpartytwo/MainActivity.java @@ -52,9 +52,9 @@ public class MainActivity extends Activity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); am = AccountManager.get(getApplicationContext()); - final TextView loginTypesRegistered = (TextView) findViewById(R.id.logintypesregistered2); - final TextView visibleAccounts = (TextView) findViewById(R.id.visibleaccounts2); - final Button getVisibleAccounts = (Button) findViewById(R.id.getvisibleaccounts2); + final TextView loginTypesRegistered = (TextView) findViewById(R.id.logintypesregistered); + final TextView visibleAccounts = (TextView) findViewById(R.id.visibleaccounts); + final Button getVisibleAccounts = (Button) findViewById(R.id.getvisibleaccounts); final Toast notifOn = Toast.makeText(getApplicationContext(), "Notifs Turned On!", Toast.LENGTH_SHORT); final Toast notifOff = Toast.makeText(getApplicationContext(), "Notifs Turned Off!", @@ -77,7 +77,7 @@ public class MainActivity extends Activity { ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA); Bundle bundle = ai.metaData; - supportedPackages = bundle.getString("android.accounts.SupportedLoginTypes"); + supportedPackages = bundle.getString("android.accounts.SupportedAccountTypes"); } catch (PackageManager.NameNotFoundException e) { Log.e("PushApiTestAppTwo", "Failed to load meta-data, NameNotFound: " + e.getMessage()); @@ -113,4 +113,4 @@ public class MainActivity extends Activity { } }); } -}
\ No newline at end of file +} diff --git a/apps/PushApiTestAppTwo/src/com/example/android/pushapithirdpartytwo/MessageReceiver.java b/apps/PushApiTestAppTwo/src/com/example/android/pushapithirdpartytwo/MessageReceiver.java index 496df1be9..0325d80cd 100644 --- a/apps/PushApiTestAppTwo/src/com/example/android/pushapithirdpartytwo/MessageReceiver.java +++ b/apps/PushApiTestAppTwo/src/com/example/android/pushapithirdpartytwo/MessageReceiver.java @@ -20,12 +20,15 @@ import android.accounts.Account; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.util.Log; import android.widget.Toast; public class MessageReceiver extends BroadcastReceiver{ + private static final String TAG = "PushApiTestAppTwo"; + public void onReceive(Context context, Intent intent) { - Account account = (Account) intent.getParcelableExtra("android.accounts.KEY_ACCOUNT"); - Toast.makeText(context, "Account " + account.name + " received by Test App 2", + Toast.makeText(context, " android.accounts.VISIBLE_ACCOUNTS_CHANGED Broadcast received", Toast.LENGTH_LONG).show(); + Log.i(TAG, "android.accounts.VISIBLE_ACCOUNTS_CHANGED Broadcast received"); } -}
\ No newline at end of file +} |