Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding changes to GpiiActivity.java class and AndroidManifest.xml from Gpii Android Application in order to allow its own installation #27

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Diegohp
Copy link

@Diegohp Diegohp commented Jun 26, 2015

No description provided.

…ading GpiiActivity Android application in order to autodeploy it
isSystemApp = isSystemPackage(this.getPackageManager()
.getApplicationInfo("net.gpii.app", 0));
} catch (NameNotFoundException e1) {
Log.i("APPSISTEMA", "NO SE ENCUENTRA");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every message needs to be in english

@javihernandez
Copy link
Member

Beside my comments,

  • This branch is completely out of date and it needs to be updated with the current master
  • We do not use tabs for intents. Please, use 4-space intents

public class GpiiActivity extends Activity {

private boolean isSystemApp;
private static String TAG = "Cloud4all";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Cloud4all/GPII

* You may obtain a copy of the License at
* https://github.com/GPII/universal/blob/master/LICENSE.txt
*/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Respect the headers

private static String uriTar = "http://docs.google.com/uc?authuser=0&id=0B9NaK6yZUAngMzdsRDdQWi1rbDg&export=download";

private static String gpiiCompatibleAndroidDevicesUrl = "http://wiki.gpii.net/index.php/GPII_Android_Devices_Compatibility_Table";

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty whitespaces

@javihernandez
Copy link
Member

@Diegohp,
thanks for keep working on this. Although you addressed some of my comments I still see a lot of extra whitespaces, tabs, wrong indentation, etc. The point of these comments is to make the code more readable for everyone.

@javihernandez
Copy link
Member

@Diegohp,

also, I would love to have most of the new added functions into a separate .java file (ie: utilities.java). I would like to keep the GpiiActivity.java file as cleaner (and readable) as possible.

import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Process;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing dep

@javihernandez
Copy link
Member

Hi @Diegohp,

it's not building here, I'm getting the following results when trying to build it:

-compile:
    [javac] Compiling 82 source files to /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/bin/classes
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:28: error: package org.apache.commons.compress.archivers.tar does not exist
    [javac] import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
    [javac]                                                 ^
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:29: error: package org.apache.commons.compress.archivers.tar does not exist
    [javac] import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
    [javac]                                                 ^
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:30: error: package org.apache.commons.compress.compressors.gzip does not exist
    [javac] import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
    [javac]                                                    ^
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:181: error: cannot find symbol
    [javac]                 action = intent.getAction();
    [javac]                 ^
    [javac]   symbol: variable action
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:182: error: cannot find symbol
    [javac]                 if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
    [javac]                                                                     ^
    [javac]   symbol: variable action
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:196: error: cannot find symbol
    [javac]                 } else if (action.equals(ACTION_GPII_UNZIP_COMPLETE)) {
    [javac]                            ^
    [javac]   symbol: variable action
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:425: error: cannot find symbol
    [javac]             TarArchiveInputStream tarIn = null;
    [javac]             ^
    [javac]   symbol:   class TarArchiveInputStream
    [javac]   location: class GpiiActivity
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:427: error: cannot find symbol
    [javac]             tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(
    [javac]                         ^
    [javac]   symbol:   class TarArchiveInputStream
    [javac]   location: class GpiiActivity
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:427: error: cannot find symbol
    [javac]             tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(
    [javac]                                                   ^
    [javac]   symbol:   class GzipCompressorInputStream
    [javac]   location: class GpiiActivity
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:430: error: cannot find symbol
    [javac]             TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
    [javac]             ^
    [javac]   symbol:   class TarArchiveEntry
    [javac]   location: class GpiiActivity
    [javac] Note: /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 10 errors

BUILD FAILED

Here I see 2 problems:

  • Missing dependencies: already commented on the relevant import lines
  • The action variable is never defined

Can you please fix these problems?

@javihernandez
Copy link
Member

In relation to the missing dependencies,

anode is already including an utility for dealing with tar files, isn't it enough for our purposes? Is it really needed to include a new one?

@Diegohp
Copy link
Author

Diegohp commented Jul 17, 2015

Added dependencies for Tar and Gzip

@javihernandez
Copy link
Member

Added dependencies for Tar and Gzip

I meant including the libraries, not importing them in the source code again

@@ -25,6 +25,7 @@ else
fi

curl -o app/libs/jtar-1.0.4.jar https://jtar.googlecode.com/files/jtar-1.0.4.jar
curl -o app/libs/commons-compress-1.5.jar https://docs.google.com/uc?export=download&id=0B9NaK6yZUAngSXlKNTBOMHRIcXM
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we using the apache's official download URL of this library?

@javihernandez
Copy link
Member

@Diegohp,

please, whenever you make a change and you want me to keep reviewing it, just let me know, we don't receive notifications when you add commits to the pull request.

@javihernandez
Copy link
Member

Even by applying your last commit, it's not building:

-compile:
    [javac] Compiling 82 source files to /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/bin/classes
    [javac] error: error reading /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/libs/commons-compress-1.5.jar; error in opening zip file
    [javac] 1 error

BUILD FAILED
/home/jhernandez/Downloads/Android/adt-bundle-linux-x86_64-20140321/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/home/jhernandez/Downloads/Android/adt-bundle-linux-x86_64-20140321/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 2 seconds

@Diegohp
Copy link
Author

Diegohp commented Sep 3, 2015

Hi @javihernandez, we have upload some changes to prebuild.sh file and fixed some errors in GpiiActivity.java and main.xml, in order to build Gpii Android app. We tested it, and everything should be work

…rings, GPII User Listerners for NFC and QR, and GPII Architecture on the same project
@javihernandez
Copy link
Member

Hey @Diegohp,

thanks for pushing on this! Right now I'm getting this build error

-pre-compile:

-compile:
    [javac] Compiling 82 source files to /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/bin/classes
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:142: error: cannot find symbol
    [javac]         ctx = this;
    [javac]         ^
    [javac]   symbol:   variable ctx
    [javac]   location: class GpiiActivity
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:189: error: cannot find symbol
    [javac]                             uriUserListeners = myxml.getText();
    [javac]                             ^
    [javac]   symbol:   variable uriUserListeners
    [javac]   location: class GpiiActivity
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:204: error: cannot find symbol
    [javac]                             gpiiUserListenersAPK = myxml.getText();
    [javac]                             ^
    [javac]   symbol:   variable gpiiUserListenersAPK
    [javac]   location: class GpiiActivity
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:273: error: cannot find symbol
    [javac]                                 userListenersNotInstalledDialog(gpiiUserListenersAPK);
    [javac]                                                                 ^
    [javac]   symbol: variable gpiiUserListenersAPK
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:792: error: cannot find symbol
    [javac]         Request request = new Request(Uri.parse(uriUserListeners));
    [javac]                                                 ^
    [javac]   symbol:   variable uriUserListeners
    [javac]   location: class GpiiActivity
    [javac] /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java:794: error: cannot find symbol
    [javac]             + gpiiUserListenersAPK)));
    [javac]               ^
    [javac]   symbol:   variable gpiiUserListenersAPK
    [javac]   location: class GpiiActivity
    [javac] Note: /home/jhernandez/drafts/GPII-Android-Installer/android/platform/app/src/net/gpii/app/GpiiActivity.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 6 errors

BUILD FAILED

any ideas?

@javihernandez
Copy link
Member

Also, I'm randomly experiencing this right before the installation ends:

D/AndroidRuntime( 5691): Shutting down VM
W/dalvikvm( 5691): threadid=1: thread exiting with uncaught exception (group=0x40d1b2a0)
E/AndroidRuntime( 5691): FATAL EXCEPTION: main
E/AndroidRuntime( 5691): java.lang.RuntimeException: Error receiving broadcast Intent { act=net.gpii.app.ACTION_GPII_UNZIP_COMPLETE flg=0x10 } in net.gpii.app.GpiiActivity$1@418ff2a0
E/AndroidRuntime( 5691):    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:765)
E/AndroidRuntime( 5691):    at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime( 5691):    at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 5691):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 5691):    at android.app.ActivityThread.main(ActivityThread.java:4856)
E/AndroidRuntime( 5691):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 5691):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 5691):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
E/AndroidRuntime( 5691):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
E/AndroidRuntime( 5691):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 5691): Caused by: java.lang.IllegalArgumentException: View not attached to window manager
E/AndroidRuntime( 5691):    at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:653)
E/AndroidRuntime( 5691):    at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:349)
E/AndroidRuntime( 5691):    at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
E/AndroidRuntime( 5691):    at net.gpii.app.GpiiActivity$1.onReceive(GpiiActivity.java:290)
E/AndroidRuntime( 5691):    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:755)
E/AndroidRuntime( 5691):    ... 9 more

