[android-developers] Digest for android-developers@googlegroups.com - 5 updates in 3 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    pskr <pskrtech@gmail.com> May 31 08:50PM -0700  

    My Android app need to encrypt a file so that it can decrypt and read it
    later. This should not be decrypt-able by anybody else other than the app,
    even user - in other words, it is application secret data.
     
    Following is how I am doing the encryption and decryption. This works most
    of the time, but some times for some users this is failing. It is not
    specific to a particular handset (Nexus7, Samsung, Motorola, HTC -- all
    types are reporting this issue), but not all users are experiencing it.
    Only some users occasionally.
     
    Here is the relevant code:
     
    encrypt() {
    KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
    final KeyStore.PrivateKeyEntry entry;
    if (!ks.containsAlias(CERT_ALIAS)) {
    Calendar cal = Calendar.getInstance();
    Date now = cal.getTime();
    cal.add(Calendar.YEAR, 50);
    Date end = cal.getTime();
    KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore");
    kpg.initialize(new KeyPairGeneratorSpec.Builder(getApplicationContext())
    .setAlias(CERT_ALIAS)
    .setStartDate(now)
    .setEndDate(end)
    .setSerialNumber(BigInteger.valueOf(1))
    .setSubject(new X500Principal("CN=" + CERT_ALIAS))
    .build());
    KeyPair kp = kpg.generateKeyPair();
    }
    entry = (KeyStore.PrivateKeyEntry) ks.getEntry(
    CERT_ALIAS, null);
    pub = entry.getCertificate().getPublicKey();
    // use the pub key to encrypt}
    decrypt() {
    KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
    ks.load(null);
     
    final KeyStore.PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry) ks.getEntry(
    CERT_ALIAS, null);
    PrivateKey key1 = entry.getPrivateKey();
    // use the private key to decrypt}
     
    This code sometimes throws
     
    java.lang.RuntimeException: error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long
    at com.android.org.conscrypt.NativeCrypto.ENGINE_load_private_key(Native Method)
    at com.android.org.conscrypt.OpenSSLEngine.getPrivateKeyById(OpenSSLEngine.java:66)
    at android.security.AndroidKeyStore.engineGetKey(AndroidKeyStore.java:86)
    at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:372)
    at java.security.KeyStore.getEntry(KeyStore.java:644)
     
    So I modified encrypt() to first try to get the entry and if it raises
    exception, generate new key pair.
     
    final KeyStore.PrivateKeyEntry entry = null;if (ks.containsAlias(CERT_ALIAS)) {
    try {
    entry = (KeyStore.PrivateKeyEntry) ks.getEntry(
    CERT_ALIAS, null);
    } catch (Exception e) {
    }}if (entry == null) {
    //generate new key pair}
     
     
    But even this is failing sometimes with the following exception.
     
    java.lang.IllegalStateException: could not generate key in keystore
    at android.security.AndroidKeyPairGenerator.generateKeyPair(AndroidKeyPairGenerator.java:100)
    at java.security.KeyPairGenerator$KeyPairGeneratorImpl.generateKeyPair(KeyPairGenerator.java:275)
     
     
    1. What am I doing wrong?
    2. How do I fix it/work around it?
    3. Before I generate new pair, should I delete the entry?
    (KeyStore.deleteEntry())
    4. Does this indicate the files (encrypted, wrapped secret key) are
    tampered?
    5. Does this happen on rooted devices or encrypted devices or when user
    changes lock screen PIN/ password?

     
    I posted this on Stack Overflow, but thought this might be better place
    hence posting here.
    http://stackoverflow.com/questions/23965300/android-keystore-getentry-and-generatekeypair-throw-exceptions-sometimes

     

    pskr <pskrtech@gmail.com> May 31 10:04PM -0700  

    I just tested the following
     
    - Enable Screen lock password
    - Change it to PIN
     
    Then
     
    final KeyStore.PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry) ks.getEntry(
    CERT_ALIAS, null);
     
     
    getEntry() is returning null. But, not the above exceptions.
     
    It looks like the key store entry gets deleted when user changes screen
    lock password or PIN. Since this is application secret and not user
    related, I wonder why?
    Is there a way to not get affected by user security settings?

     

    pskr <pskrtech@gmail.com> May 31 07:46PM -0700  

    Hi,
    I am using AndroidKeyStore to generate RSA key pair, using which I
    encrypt and decrypt some app specific data. It works most of the time, but
    for some users the *getEntry*() and *generateKeyPair*() are generating
    exceptions. I posted the question on Stack Overflow with details.
     
    http://stackoverflow.com/questions/23965300/android-keystore-getentry-and-generatekeypair-throw-exceptions-sometimes
     
    What could be the reason?
     
    - Does that indicate these users are trying to tamper with the encrypted
    files/ secret key?
    - Does it happen if the device is rooted? I asked some users and they
    said their phone is not rooted.
     
    How do I fix this problem? Please help!

     

    dashman <erjdriver@gmail.com> May 31 08:35AM -0700  

    Thanks.
     
    I'd like my custom preference style to look similar to the built-in ones.
     
    How can I find out about the text styles for the title, sub-title
    background color etc.
     
    Thanks.
     
     
    On Friday, May 30, 2014 6:57:09 PM UTC-4, TreKing wrote:

     

    Kostya Vasilyev <kmansoft@gmail.com> May 31 08:43PM +0400  

    I highly recommend looking in the android-sdk directory under
    "platforms/platform-N/data/res". This is where you can find the layouts /
    styles / etc. used by the platform itself.
     
    I find styles.xml, themes.xml and attrs.xml to be the most useful. Many of
    those styles / attributes / layouts can be referenced from applications.
     
    -- K
     
     
     

     

