Profile

Cover photo
Werner Dittmann
Works at Self-employed
Lived in München
53,350 views
AboutPostsPhotosVideos

Stream

Werner Dittmann

Shared publicly  - 
 
Solving some mysteries about Android's camera2 API, YUV and RGB
Recently I had to enhance an existing client to use Android's camera2 API to do video calls.  The existing implementation uses the old camera API, got the data in the YUV NV21 format, converted it to RGB and handed it over to the codec which produced the vi...
1
Add a comment...

Werner Dittmann

Shared publicly  - 
 
Recently I added the camera2 API to an existing video app and had to convert the camera's YUV data to ARGB. The new camera2 API is very different from the old API and I needed to start from scratch, more or less.

While solving the problem I found some issues with the YUV format and how to access it, in a next step I used RenderScript to speed up the image data processing and get ARGB data at full speed.

See the blog posts for more details and some example code.
1
Add a comment...

Werner Dittmann

Gradle Build System  - 
 
I have a project with an 'src/AndroidTest'  sub-directory that hosts the unit tests. It uses the standard directory structure. My test classes extend the 'AndroidTestCase' class. Thus a pretty simple setup :-) .

For some test cases I like to use some PNG image files to check graphic processing. I have a  R.drawable.my_big_image and the test case can read the PNG file using 'getContext().getResources().openRawResource(R.drawable.my_big_image ) if I store the PNG file in the normal res/drawable folder (the main project's folders).

If I store the PNG fle inside the src/AndroidTest/res/drawable the test case is not able to read the file correctly.

What's the setup to store and access PNG files for test cases only? I don't want't to have the test resources in the main project's resources. Any ideas on this?
1
Marty Glaubitz's profile photo
 
The AndroidTest dir is not a normal project dir i think - thus cannot host resourced
Add a comment...

Werner Dittmann

Gradle Build System  - 
 
+Xavier Ducrohet  - After updating to AS 0.8 and the '20' releases I get some warning in gradle.build:

productFlavors' cannot be applied to '(groovy.lang.Closure<com.android.builder.core.DefaultProductFlavor>)' 

The build as such works, for all variants. Seems like an incorrect warning.

These are the relevant parts of build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19

    ... some more definitions
   }
       productFlavors {
        devtest {
            applicationId "com.myapp.app_devtest"
        }
2
Eric Labelle's profile photoWerner Dittmann's profile photoBenson Lott's profile photoJigar Brahmbhatt's profile photo
5 comments
 
Is there any solution to this ?
Add a comment...

Werner Dittmann

Discussion  - 
 
 
In one of my projects I sub-class ImageView. AS shows a warning for the implementation of the onDraw(Canvas canvas) functions:

'Not annotated parameter overrides @NotNull parameter '

How to solve this (except by disabling the waring at all :-) )?. I've checked the onDraw functions in ImageView and View and do not see any annotations, also some info on a IntelliJ page (https://www.jetbrains.com/idea/documentation/howto.html) does not give a real answer.

Any idea?
1
Siva Velusamy's profile photoWerner Dittmann's profile photo
2 comments
 
I tried that in my sub-class, however, AS tells that it does not know about @NotNull. I suspect that I'm missing the annotation JAR or class, similar to the android.annotation.TargetApi class. What should I use here? Any configuration in AS?
Add a comment...

Werner Dittmann

Discussion  - 
 
After the update to AS 0.4.2 I noticed a few new files in the .idea/libraries directory. These files have a 'Gradle__' prefix.

- some of these files mirror already existing (similar) files. The new files seem to add 'Gradle: ' to the 'name' tag. 
- at least one file (Gradle__support_v4_19_0_0.xml) adds a local path: jar://$USER_HOME$/android-sdk-linux_86/... . M project does not use support-v4 directly, only appcompat-v7 which pulls support-v4 via the local maven repository.

Some questions:
What's the purpose of these files?
According to IntelliJ docs files in this directory should go into a VCS. However, if a files contains a local path then this is not a good idea, isn't it?
Because AS seems to add files into '.idea': which AS files should go into a VCS? 
1
Alex Ruiz's profile photoAlan Daly's profile photo
2 comments
 
+Alex Ruiz  love the fact that you link your fixes the way you do, as a novice I learn so much from seeing an issue like this from inception, to fix and see not only what happened, but why it happened and how it was fixed, thank you!
Add a comment...

Werner Dittmann

Development Patterns  - 
 
Recently I added the camera2 API to an existing video app and had to convert the camera's YUV data to ARGB.

While solving the problem I found some issues with the YUV format and how to access it, in a next step I used RenderScript to speed up the image data processing and get ARGB data at full speed.

See the blog posts for more details and some example code.
1
Werner Dittmann's profile photoTomer Hatav's profile photo
3 comments
 
Yes, exactly. I need to know how to combine all three but with the correct stride and other requirements similar to the old NV21 format
Add a comment...

Werner Dittmann

Android Studio  - 
 
+Alex Ruiz  After updating to AS 0.9.3 I get some wrong error indications. The most annoying is this:
if (!TextUtils.equals(currentDirectoryPath, oldDirectoryPath)) ...

In this case AS tells me:

Non-static method 'equals(java.lang.Object)' cannot be referenced from a static context.

The same issue here which is really strange:

notificationManager.notify(NotificationImportExportListener.FAILURE_NOTIFICATION_TAG, FAILURE_NOTIFICATION_ID,
                notification);

In this case 'notificationManager' holds Android's NotificationManager and this has a "notify" method. However, java.lang.Object also has a 'notify' method and AS takes this and issues an error because of non-matching arguments. 