Have you experienced the same issue before?


try {
tarIncluded=true;
Arrays.asList(getResources().getAssets().list("")).contains("gpii-android.tar.gz");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, the resource is called "gpii-android" (without the .tar.gz extension), and I'm not seeing any renaming-related process within this last commit. Am I overlooking it?

@Diegohp
Copy link
Author

Diegohp commented Oct 30, 2015

Hi Javi! We just added some changes to GpiiActivity in order to fix the issues you have found. Please, test it as soon as possible.

javihernandez added a commit that referenced this pull request Nov 3, 2015
Merge remote-tracking branch 'Diegohp/GPII-installer_FVE.git' into demoKit

* Diegohp/GPII-installer_FVE.git:
  Changes added to GpiiActivity to fix some bugs
  Added changes to install GPII Android Application with declarative Strings, GPII User Listerners for NFC and QR, and GPII Architecture on the same project
  Some errors fixed. Added modification into prebuild.sh to download right jar library from maven repository
  prebuild.sh file modified to import common compress library
  Adding dependencies for tar an gzip
  New indentation added to whole class with four spaces
  Added 4 spaces instead tabulation on GpiiActivity.java. Added header
  Changes applied to GpiiActivity.java and AndroidManifest.xml for upgrading GpiiActivity Android application in order to autodeploy it
@javihernandez
Copy link
Member

@Diegohp,

thanks for your good job on this!
Since we don't see this for master, I've merged it into a new branch called demoKit, so we can get back to it in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants