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
This commit is contained in:
@@ -132,6 +132,8 @@ public class MainActivity extends Activity {
|
|||||||
selectOption.setOnClickListener(new View.OnClickListener() {
|
selectOption.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
//TODO update Authenticator once AccountManager API is updated
|
||||||
|
/*
|
||||||
Account currentAccount = terraAccount;
|
Account currentAccount = terraAccount;
|
||||||
int checkedAccount = accountChooser.getCheckedRadioButtonId();
|
int checkedAccount = accountChooser.getCheckedRadioButtonId();
|
||||||
int checkedOption = optionChooser.getCheckedRadioButtonId();
|
int checkedOption = optionChooser.getCheckedRadioButtonId();
|
||||||
@@ -211,6 +213,7 @@ public class MainActivity extends Activity {
|
|||||||
authStatus.setText("----");
|
authStatus.setText("----");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.accounts.SupportedLoginTypes"
|
android:name="android.accounts.SupportedAccountTypes"
|
||||||
android:value="com.google;com.whatsapp;com.example.android.pushapiauthenticator" />
|
android:value="com.google;com.whatsapp;com.example.android.pushapiauthenticator" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:text="Test Application One"
|
android:text="Test Application One"
|
||||||
android:id="@+id/testapponetext"
|
android:id="@+id/testapptext"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="27dp" />
|
android:layout_marginTop="27dp" />
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
android:text="Visible Accounts"
|
android:text="Visible Accounts"
|
||||||
android:id="@+id/visibleaccountstext"
|
android:id="@+id/visibleaccountstext"
|
||||||
android:layout_marginTop="58dp"
|
android:layout_marginTop="58dp"
|
||||||
android:layout_below="@+id/testapponetext"
|
android:layout_below="@+id/testapptext"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentStart="true" />
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class MainActivity extends Activity {
|
|||||||
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(),
|
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(),
|
||||||
PackageManager.GET_META_DATA);
|
PackageManager.GET_META_DATA);
|
||||||
Bundle bundle = ai.metaData;
|
Bundle bundle = ai.metaData;
|
||||||
supportedPackages = bundle.getString("android.accounts.SupportedLoginTypes");
|
supportedPackages = bundle.getString("android.accounts.SupportedAccountTypes");
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.e("PushApiTestAppOne", "Failed to load meta-data, NameNotFound: "
|
Log.e("PushApiTestAppOne", "Failed to load meta-data, NameNotFound: "
|
||||||
+ e.getMessage());
|
+ e.getMessage());
|
||||||
|
|||||||
@@ -14,18 +14,21 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example.android.pushapithirdpartyone;
|
package com.example.android.pushapithirdpartytwo;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class MessageReceiver extends BroadcastReceiver{
|
public class MessageReceiver extends BroadcastReceiver{
|
||||||
|
private static final String TAG = "PushApiTestAppOne";
|
||||||
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Account account = (Account) intent.getParcelableExtra("android.accounts.KEY_ACCOUNT");
|
Toast.makeText(context, " android.accounts.VISIBLE_ACCOUNTS_CHANGED Broadcast received",
|
||||||
Toast.makeText(context, "Account " + account.name + " received by Test App 1",
|
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
|
Log.i(TAG, "android.accounts.VISIBLE_ACCOUNTS_CHANGED Broadcast received");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.pushapithirdpartytwo">
|
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">
|
<application android:label="3P App 2" android:icon="@drawable/push">
|
||||||
<activity android:name="MainActivity">
|
<activity android:name="MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<receiver android:name="com.example.android.pushapithirdpartytwo.MessageReceiver">
|
<receiver android:name="com.example.android.pushapithirdpartytwo.MessageReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.accounts.NEW_ACCOUNT_VISIBLE"/>
|
<action android:name="android.accounts.VISIBLE_ACCOUNTS_CHANGED"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.accounts.SupportedLoginTypes"
|
android:name="android.accounts.SupportedAccountTypes"
|
||||||
android:value="com.google;com.whatsapp;com.example.android.pushapiauthenticator" />
|
android:value="com.google;com.whatsapp;com.example.android.pushapiauthenticator" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -18,88 +18,74 @@
|
|||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#ADE6B4"
|
android:background="#ADD8E6"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:fillViewport="false">
|
android:fillViewport="false">
|
||||||
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="16dp"
|
|
||||||
android:paddingLeft="16dp"
|
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:id="@+id/relativelayout">
|
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" />
|
|
||||||
|
|
||||||
<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:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
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" />
|
|
||||||
|
|
||||||
<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:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_marginTop="37dp" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:text="Test Application Two"
|
android:text="Test Application Two"
|
||||||
android:id="@+id/textView"
|
android:id="@+id/testapptext"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_centerHorizontal="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/visibleaccountstext"
|
||||||
|
android:layout_marginTop="58dp"
|
||||||
|
android:layout_below="@+id/testapptext"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:text="----"
|
||||||
|
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/getvisibleaccounts"
|
||||||
|
android:layout_alignTop="@+id/visibleaccountstext"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
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="Accounts Registered to Support"
|
||||||
|
android:id="@+id/logintypesregisteredtext"
|
||||||
|
android:layout_marginTop="58dp"
|
||||||
|
android:layout_below="@+id/getvisibleaccounts" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ public class MainActivity extends Activity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
am = AccountManager.get(getApplicationContext());
|
am = AccountManager.get(getApplicationContext());
|
||||||
final TextView loginTypesRegistered = (TextView) findViewById(R.id.logintypesregistered2);
|
final TextView loginTypesRegistered = (TextView) findViewById(R.id.logintypesregistered);
|
||||||
final TextView visibleAccounts = (TextView) findViewById(R.id.visibleaccounts2);
|
final TextView visibleAccounts = (TextView) findViewById(R.id.visibleaccounts);
|
||||||
final Button getVisibleAccounts = (Button) findViewById(R.id.getvisibleaccounts2);
|
final Button getVisibleAccounts = (Button) findViewById(R.id.getvisibleaccounts);
|
||||||
final Toast notifOn = Toast.makeText(getApplicationContext(), "Notifs Turned On!",
|
final Toast notifOn = Toast.makeText(getApplicationContext(), "Notifs Turned On!",
|
||||||
Toast.LENGTH_SHORT);
|
Toast.LENGTH_SHORT);
|
||||||
final Toast notifOff = Toast.makeText(getApplicationContext(), "Notifs Turned Off!",
|
final Toast notifOff = Toast.makeText(getApplicationContext(), "Notifs Turned Off!",
|
||||||
@@ -77,7 +77,7 @@ public class MainActivity extends Activity {
|
|||||||
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(),
|
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(),
|
||||||
PackageManager.GET_META_DATA);
|
PackageManager.GET_META_DATA);
|
||||||
Bundle bundle = ai.metaData;
|
Bundle bundle = ai.metaData;
|
||||||
supportedPackages = bundle.getString("android.accounts.SupportedLoginTypes");
|
supportedPackages = bundle.getString("android.accounts.SupportedAccountTypes");
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.e("PushApiTestAppTwo", "Failed to load meta-data, NameNotFound: "
|
Log.e("PushApiTestAppTwo", "Failed to load meta-data, NameNotFound: "
|
||||||
+ e.getMessage());
|
+ e.getMessage());
|
||||||
|
|||||||
@@ -20,12 +20,15 @@ import android.accounts.Account;
|
|||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class MessageReceiver extends BroadcastReceiver{
|
public class MessageReceiver extends BroadcastReceiver{
|
||||||
|
private static final String TAG = "PushApiTestAppTwo";
|
||||||
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Account account = (Account) intent.getParcelableExtra("android.accounts.KEY_ACCOUNT");
|
Toast.makeText(context, " android.accounts.VISIBLE_ACCOUNTS_CHANGED Broadcast received",
|
||||||
Toast.makeText(context, "Account " + account.name + " received by Test App 2",
|
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
|
Log.i(TAG, "android.accounts.VISIBLE_ACCOUNTS_CHANGED Broadcast received");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user