[android-developers] Digest for android-developers@googlegroups.com - 4 updates in 3 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    dashman <erjdriver@gmail.com> May 30 03:17PM -0700  

    Is it possible to create a custom layout entry/row
     
    - i'd like a togglebutton + an imagebutton on the same preference row.

     

    uud ashr <uudashr@gmail.com> May 30 07:59PM +0700  

    If you are not using compatibility library, please use
    *android:showAsAction* instead of app:showAsAction
     
     

     

    John A <jmoon5ftm@gmail.com> May 30 01:53AM -0700  

    My app receives access to a URI through FLAG_GRANT_READ_URI_PERMISSION |
    FLAG_GRANT_WRITE_URI_PERMISSION | FLAG_GRANT_PERSISTABLE_URI_PERMISSION. It
    then delegates this access to another app using these same flags.
     
    Is it possible for my app to later revoke those permissions it delegated?
     
    Looking for related API's, I found:
     
    ContentResolver.releasePersistableUriPermission - must be called by app
    that holds the permission
    Context.revokeUriPermission - not granular enough, and must be called by an
    app that has global write access to the content provider
     
    Is there anything I'm missing?

     

[android-developers] Digest for android-developers@googlegroups.com - 2 updates in 2 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    TreKing <trekingapp@gmail.com> May 29 09:26AM -0500  

    On Wed, May 28, 2014 at 10:33 PM, 'Mike Portnoy' via Android Developers <
     
    > Playstation controllers, Is this allowed?
     
    That is a question for a lawyer.
     
     
    > By the way, I created my own controller graphics it's just that I'm
    > following the Playstation controllers cross, square, triangle and cross.
     
    If you already created your own controller graphics, why not use make your
    own button icons as well?
     
    -------------------------------------------------------------------------------------------------
    TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
    transit tracking app for Android-powered devices

     

    Ed Harned <edharned@gmail.com> May 29 06:10AM -0700  

    igor:
     
    Absolutely. I know there are quad-core machines out there but the logic
    behind the answer is still the same. I'm not even sure Android supports
    Java7. The current F/J framework is designed for massive memory processing
    of DAG structures. What possible use is that on a phone?
     
    ed
     
    On Wednesday, May 28, 2014 3:55:45 PM UTC-4, igor ganapolsky wrote:

     

[android-developers] Digest for android-developers@googlegroups.com - 6 updates in 5 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    Mike Portnoy <mportnoy555@yahoo.com> May 28 08:33PM -0700  

    Please help me guys, I'm currently developing a game which uses
    touch based controllers, the problems are the controller I am using are
    based on shapes of the Playstation controllers, Is this allowed?
    By the way, I created my own controller graphics it's just that I'm following the Playstation controllers  cross, square, triangle and cross.
     
     
     
    Thanks!

     

    igor ganapolsky <eazyigz@gmail.com> May 28 12:54PM -0700  

    Being that your link is 3 years old, is it still relevant to today's Android development landscape?

     

    igor ganapolsky <eazyigz@gmail.com> May 28 12:55PM -0700  

    Ed,
    Being that your link is 3 years old, is it still relevant to today's Android development landscape?

     

    Streets Of Boston <flyingdutchie@gmail.com> May 28 07:06AM -0700  

    Be sure to call 'destroy()' on your Renderscript rs variable when you're
    done with it (just before the 'return bm' statement).
    It wouldn't hurt to call 'destroy()' on the 'input' and 'ouput' variables
    as well when you're done with it.
     
    Try that and see if this fixes your problem.
     
    On Tuesday, May 20, 2014 3:07:21 PM UTC-4, Sheng-Dean wrote:

     

    Kevin Kovach <kovach@gmail.com> May 28 06:32AM -0700  

    Thanks. This works and I believe is much closer to what I was hoping for.
     
    I guess my next/final question is, isn't there a way that you can use
    styles to tint all of the icons in the action bar? We have an app that we
    want to allow customers style, and would like to allow them to change the
    color on all icons including options menu icons in the action bar? We want
    to do this as a group. Not individually.
     
    Thanks again.
     
    - Kevin
     
     
    On Friday, May 23, 2014 7:46:50 PM UTC-4, b0b wrote:

     

    Terry <terboel@gmail.com> May 28 12:43AM -0700  

    What do you mean by saying thet "the video you linked to is pretty
    offensive."
     
    https://www.youtube.com/watch?v=0MXUO0-lhbY
     
    - are *you *offended by the video?
    - is the video offensive because someone may call the app that is shown a
    "PUA"?
    - is the video offensive because someone may NOT call it a "PUA"?
    - is the video offensive because it shows that e.g. a Sophos antivirus app
    may be used for spying purposes?
    (I guess that you know that *anti-spy* apps list it - and most other
    anti-virus apps with anti-theft features - as a potential spy app?)
     
    Terry
     
     
     
     
     
    On Tuesday, May 27, 2014 4:04:50 PM UTC+2, Kristopher Micinski wrote:

     

[android-developers] Digest for android-developers@googlegroups.com - 5 updates in 4 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    "Chang Sheng-Dean 章聖典" <littledot5566@gmail.com> May 27 02:04PM -0700  

    Hi Harri,
     
    Thanks so much for your input! I will surely try that!
     
    It was extremely hard for me to debug this issue because the the exception
    was intermittent even when I called it two times in a row, it only happened
    twice and I could never reproduce it again, so for me, it was rather hard
    to test.
     
    I am curious and at awe at your over-the-air support, how did you know I
    was calling it more than once?
     
    Thanks again!
     
     
     
    --
    Thank you for your time.
     
    Yours truly,
    Sheng-Dean Chang 章聖典
    (s39chang@uwaterloo.ca, littledot5566@gmail.com)

     

    Simon Giddings <mr.s.giddings@gmail.com> May 27 10:04AM -0700  

    I have just purchased and received my Samsung Galaxy Tab Pro 10.1 tablet
    (Android 4.4.2).
    Just got over the panic of not seeing the developer options in settings =
    had to tap 7 times on the version number to get this displayed.
     
    Now, I have started a debug session to install my app for continuing
    development.
    I need to add data files to the installation location, but when I go into
    DDMS file explorer, it refuses to open the /data directory.
    Is there a way of opening this, somehow ?
     
    The file permissions are : drwxrwx--x
    I presume that I will need to change it to drwxrwxrwx ?
     
    Is this right ?

     

    Terry <terboel@gmail.com> May 27 01:45AM -0700  

    Most of the past two months I have spent trying to get various publishers
    of antivirus software and apps to remove my app from their lists of
    malware. Which was much harder than I thought it would be. Execpt for a few
    apps, the lists of malware seem to be more based on hear-say than facts.
    And when an antivirus software had got a "malicious" app on its list in the
    first place, it would not let it go without a fight. It seemed as if some
    publishers of antivirus apps were saying that "we have made up out mind, so
    don't confuse us with facts". As a representative of AVG wrote to me: "In
    any case we are not removing the detection for this app".
     
    Anyway; I finally got most of the antivirus apps that once had listed my
    app as malware to remove it from their list of malware.
     
    Of the antivirus apps/softwares that once listed my app as a threat on
    VirusTotal, the following have now removed it from their list of threats:
     
    - AhnLab
     
    - AntiVir
     
    - Baidu-International
     
    - BitDefender
     
    - Eset
     
    - ForeSafe (removed it from their Android App, is not included on
    VirusTotal)
     
    - Ikarus
     
    - Qihuu-360
     
    - QuickHeal (removed it from their Android App, is not included on
    VirusTotal)
     
    - Trustlook (removed it from their "Antivurs Security" Android App, not
    included on VirusTotal)
     
    - Vipre
     
    Please see:
     
    https://www.virustotal.com/en/file/6346c6f089551b8d3de3ef80d44134dcbc1fb3dc5e7d1df44a0b19a6bba490cc/analysis/1400573103/
     
    Of those AntiVirus softwares that still list my app on VirusTotal;
     
    - Avast has changed its characterization from a Trojan to a PUP
     
    - Kaspersky lists it as a PUP ("not-a-virus")
     
    - Sophos say they "cannot remove it, as it is a PUA"
     
    - Gdata does not list it as a threat in their Android "Internet Security"
    app, but still does on VirusTotal
     
    - Avast and McAfee have still not responded to my removal requests
     
    - McAfee does currently not list in on their Android antivirus app
     
    So; Currently no antivirus app lists it as a VIRUS, but THREE (of 53) show
    an unclear characterization.
     
    If the listings of my app being a PUP/PUA refers to the possibility to
    abuse such an Anti-Theft app to get to location of the user of the phone,
    ALL Anti-Theft have the same features – and much more. Inclusive most of
    the antivirus apps themselves. E.g. see
     
    https://www.youtube.com/watch?v=0MXUO0-lhbY
     
    And all of those apps have NOT been removed.
     
    With this documentation, I wrote an email to Google Play Support., with an
    appeal to reinstate my app. I also went through all of its features in
    detail, showing that it must be the most innocent of all anti-theft apps.
     
    As my app is neither a virus nor a spy app, I assumed that it was removed
    by a mistake, and so I hoped that it would be reinstated.
     
    But Google did not even bother to send me a reply.
     
    A few years back I was very enthusiastic about Android apps and Google. Not
    any more. I am extremely disappointed with Google. They seem to handle us
    app developers extremely haphazard, badly, and unfairly. Regarding their
    Policies for developers, Google is both acting as lawmaker, police,
    prosecuting authority, judge and executioner.
     
    Needless to say, I am not very fond of Google any more.
     
    I hope that someone within Google is reading this, and who is willing to
    look into this case. I can provide all info required, including the source
    code of the app in question.
     
    Terry
     

     

     

     

     

     

     

     

     

     

     
    On Tuesday, March 11, 2014 7:24:58 AM UTC+1, Terry wrote:

     

    Kristopher Micinski <krismicinski@gmail.com> May 27 09:55AM -0400  

    FYI the video you linked to is pretty offensive...
     
    Kris
     
     

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[android-developers] Digest for android-developers@googlegroups.com - 5 updates in 3 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    dashman <erjdriver@gmail.com> May 26 12:00PM -0700  

    I've decided to write my app API 11 (Honeycomb) or later.
     
    So I don't need the support library.
     
    In my activity, I have an ActionBar - getActionBar() returns an object.
     
    The activity style is derived from Theme.Holo.
     
    But I don't see the 3 vertical dots for the menu on the right side.
     
    If I use the support library - I do get that.
     
    How do I get the 3 vert. dots for the menu.
     
    Thanks.

     

    uud ashr <uudashr@gmail.com> May 27 09:13AM +0700  

    How did you write the menu.xml?

     

    TreKing <trekingapp@gmail.com> May 26 10:54PM -0500  


    > I've decided to write my app API 11 (Honeycomb) or later.
     
    > So I don't need the support library.
     
    You'd be surprised at how much was added after 11 that was back-ported to
    the support library.
     
    So maybe *as of now* you don't need it, but you likely will find some use
    for it in the future.
     
    In my activity, I have an ActionBar - getActionBar() returns an object.
     
    > But I don't see the 3 vertical dots for the menu on the right side.
     
    > If I use the support library - I do get that.
     
    > How do I get the 3 vert. dots for the menu.
     
    Just use the support library. Or try bumping up your minSDK one notch at a
    time - I'll bet it works at some higher level.
     
    -------------------------------------------------------------------------------------------------
    TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
    transit tracking app for Android-powered devices

     

    Jeremy Dagorn <jeremy.dagorn@gmail.com> May 26 02:49PM -0700  

    Hi,
     
    I am trying to use MonkeyRunner to login on my virtual device with my gmail
    address.
    The issue is that the app closes when clicking on the New button in the
    google store app.
     
    I am using Genymotion as an emulator.
     
    Here is my script:
    https://gist.github.com/jrm2k6/1b7596379c76203c9ff3/aed6bd3221f6f69b63eb915caf6db7c0fceae9f0
     
    I have also a logcat, but I didn't see anything really helpful in it:
     
    https://gist.github.com/jrm2k6/b95e4bbb353c314bb186
     
    I don't really know where to look.
    I have several ideas:
    - could it be because I am trying to monkey test an app which is not mine?
    but a google app?
    - could it be Genymotion handling incorrectly clicks? (typing seems to be
    ok, it is when it tries to go to the next intent that it fails)
     
    Thanks!
    Jeremy

     

    Harri Smatt <harism@gmail.com> May 26 07:21PM +0300  

    Hello,
     
    In that case it *might* help if you create RS context and script intrinsic
    blur *only once* and call invoke as many times you need to.
     
    If recreating RS context and/script is the cause, it is something you could
    test rather easily since the crash would happen on second call to your blur
    method.
     
    --
    H
    On May 25, 2014 10:43 AM, "Chang Sheng-Dean 章聖典" <littledot5566@gmail.com>
    wrote:
     

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[android-developers] Digest for android-developers@googlegroups.com - 3 updates in 3 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    "Chang Sheng-Dean 章聖典" <littledot5566@gmail.com> May 25 12:40AM -0700  

    I call this method two consecutive times because I needed a blur radius of
    40px, but the SDK limitation was only 25px, so I thought I would just blur
    it twice with 20px.
     
     
     
    --
    Thank you for your time.
     
    Yours truly,
    Sheng-Dean Chang 章聖典
    (s39chang@uwaterloo.ca, littledot5566@gmail.com)

     

    12169 <ashish.acet@gmail.com> May 25 12:10AM -0700  

    Hi,
     
    I want to make an application which has some ui template and in each
    template user can change the icon and text messages and after it there is a
    button on the bottom of the application that will generate the apk of the
    that template. i want to get some guidence on this topic.

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[android-developers] Digest for android-developers@googlegroups.com - 6 updates in 2 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    dashman <erjdriver@gmail.com> May 24 06:30AM -0700  

    I've got a service that I'd like to be active in the background.
     
    But when I delete the associated app from the Android recently used
    list - it kills the service also. I assume because it's running in the
    same process. Though I do not get the service.onDestroy() call.
     
    Any way to prevent this.
     
    In the main activity onCreate()
     
    I call startService(). I want it to start the service if it's not already
    started. Then I bind to it.
     
    In the service, I return onStartCommand() with START_STICKY
     
     
    So shouldn't the service not be killed with the above setup.

     

    dashman <erjdriver@gmail.com> May 24 06:58AM -0700  

    Some additional info...after remove the app from the Recents list...
     
    I went to the Android app running page and the service IS running/active.
     
    The problem is next time I start the main activity/app, in the onCreate()
    method I'm calling startService() and that seems to be recreating the
    service.

     

    dashman <erjdriver@gmail.com> May 24 09:10AM -0700  

    Yes I did look at that.
     
    I chose to implement the MessengerService example because I want
    the main activity to receive messages from the service also.
     
    I believe the implementation is exactlly the same.
     
    In the main activity onCreate(), I have
     
    startService( new Intent( this, MainService.class) );
     
    doBindService();
     
     
     
    So when I kill the main app (remove from the recently used list),
    that leaves the service running.
     
    But when I restart the app (by clicking on the icon) - it seems to
    re-create the service.
     
    Not sure why that's happening - because it was running.
     
    Would a startForeground() in the service help?

     

    dashman <erjdriver@gmail.com> May 24 09:34AM -0700  

    calling startForeground() seems to have done the trick.

     

    Trevor <trevg60@gmail.com> May 24 08:22AM -0700  

    Hello,
     
    Through ACRA, I have received a small number of reports from an alpha build
    of software that show that an exception is occurring during a specific call
    to Canvas.restore(). The exception is java.lang.IllegalStateException:
    Underflow in restore.
     
    I am well aware that this exception shall occur if one too many restore()
    calls are made than save() calls. However, from very careful code
    inspection, I am absolutely certain that all calls to canvas.save() and
    canvas.restore() are balanced. That is, all calls to canvas.save() are most
    certainly balanced at a later stage by a call to canvas.restore(). I can
    also confirm that there are no conditionals, exceptions or early returns
    from methods that could result in a missing canvas.save() leading to the
    stack underflow.
     
    Furthermore, this issue seems to be a rare edge-case that is resulting in
    the exception happening only a handful of times within graphics code that
    renders many times every second.
     
    The sort of structure of the code in which this is happening is:
     
     
    protected void onDraw(Canvas canvas) {
    ...
    someMethod(canvas);
    ...
    }
     
    void someMethod(Canvas canvas)
    {
    ....
    canvas.save();
    ....
    someOtherMethod(Canvas canvas);
    ....
    canvas.restore();
    ....
    }
     
    void someOtherMethod(Canvas canvas)
    {
     
    ....
    canvas.save();
    ....
    for ( ... ) {

    ....
    canvas.save();
    ...
    canvas.restore();
    ...
    }
    ....
    canvas.restore(); // *** exception here ***
    ....
    }
     
     
    There are places where save() / restore() is used within a loop, but again
    the calls are balanced.
     
    The reports are from devices running 4.3 and 4.4.2.
     
    I have attempted to Google this issue and the only interesting QA I could
    find (on Stackoverflow) was from a person who clearly had unbalanced save()
    / restore() calls in his code; that is categorically not the issue in my
    case.
     
    This is occurring within the call stack of a custom View subclass'
    onDraw(Canvas canvas) method, all happening on the UI thread. There are no
    other threads I have touching that Canvas object.
     
    I could potentially check the stack with a call to getSaveCount() before
    invoking the specific restore() that has been responsible for the
    exceptions, but that would really be just sticking an Elastoplast over the
    problem. I'd rather understand what on earth the edge case is that's
    causing the underflow, but it is baffling me.
     
    Are there any known issues? Could it be possible for any kind of system
    configuration change to affect this Canvas while the UI thread is within
    the context of a View's onDraw() call? Are there any known limitations on
    the Canvas stack size? Could there be any OS graphics calls that are known
    to misuse the canvas stack?
     
     
    Thanks,
     
     
    Trev

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[android-developers] Digest for android-developers@googlegroups.com - 12 updates in 6 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    Kevin Kovach <kovach@gmail.com> May 23 10:03AM -0700  

    Yes, I'm currently using this class. The problem is that it loads a
    drawable, which I do not know how to apply a tint to. There could be
    something that I'm missing, but I've not found a way yet.
     
    - Kevin
     
    On Thursday, May 22, 2014 5:51:39 PM UTC-4, Kostya Vasilyev wrote:

     

    Kostya Vasilyev <kmansoft@gmail.com> May 23 09:20PM +0400  

    You'll need to copy the source code for ActionBarDrawerToggle.java into
    your project, possibly renaming (I forget if it somehow gets wired into the
    action bar automagically or has to be done from application code).
     
    Make changes to how the constructor initializes mDrawerImage, applying
    color tint.
     
    PS - I highly recommend this Chrome extension to look up Android source
    code:
     
    https://chrome.google.com/webstore/detail/android-sdk-search/hgcbffeicehlpmgmnhnkjbjoldkfhoin
     
    -- K
     
     
     

     

    b0b <pujos.michael@gmail.com> May 23 04:46PM -0700  

    If you don't want to copy / modify classes:
     
     
    private void setActionBarUpTint(int color) {
     
    int upId = getResources().getIdentifier("android:id/up", null,
    null);
    if(upId == 0) return ;
     
    View view = getWindow().getDecorView().findViewById(upId);
    if(!(view instanceof ImageView)) return ;

    ImageView imageView = (ImageView) view;
    imageView.setColorFilter(color);
    }

     

    plnelson <pnartg@gmail.com> May 23 01:05PM -0700  

    On Wednesday, May 21, 2014 12:23:32 PM UTC-4, Kostya Vasilyev wrote:
     
    > Is there more to the message? I grepped the "base" framework, and came up
    > with these:
     
    The entire message is "CalledFromWrongThreadException: Only the original
    thread that created a view hierarchy can touch its views"
     
    And it's widely discussed on places like Stack Overflow but the focus of
    the dicscussions is always on fixing the bug, whereas I'm posting this to
    the Google group instead of Stack Overflo0w because I want to *understand*what it actually
    *means*. What do they mean by "the wrong thread"? If the same thread
    (based on the debugger and trace) is accessing it when it generates the
    exception and when it doesn't, how does that thread become the "wrong"
    thread? Where does Google document its exceptions?
     
    *And what does the Eclipse debugger thread nomenclature ( "Thread x[
    Thread-y]" ) mean?*
     
    > The Eclipse debugger seems to refer to a thread 9 and a thread 10. What
    >> does the debugger mean when it displays it that way?
     
    > They're just thread ids (the "x") and auto-generated thread names.
     
    Yes, I know, but why are there *two* of them on one line? That's my
    question. Normally I see one TID per line, so what is Eclipse telling us
    when it uses *"Thread x[ Thread-y]" syntax?*
     

     

    Kostya Vasilyev <kmansoft@gmail.com> May 24 02:00AM +0400  

    > thread that created a view hierarchy can touch its views"
     
    > And it's widely discussed on places like Stack Overflow but the focus of
    > the dicscussions is always on fixing the bug,
     
    Fixing the bug should ultimately be your goal, no?
     
     
    > whereas I'm posting this to the Google group instead of Stack Overflo0w
    > because I want to *understand* what it actually *means*. What do they
    > mean by "the wrong thread"?
     
    The "view hierarchy" should only be touched from the UI thread that's
    created for you by Android (labeled "main" thread in Eclipse).
     
    Now, some view methods may have checks for this, and some may not (in fact,
    the vast majority does not).
     
     
    > If the same thread (based on the debugger and trace) is accessing it when
    > it generates the exception and when it doesn't, how does that thread become
    > the "wrong" thread? Where does Google document its exceptions?
     
    http://developer.android.com/guide/components/processes-and-threads.html
     
    Additionally, the Andoid UI toolkit is *not* thread-safe. So, you must not
    manipulate your UI from a worker thread—you must do all manipulation to
    your user interface from the UI thread. Thus, there are simply two rules to
    Android's single thread model:
     
    1. Do not block the UI thread
    2. Do not access the Android UI toolkit from outside the UI thread
     
     
     
     
    > Yes, I know, but why are there *two* of them on one line? That's my
    > question. Normally I see one TID per line, so what is Eclipse telling us
    > when it uses *"Thread x[ Thread-y]" syntax?*
     
    I really don't know. Looks like the name is assigned based on thread id,
    but does not use the thread id directly -- maybe some little piece of code
    with own counter, etc.
     
    But if this discussion is to be focused on "only the original thread can
    touch the view hierarchy" -- you should not be touching views from any
    thread other than the main UI thread, and that one is clearly labeled in
    Eclipse as "Thread [<1> main]".
     
    Hope I didn't make it completely nonsensical.
     
    -- K

     

    Anton Persson <don.juanton@gmail.com> May 23 09:23AM +0200  

    Hi,
     
    I am experimenting with the OpenGL ES on my Nexus 5 device. I have noticed
    however that when I create a GLSurfaceView the resolution is not the full
    native resolution.
     
    Is there a way to enable the use of full native resolution graphics with
    OpenGL ES on Android, instead of rendering at low resolution and upscaling
    which seems to be the default?
     
    Best Regards
    Anton

     

    Harri Smatt <harism@gmail.com> May 23 10:59PM +0300  

    Whoops,
     
    It was supposed to read Renderer.onSurfaceChanged instead..
     
    --
    H

     

    Harri Smatt <harism@gmail.com> May 23 10:56PM +0300  

    Hi,
     
    Interesting. What OpenGL context size are you seeing in
    Renderer.onSurfaceCreated method then?
     
    --
    H

     

    Anton Persson <don.juanton@gmail.com> May 23 11:03PM +0200  

    Hi Harri,
     
    thanks for the interest. It seems though that I was mistaken. There is
    something wrong with my project. I verified that the standard OpenGL ES 2
    example included in the NDK works fine with the native resolution. I yet
    don't understand exactly where, but it's clear the fault is in my project
    and nowhere else.
     
    Best Regards
    Anton
     
     
     
     

     

    Harri Smatt <harism@gmail.com> May 23 11:18PM +0300  

    Hi,
     
    How frequently do you call this method? I mean, you re-create both
    RenderScript and IntrinsicBlur objects on every call. And I am wondering
    how the underlying native implementation copes with this if the method is
    called twice or more within short a period.
     
    --
    H

     

    Harri Smatt <harism@gmail.com> May 23 11:08PM +0300  

    Hi,
     
    It was long ago I did search and verify various websocket libraries
    available back then for my needs. Autobahn was one of them and they seem to
    have Android support too these days.
     
    http://autobahn.ws
     
    Hope this helps.
     
    --
    H
    On May 21, 2014 7:56 AM, "android developer" <

     

    Simon Giddings <mr.s.giddings@gmail.com> May 23 04:52AM -0700  

    My app will receive input from external bluetooth devices.
    I want to be able to let the user configure the application according to
    the paired device present.
     
    The obvious place for this is within the shared preference activity.
    As I am only targeting tablets for this, I was wanting to take advantage of
    the side-by-side display as shown here =>
     
     
    So, the right hand screen (2) will need to permit the selection of the
    supported device, display a picture of it and permit the configuring of
    relevant parts.
     
    Should I be deriving a new class from PreferenceScreen for this ?
    If so, what do I need to do to get this form of flexibility ?
    Is there a better way ?

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[android-developers] Digest for android-developers@googlegroups.com - 5 updates in 3 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    Sheng-Dean <littledot5566@gmail.com> May 22 02:33PM -0700  

    The ViewTreeObserver class has 2 methods:
     
    removeOnGlobalLayoutListener() & removeGlobalOnLayoutListener().
     
    I went on GrepCode and diff-ed every version and couldn't find any
    functionality difference other than the name change.
     
    Is there any functionality differences between these two methods?
    Thanks!

     

    Kevin Kovach <kovach@gmail.com> May 22 01:25PM -0700  

    We're trying to theme an app that uses a navigation drawer and I want to be
    able to tint/color the icon for the navigation drawer with an @color. For
    the life of me I cannot find any information or hints on how to accomplish
    this. I would really appreciate any hints on doing this. Thanks.
     
    - Kevin

     

    Simon Giddings <mr.s.giddings@gmail.com> May 22 12:00AM -0700  

    Great Tobias,
     
    This is a great help, thank you for taking the time to put this here !
     
    On Wednesday, 21 May 2014 21:37:20 UTC+2, Tobias wrote:

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[android-developers] Digest for android-developers@googlegroups.com - 13 updates in 10 topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    Cyril <cyril.real@gmail.com> May 21 04:58PM -0700  

    Hi there !
     
    I've designed some "realistic" emulator skins for famous devices (Nexus 4,
    Galaxy S4, HTC One M8...), but now, I'm facing a problem.
    In the skin's layout file, how to handle/describe the hardware "recent
    apps" button that comes with devices like HTC One or Galaxy S5 ?
     
    I know "home" is for the home button, "soft-left" for the menu button,
    "back" for the back one... but what about recent/switch apps ?
    Ok, I could disregard this feature as a long press on home button still
    does the trick but well, it would be more elegant if the emulator could act
    fully as the actual device.
     
    Thank you !
    :-)
     
    Cyril

     

    Eric Ang <angjc3@gmail.com> May 21 03:32PM -0700  

    We definitely could and that is a discussion we are having for sure!
    Technically we can, but from a business standpoint the OEM actually
    licenses the solution. The API itself gives Android Developers access to
    that licensed solution.
     
    I am trying to come up with an offering that we can definitely include as a
    service through Google Play. So we can broaden the playing field!
     
     
    On Saturday, February 22, 2014 9:14:58 AM UTC-8, Ubuntu guy wrote:

     

    Tobias <tobias.dubois@gmail.com> May 21 12:37PM -0700  

    I found this dpi/ppi calculator to be useful: http://www.sven.de/dpi/
    It will give you the actual physical dpi. Taking this value and then
    rounding it to the closet dpi bucket
    (http://developer.android.com/reference/android/util/DisplayMetrics.html)
    would be a good bet, even though the manufacturer could choose a different
    bucket.
     
    Tobias
     
    Den onsdagen den 16:e april 2014 kl. 09:14:48 UTC+2 skrev Simon Giddings:

     

    Tobias <tobias.dubois@gmail.com> May 21 12:15PM -0700  

    Are you using TextureView? Do you see the same issue with a GLSurfaceView?
    You could also try
    using http://developer.android.com/tools/debugging/systrace.html to see if
    anything strange is going on in the system when you drop frames.
    OpenGL-wise it looks pretty simple.
     
    Tobias
     
    Den tisdagen den 15:e april 2014 kl. 06:00:24 UTC+2 skrev Dave Smith:

     

    dashman <erjdriver@gmail.com> May 21 07:37AM -0700  

    I updated to ADT 22.6.3 and having problems.
     
    On Eclipse startup getting an error message to update ADT.
     
    I read some other messages and went to eclipse install-new-software.
     
    and tried to update from https://dl-ssl.google.com/android/eclipse/
     
    When I try to update the ADT from there...
     
    I get an error message about not being able to update.
     
    requires 'org.eclipse.ui 3.7.0' but it could not be found
     
    I'm using Eclipse Helios.
     
     
    Any way to undo the ADT update to 22.6.3

     

    Marina Cuello <marina.eariel@gmail.com> May 21 11:54AM -0300  

    On your "Install new software" screen, uncheck the "Contact all update
    sites during install to find required software" and try again.
     
    Marina
     
     

     

    dashman <erjdriver@gmail.com> May 21 10:20AM -0700  

    I was using HELIOS version of eclipse.
     
    Looks like this ADT requires a more updated version.
     
    I upgraded to Kepler and then it worked.
     
     
     
    On Wednesday, May 21, 2014 10:54:58 AM UTC-4, Marina Cuello wrote:

     

    Daniele Segato <daniele.segato@gmail.com> May 21 09:36AM -0700  

    I also want to know this.
     
    Roboto apparently do not support Chinese and Japanese (Hirigana, Katawana).
     
    So which is the list of supported character sets? (unicode group, scripts,
    whatever you want to call them).
     
    And if Chinese/Japanese are actually supported: which font is used?
     
     

     

    plnelson <pnartg@gmail.com> May 21 09:02AM -0700  

    On Tuesday, May 20, 2014 11:51:35 PM UTC-4, Jonathan S wrote:
     
    > Can you copy and paste code in the *MyRemoteActivity class?*
     
    > It's 700 lines of (mostly proprietary) code, so no I don't think that
    would be practical. Anyway,* my questions are generic Android questions*;
    they're not specific to the code: I'm not asking for anyone to debug this
    for me; I'm just trying to understand more so I can debug it myself.
     
    1. * If it's the wrong thread then why does the stack trace show the same
    thread in the cases where it crashes and where it doesn't?*
    ...in other words what does Android mean by "wrong thread"? If the
    debugger shows it executing in the same thread when it's not crashing as
    when it lands in the catch block with the "wrong thread" then what exactly
    do they mean by "wrong thread"?
     
    *And what does the Eclipse debugger thread nomenclature ( "Thread x[
    Thread-y]" ) mean?*
    The Eclipse debugger seems to refer to a thread 9 and a thread 10. What
    does the debugger mean when it displays it that way?
     
    *What are some good strategies for analyzing "wrong thread" bugs? *
    Just that - what tools or strategies are recommended to see what code is
    executing in which threads - how do experienced Android programmers debug
    these kinds of exceptions?
     

     

     

    Kostya Vasilyev <kmansoft@gmail.com> May 21 08:23PM +0400  

    > debugger shows it executing in the same thread when it's not crashing as
    > when it lands in the catch block with the "wrong thread" then what exactly
    > do they mean by "wrong thread"?
     
    Is there more to the message? I grepped the "base" framework, and came up
    with these:
     
    ./core/tests/coretests/src/android/widget/focus/RequestFocusTest.java:
    // Test that a requestFocus from the wrong thread fails.
    ./core/tests/coretests/src/android/widget/focus/RequestFocusTest.java:
    fail("requestFocus from wrong thread should raise exception.");
    ./opengl/java/android/opengl/ManagedEGLContext.java: throw new
    IllegalStateException("Called on wrong thread");
    ./opengl/java/android/opengl/GLErrorWrapper.java:
    "OpenGL method called from wrong thread.");
     
    Two of these are in tests.
     
     
    > Thread-y]" ) mean?*
    > The Eclipse debugger seems to refer to a thread 9 and a thread 10. What
    > does the debugger mean when it displays it that way?
     
    They're just thread ids (the "x") and auto-generated thread names.
     
    When you debug in Eclipse, you should see other threads with more
    meaningful names, e.g. "main", "Binder_x", etc.
     
    You can assign names to your threads by calling Thread.setName. Personally,
    I find it very useful for debugging and postmortem crash reports:
     
    http://developer.android.com/reference/java/lang/Thread.html#setName(java.lang.String)
     
     
    > Just that - what tools or strategies are recommended to see what code is
    > executing in which threads - how do experienced Android programmers debug
    > these kinds of exceptions?
     
    Not sure I qualify as an "experienced" Android programmer, but...
     
    ...
     
    From your original description (I snipped it, it was below), it seems you
    have some code that runs on a worker thread, and yet is placed in a file
    called MyRemoteActivity.
     
    There is nothing wrong with naming source files anything you wish, but ---
    is that actually an Android activity?
     
    Are you sure the code in that file, that runs on a non-main thread, does
    not make any calls to Android UI code?
     
    Conversely, your code should not be making networking calls on the main
    thread. You can use StrictMode to log such events:
     
    http://developer.android.com/reference/android/os/StrictMode.html
     
    And going back to your original message again:
     
    "the other one is the main thread that handles all the usual View stuff"
     
    Do you mean the "main" Android thread that get pre-created for you, or do
    you mean there is a different thread that your code creates (and which
    you're calling "main") that interacts with the Android UI framework?
     
    You should only call Android UI framework methods from the "main" thread
    that gets pre-created for you by Android, that's the thread on which all
    component callbacks are called (onCreate, etc.).
     
    -- K

     

    Bunty syed <itsmeatforum@gmail.com> May 21 05:10AM -0700  

    Hi All,
     
    Hoping doing well..
     
    I have developed one app.
    I want to stop memory dumping for my app by attaching a debugger to it on
    runtime..
    I found one api *android.os.Debug.isDebuggerConnected*
    Above api will give true if sombody attached a debugger to my app.
    But my question here is Can I get a callback or receiver when some hacker
    attaches a debugger to my app..
     
    Thanks & regards,
    Bunty Syed

     

    Sunil K <sunilchintu2468@gmail.com> May 21 03:40PM +0530  

    Raymond,
    Any suggestions for me?
     
    Problem is alarm is set from my Activity, and the alarm is received only if
    Activity is currently running. Otherwise it will not.
     
    Regards,
    Sunil
     
     
     
    --
    Thanks & Regards
    **** Sunil *****

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.