diff --git a/extern/GmsApi b/extern/GmsApi index d2b942d8..4f6a84de 160000 --- a/extern/GmsApi +++ b/extern/GmsApi @@ -1 +1 @@ -Subproject commit d2b942d87f5b5d0547e7e5f279bcc734d69cdef4 +Subproject commit 4f6a84de9d95fef255579c5ce06a89363dc05aa8 diff --git a/play-services-core/ic_gamepad.svg b/play-services-core/ic_gamepad.svg new file mode 100644 index 00000000..9743c3c5 --- /dev/null +++ b/play-services-core/ic_gamepad.svg @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index c34aba9f..3c1fd1b8 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -300,6 +300,26 @@ android:name=".auth.TokenActivity" android:exported="true"/> + + + + + + + + + + + + + + + + - diff --git a/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java b/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java new file mode 100644 index 00000000..4e07f543 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/games/GamesStubService.java @@ -0,0 +1,58 @@ +/* + * Copyright 2013-2015 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.microg.gms.games; + +import android.app.PendingIntent; +import android.content.Intent; +import android.os.Bundle; +import android.os.RemoteException; + +import com.google.android.gms.common.api.CommonStatusCodes; +import com.google.android.gms.common.internal.GetServiceRequest; +import com.google.android.gms.common.internal.IGmsCallbacks; + +import org.microg.gms.BaseService; +import org.microg.gms.common.Services.GAMES; + +import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; +import static org.microg.gms.common.Constants.GMS_PACKAGE_NAME; +import static org.microg.gms.games.UpgradeActivity.ACTION_PLAY_GAMES_UPGRADE; +import static org.microg.gms.games.UpgradeActivity.EXTRA_GAME_PACACKE_NAME; + +public class GamesStubService extends BaseService { + + public static final String PARAM_GAME_PACKAGE_NAME = "com.google.android.gms.games.key.gamePackageName"; + + public GamesStubService() { + super("GmsGamesSvc", GAMES.SERVICE_ID); + } + + @Override + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request) throws RemoteException { + String packageName = null; + if (request.extras != null) { + packageName = request.extras.getString(PARAM_GAME_PACKAGE_NAME); + } + if (packageName == null) packageName = GMS_PACKAGE_NAME; + Intent intent = new Intent(ACTION_PLAY_GAMES_UPGRADE); + intent.setPackage(GMS_PACKAGE_NAME); + intent.putExtra(EXTRA_GAME_PACACKE_NAME, packageName); + Bundle bundle = new Bundle(); + bundle.putParcelable("pendingIntent", PendingIntent.getActivity(this, packageName.hashCode(), intent, FLAG_UPDATE_CURRENT)); + callback.onPostInitComplete(CommonStatusCodes.RESOLUTION_REQUIRED, null, bundle); + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/games/UpgradeActivity.java b/play-services-core/src/main/java/org/microg/gms/games/UpgradeActivity.java new file mode 100644 index 00000000..ca4b5db9 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/games/UpgradeActivity.java @@ -0,0 +1,73 @@ +/* + * Copyright 2013-2015 microG Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.microg.gms.games; + +import android.app.Activity; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.view.WindowManager; +import android.widget.ImageView; +import android.widget.TextView; + +import com.google.android.gms.R; + +public class UpgradeActivity extends Activity { + public static final String ACTION_PLAY_GAMES_UPGRADE = "com.google.android.gms.games.PLAY_GAMES_UPGRADE"; + public static final String EXTRA_GAME_PACACKE_NAME = "com.google.android.gms.games.GAME_PACKAGE_NAME"; + + private static final String TAG = "GmsUpgActivity"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.games_info); + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.copyFrom(getWindow().getAttributes()); + lp.width = WindowManager.LayoutParams.MATCH_PARENT; + lp.height = WindowManager.LayoutParams.WRAP_CONTENT; + getWindow().setAttributes(lp); + + String packageName = getIntent().getStringExtra(EXTRA_GAME_PACACKE_NAME); + + // receive package info + PackageManager packageManager = getPackageManager(); + ApplicationInfo applicationInfo; + try { + applicationInfo = packageManager.getApplicationInfo(packageName, 0); + } catch (PackageManager.NameNotFoundException e) { + Log.w(TAG, e); + finish(); + return; + } + CharSequence appLabel = packageManager.getApplicationLabel(applicationInfo); + Drawable appIcon = packageManager.getApplicationIcon(applicationInfo); + + ((ImageView) findViewById(R.id.app_icon)).setImageDrawable(appIcon); + ((TextView) findViewById(R.id.title)).setText(getString(R.string.games_info_title, appLabel)); + findViewById(android.R.id.button1).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); + } +} diff --git a/play-services-core/src/main/res/drawable-hdpi/ic_gamepad.png b/play-services-core/src/main/res/drawable-hdpi/ic_gamepad.png new file mode 100644 index 00000000..43167f99 Binary files /dev/null and b/play-services-core/src/main/res/drawable-hdpi/ic_gamepad.png differ diff --git a/play-services-core/src/main/res/drawable-mdpi/ic_gamepad.png b/play-services-core/src/main/res/drawable-mdpi/ic_gamepad.png new file mode 100644 index 00000000..e7626864 Binary files /dev/null and b/play-services-core/src/main/res/drawable-mdpi/ic_gamepad.png differ diff --git a/play-services-core/src/main/res/drawable-xhdpi/ic_gamepad.png b/play-services-core/src/main/res/drawable-xhdpi/ic_gamepad.png new file mode 100644 index 00000000..a7b21f88 Binary files /dev/null and b/play-services-core/src/main/res/drawable-xhdpi/ic_gamepad.png differ diff --git a/play-services-core/src/main/res/drawable-xxhdpi/ic_gamepad.png b/play-services-core/src/main/res/drawable-xxhdpi/ic_gamepad.png new file mode 100644 index 00000000..556abb12 Binary files /dev/null and b/play-services-core/src/main/res/drawable-xxhdpi/ic_gamepad.png differ diff --git a/play-services-core/src/main/res/layout/games_info.xml b/play-services-core/src/main/res/layout/games_info.xml new file mode 100644 index 00000000..43e64795 --- /dev/null +++ b/play-services-core/src/main/res/layout/games_info.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +