Thursday, February 26, 2015

Power Manager Enters Final Testng

The Power Trigger implementation should be completed in the next couple of days, meaning that Power Manager 4.4.0 will be entering a feature freeze in preparation for its release. After the freeze, I will only be fixing bugs, not adding any new features to the application. Development efforts for Power Manager will then be focused on the next version, which will bring a new visual theme as well as smoother interface and faster operation.

SoftGlow is still going through some rougher testing as I decide the direction I want to take with the application, though I believe I will figure that out soon.

Home Button is getting bugfixed for an occasional crash (that actually has to do with Google Play Services, not Home Button itself) that should be released soon as well.

Stay tuned!

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================

Wednesday, February 25, 2015

Something something

The plan. The plan is.

After Power Manager updates to include Power Triggers, it will basically be stablized and the feature work will be frozen for a time. Work will then be focused on the next version of Power Manager, which I hope to be cleaner looking, more animated and faster, and smaller on memory.

But BEFORE that can happen, SoftGlow will be patched to stabilize both the included features and work towards the addition of new features like better time management for the amount of tint applied to the screen.

And a small patch for HomeButton that can help resolve a "maybe" issue, which I have been unable to reproduce but have received a couple of reports about.

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================

Monday, February 23, 2015

Using Android as a SOCKS server

Yeah as a server. Why? There were plenty of pages floating around the web which said how to connect your Android to a SOCKS server, but very few told you actually how to use it as the server. So this is what I'm going to try and explain.

First let me state why I found this neccessary. My phone carrier disables the use of mobile data through a USB tethering setup except in the event of the user purchasing a "mobile data tethering plan". As a result, when I connect my device to a laptop and enable tethering, the laptop does not receive a network connection. So I set off to try and get around this limitation by tunnelling through a SOCKS server that I would host on my phone, therefore making it appear that the Android was making all of the web requests: no tethering plan needed.

By setting up a SOCKS server, you can use your phone's mobile data to power the network of your other systems, including a laptop which otherwise does not have any other connection to the network.

Essentially the setup is as follows:

Tether your Android by USB to your system.
Get an IP address on your system.
Get an Android SSH server application
Start an SSH server on the Android device
Start a SOCKS server off of the SSH server
Connect from your system to the SOCKS server and bind to a local port
Proxy any connections (browser, mail) through the local bound port.

So here we go.

Tether your Android. Google around if you need to know how to do this, as explaining it will be out of the scope of this post.

Once your Android is tethered, get an IP address for your system, either statically or dynamically. I used a simple dynamic address for this, using the Linux dhcpcd program. On other operating systems (and Linux distributions) the command will vary, so dig around.


NOTE

This post is written only with functionality in mind. It is up to you to figure out the necessary security measures for your specific setup. Some of the steps here may be insecure, or leave you visible to eyes on the Web. I will not be held responsible for your failure to adhere to good security practices.

Now the good stuff.

First you are going to need an SSH Server for Android. In this case, I used Servers Ultimate Pro which was free on the Amazon app store a few months back. You first need to open Servers Ultimate. Keep in mind this was written for version 6.3.10, though it can be applied I'm sure to other versions as long as they support/supported SSH and SOCKS servers. For this, you'll also need the free Server Pack E, which adds support for SSH.

Once inside the application, navigate to the "Servers" tab. Click the Action icon "Plus" to add a new server and select an SSH server. Name the server, give it a (random) port, and make sure that atleast the "Enable Shell" option is selected under the Protocol section in the "Specific" tab. You can also take the opportunity to add your own public key, if you know what that is, although the how to for doing that is out of the scope of this post. Click the save icon and you should be good to go.

Add a second server and make it a SOCKS server. Give it a (different random) port, and that's fine as well. Click "Save" and be on your way.

Click the Play button in the top rght of the "Servers" screen to start your SSH and SOCKS servers. Woohoo!

Now at this point you should have and know the following four things:

An IP Address for you Android Device which is tethered to your system, android-ip
An IP Address for your system needing Internet, system-ip
The port for the SOCKS server, lets call it socks-port
The port for the SSH server in general, lets call that ssh-port

Add one more thing to your list, which is the local port to bind to. Though the default is 1080, for the purposes of explination I'll be using a different port, called bind-port.

Now the part which may unnerve you if you aren't too command line familiar (although why would you be looking for SOCKS server setup instructions). You will ssh from your system to your Android. The command will look something like this:

    ssh -L <bind-port>:<android-ip>:<socks-port> -p <ssh-port> <android-ip>

    ssh -L 1080:192.168.0.111:1080 -p 22 192.168.0.111

alternatively you can use the dynamic port option instead:

    ssh -D <bind-port> -p <ssh-port> <android-ip>

    ssh -D 1080 -p 22 192.168.0.111

This will do the following:

Request an SSH connection to android-ip on port ssh-port. Once connected it will forward the local port bind-port on your system to the socks-port on the Android system. Now you've hacked together a SOCKS proxy for your system from an Android server.

At this point, your proxy is located at localhost:<bind-port>. Some programs have SOCKS proxy support built in, in which case you're good to go. For those that don't you may be able to pass the proxy as an argument to different programs for them to be able to use it, for example:

    google-chrome --proxy-server=socks5://localhost:1080
    curl --socks5-hostname localhost:1080


Finally you can create a configuration file in $HOME/.ssh/config which can contain something like the following:

    Host <proxy-name>
    Hostname <android-ip>
    Port <ssh-port>
    DynamicForward localhost:<bind-port>

and then you can connect to your proxy using

    ssh <proxy-name>


Using this, I was able to pull system updates, git updates (and push), emails from a Thunderbird client, and browse the web on Google Chrome and Firefox, without any WiFi connection or Ethernet connection.

And all without a mobile data tethering plan too.


NOTE

This post is written only with functionality in mind. It is up to you to figure out the necessary security measures for your specific setup. Some of the steps here may be insecure, or leave you visible to eyes on the Web. I will not be held responsible for your failure to adhere to good security practices.

Your mileage may vary.

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================

Thursday, February 19, 2015

Handling Power Triggers

I'm wondering how to go about doing this.

Should I allow triggers to have the same names, or limit names to be unique only? Do I allow the user to leave a field blank and have it auto-populate, or do I force you to fill in everything? What to do, what to do.

Also, big update for pstate-frequency. Cleaned up all the ugly (lazy) exit calls, so now the program should exit without any memory left over. Refined the automatic power plan logic and removed the old crusty log interface. Number of allocations has been reduced significantly, takes very little memory now. Speed of execution has also been increased, which is always good, although the tool is arguably already fast enough.

More things as they occur.

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================

Wednesday, February 11, 2015

Reflection

Let's talk about reflection and "private" APIs.

Power Manager uses this specific snippet of code to be able to toggle Mobile Data on (almost all) Android devices. Up until Android Kitkat(4.4), this was a perfectly working, albeit ugly solution, which used a feature of the Java programming language called "reflection":


/*
 * Get the state of mobile data
 * returns false if disabled, true if enabled
 */ 
public final boolean getMobileDataEnabled(final Context context) {
    final ConnectivityManager manager = 

        context.getSystemService(Context.CONNECTIVITY_SERVICE); 
    final String methodName = "getMobileDataEnabled";
    final Method getMobileData = ConnectivityManager.class 

        .getDeclaredMethod(methodName);
    method.setAccessible(true);
    return (Boolean) method.invoke(manager);
}


/*
 * Set the state of mobile data
 * true enables data, false disables data
 */ 
public final void setMobileDataEnabled(final Context context, final boolean state) {
    final ConnectivityManager manager = 

        context.getSystemService(Context.CONNECTIVITY_SERVICE); 
    final String methodName = "setMobileDataEnabled";
    final Method setMobileData = ConnectivityManager.class 

        .getDeclaredMethod(methodName, Boolean.TYPE);
    method.setAccessible(true);
    method.invoke(manager, state);
}
 

This ugly reflection solution was all that a developer could do to work with the mobile data on an Android device, as there was no public API available for standard use. Was reflection good? No. It was a hack to get around limitations, it was unsupported on some devices, and it could disappear with no warning. But reflection was all we had as developers. And it stuck around on Android for the first 19 versions, all the way up to Kitkat 4.4.

In the new Android, Lollipop (5.0), all of this has changed.

There is no way to access or modify the state of the mobile data connection in Android Lollipop.
No way at all*. Any developer looking to perhaps, save power by toggling the state of mobile data on a device, will have no way to do so on Android Lollipop, and there is nothing that anyone can do at the moment.

With the growing adoption of Android Lollipop, I would just like to make this knowledge known in the hopes of avoiding angry users who do not understand why they can no longer use Power Manager or other related applications to toggle the mobile data of their device any longer. If you boot up one day to find Lollipop on your phone, and Power Manager no longer works to toggle data, please understand that I am powerless to do anything about it.

*Technically, there are system-accessible methods which do exist to change the state of mobile data, however, they are unusable by normal applications. See Android Issue tracker (78084, 81091).

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================

Ads

There's going to be a couple more Ads in applications now, unfortunately. I have added non-intrusive Ads to the places that I deemed to be the most logical, the bottom of the Activity and the bottom of the Notification. The Ad is small and you will most likely not notice it, that being said, if you WOULD notice the Ad, it would be of great help to me.

I am conflicted about adding more Ads into my application, as I myself do not like Ads, and even go so far as to run an adblocker on my own websites. I do not want to cram ads into the faces of my users, which is why I am so hesitant about additional ads in applications, so I have made sure that the ads do not distract from the actual usage of the application. I have added only one more ad to Power Manager as of this writing, which will bring the total count of ads to 1 in Home Button, 4 in Power Manager, and soon to be 4 in SoftGlow.

Buying the Pro key versions of applications will remove all traces of Ads from the application experience.

Being vigilant and ignoring them as I have done may however be more your style.

At the end of the day, it is your choice as users to use my applications, and I will fully understand if the addition of more ads to an arguably ad filled application causes backlash in my audience. If you choose to leave, please leave me a comment on the application page, and I may decide to rethink the ad usage in my applications.

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================

Tuesday, February 10, 2015

Website updates and other things

So the website is, for the time being, all white and grey.

I'm thinking of customizing the template, but seeing as this takes time, I've opted for the time being to use basically the simplest Blogger template ever. So there's that.

Also I've added tab links to a couple of pages which serve generally as place holders, but in the near future will be fleshed out to display in depth information about each and every one of my Android applications, GitHub projects, ArchLinux AUR packages, and whatever else I suppose I get my hands on.

Give 'em a click-click and make sure they go to proper, valid addresses.

More to come soon, stay tuned.

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================

Monday, February 9, 2015

Update of rather small importance

But dang it if didn't take some work.

pstate-frequency has been updated to better set your p-state frequencies.

I know.

I know.

The commits in question add support for displaying debug messages throughout operation so you know exactly what's going on behind the scenes, suppressing all non error output, and even an extreme setting which stops pstate-frequency from (hopefully) displaying any output at all. EXCEPT. For if you miss an option, you will still get that annoying option printout about invalid options.

GAH.

But anyway, lots of small changes accumulate to bring one big change in the end. Code on the dev branch ugly's up the code a bit more to reduce the number of dynamic allocations in the code from around 900 to only 500 (effectively half). That being said, pstate-frequency on even its ugliest day should still be quick, light, and robust, so these changes are more for me to not pull my own hair out.


HOPEFULLY ANDROID.

Maybe in the next couple of days.

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================

Hopefully Bugfix

The theme of this episode is hopefully.

A small update was pushed out today which hopefully fixes a crash that some users were experiencing in Power Manager and Home Button. Though the crash was vaguely defined, it should have been patched with the removal of a legacy class implementation. This being said, as the problem was only observed once on my developing device, I am unable to claim that this problem is completely fixed, only that progress has been taken towards attempting to patch it. If any problems persist in the coming days please, please, submit the crash report. It does not send any kind of identifying information to me, all I receive is the actual code that was running on the device when my application crashed. It is a great help as it not only lets me see what it going wrong, but alerts me to the fact that there is a problem present in the first place.

Submit your reports please!

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================

Tuesday, February 3, 2015

Power Profiles

Its trickier than I thought it would be, power profiles that is.

They're coming along, I hope to have them in a basic (beta) state by the next minor version release. It will most likely come with a disclaimer that while working, the feature is not very tested and may cause some problems. As such, for the first couple of releases, please utilize this feature at your own risk.

Other updates include more performance, and a fix for a crash that seldom occurred but was very annoying for some users.

SoftGlow is getting a slight UI makeover, and progress on the game is coming along. I'm going to be using libgdx to program the game, so I'll see how that goes as it progresses.

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: http://pyamsoft-official.blogspot.com/

Check out my Android Applications
Check out my Github Repositories
Check out my AUR packages

Follow my FaceBook Page
Follow my Google+ Page
=========================