Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
add warning about missing feature file
Browse files Browse the repository at this point in the history
  • Loading branch information
vetruvet committed Aug 7, 2014
1 parent 5ae047d commit 4c305a2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
15 changes: 13 additions & 2 deletions app/src/main/java/com/otaupdater/AboutTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
Expand All @@ -46,10 +47,13 @@ public class AboutTab extends ListFragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Context ctx = getActivity().getApplicationContext();
PackageManager pm = ctx.getPackageManager();

PackageInfo pInfo = null;
try {
Context ctx = getActivity().getApplicationContext();
pInfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0);
pInfo = pm.getPackageInfo(ctx.getPackageName(), 0);

} catch (NameNotFoundException e) {
e.printStackTrace();
}
Expand All @@ -67,6 +71,13 @@ public void onCreate(Bundle savedInstanceState) {
item.put(KEY_SUMMARY, version);
DATA.add(item);

if (!pm.hasSystemFeature(Config.OTA_FEATURE_KEY)) {
item = new HashMap<String, String>();
item.put(KEY_TITLE, getString(R.string.about_ota_feature_missing_title));
item.put(KEY_SUMMARY, getString(R.string.about_ota_feature_missing_summary));
DATA.add(item);
}

item = new HashMap<String, String>();
item.put(KEY_TITLE, getString(R.string.about_license_title));
item.put(KEY_SUMMARY, "");
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/otaupdater/utils/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class Config {
public static final String GCM_SENDER_ID = "1068482628480";
public static final String OAUTH_CLIENT_ID = "1068482628480-jsufug7klk4b4ab2v6f83dtp5q38k74t.apps.googleusercontent.com";

public static final String OTA_FEATURE_KEY = "com.otaupdater.ota_feature";
public static final String PROKEY_SKU = "prokey";

public static final long MIN_PING_TIME = 604800000; // 1 week in ms
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
<string name="about_ota_summary">Copyright © 2014 - OTA Update Center\nFully open-source\nTap to visit our website</string>
<string name="about_version_title">Version</string>
<string name="about_version_unknown">Unknown Version (error in package manager)</string>
<string name="about_ota_feature_missing_title">Missing OTA Feature File!!</string>
<string name="about_ota_feature_missing_summary">The feature XML file is missing from this ROM/Kernel. Without this file, you will not be able to update this app via the Play Store.\n\nPlease contact your ROM/Kernel developer and kindly ask them to add the file. Instructions are available on our website on how to do this.</string>
<string name="about_license_title">Open-Source License</string>
<string name="about_contrib_title">Contributors</string>
<string name="about_feedback_title">Feedback</string>
Expand Down

0 comments on commit 4c305a2

Please sign in to comment.