I never saw this before. I closed the project, closed AS, restarted it, open the project - problem persists. What was changed in 0.9.3 to trigger this behaviour? Anything I missed to do? The build works without problems, also the application works as expected :-)

I stepped back to 0.9.2 and the problem is gone without any changes on the project files. 
1
Alex Ruiz's profile photo
 
This is a known issue ( https://code.google.com/p/android/issues/detail?id=79420 ). I couldn't reproduce it myself using the latest code (which has not been released yet) and JDKs 1.6, 1.7 and 1.8. I suspect this bug has been already fixed by +Denis Zhdanov. 
Add a comment...

Werner Dittmann

Android Studio  - 
 
+Alex Ruiz  I'm using AS 0.8.1, beta channel, and try to get some device screen shots from a connected (via USB) device. This used to work in previous versions/builds of AS. Now I get the following error message from my beloved AS:

Unexpected error while obtaining screenshot: java.lang.IllegalStateException:@NotNull method com/android/tools/idea/ddms/screenshot/DeviceArtDescriptor.getArtDescriptor must not return null

Is it a known problem? The connected devices are Nexus 4 (4.4.3) or Nexus 5 (4.4.4)
1
Alex Ruiz's profile photoTor Norbye's profile photoWerner Dittmann's profile photo
3 comments
 
Thanks. I think I can wait for 0.8.2 :-) .
Add a comment...

Werner Dittmann

Gradle Build System  - 
 
+Xavier Ducrohet 
In a project I've created build flavors and copied the manifest into the right location of the flavor directory. The idea is that gradle merges this manifest with the main manifest. Unfortunately that doesn't work. I get the error message:
'Trying to merge incompatible /manifest/application/provider'

I just try to have another android:authorities string in the manifest to avoid a provider authorities clash if I install various flavors.

I found a very old posting in Google groups (May 2013, https://groups.google.com/forum/#!msg/adt-dev/K29pY0H9vsY/MXdu0CGj6SwJ ) where Xavier said that they haven't looked into 'provider merging' but will be soon :-) .

Seems that this is not yet fixed? If I'm not mistaken it is not possible to define the provider authority otherwise because the Android PM checks this during package installation. Any ideas about this topic?
The issue I'm seeing is that our provider elements have to have unique android:authorities which we typically made the package name suffixed with the authority name. This ensures that the authorities are unique and 2 flavors of the same app can be installed side by side.
1
Xavier Ducrohet's profile photo
 
Looks like you have the same provider node in both the main manifest and the one from the flavor? Just remove the one from the main manifest. Right now we can't merge the nodes if they are not exactly the same. This is something we are now actively working on.
Add a comment...
 
In one of my projects I sub-class ImageView. AS shows a warning for the implementation of the onDraw(Canvas canvas) function:

'Not annotated parameter overrides @NotNull parameter '

How to solve this (except by disabling the waring at all :-) )?. I've checked the onDraw functions in ImageView and View and do not see any annotations, also some info on a IntelliJ page (https://www.jetbrains.com/idea/documentation/howto.html) does not give a real answer.

Any idea?
2
2
Add a comment...

Werner Dittmann

Android Studio  - 
 
Did AS 0.4.0 changed the way it calls gradle to build APK?

In my build.gradle I use this:

    buildTypes {
        debug {
        }

        develop {
            initWith debug
            signingConfig signingConfigs.sc
            zipAlign true
        }

        alpha {
            initWith release
            signingConfig signingConfigs.sc
            zipAlign true
        }
    }

and AS used to build 'debug' APK when I edited some source and load it to the device. Sine 0.4.0 AS builds the 'alpha' APK and loads it. During development I like to have the 'debug' :-) .

Where can I set / configure AS to build the 'debug' APK? I looked around in the various settings etc but did not found where to configure this. Or is this something I need to add to 'build.gradle'?
1
Scott Culverhouse (lilHermit)'s profile photoWerner Dittmann's profile photoNik Clayton's profile photo
3 comments
 
Towards the bottom left of the AS UI should be a docked "Build Variants" button.  Press it, and a panel to choose the build variant pops out.
Add a comment...
Work
Occupation
IT Consultant and Systemprogrammer
Employment
  • Self-employed
    2013 - present
    Working as IT consultant and system programmer for Linux and Android mainly in security related areas. Recently I did a lot of Android consulting and implementations.
  • Nokia Siemens Networks
    Senior Solution Architect, 2007 - 2012
  • Digital Equipment Corporation
    Senior Systemprogrammer, 1978 - 1981
  • Siemens AG
    Senior Systemprogrammer, 1986 - 2007
Basic Information
Gender
Male
Relationship
Married
Story
Introduction
Currently working on various projects, mostly security oriented projects. 

During the last years I work for Silent Circle as a freelancer and implemented an Android client for VoIP and messaging. For the VoIP part the client uses my ZRTP implementation, for the messaging part I implemented the Axolotl ratchet and some necessary support functions. Silent Circle published this implementation on their GitHub site under the Apache license.

I actively maintain my implementation of ZRTP (RFC6189) for various communication clients. GNU ZRTP comes in several flavours:
  • GNU ZRTP C++: available for GNU ccRTP (Twinkle SIP client uses this) 
  • GNU ZRTP4J: available for Java/JMF (Jitsi comminication client uses this)
  • GNU ZRTP4PJ: a C wrapper around the C++ classes, available for PJSIP/PJSUA, some clients use this, most prominent is CSipSimple for Android.
Some interest to implement cryptographic stuff, for example Skein and Threefish for Java and Google's Go language and added a simple to use C API for Skein and Threefish.

Another project I did: started the WebService Security project for Java (WSS4J) at Apache (a long time ago :-) ) together with Davanum Srinivas.
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Previously
München
Links