profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/ggfan/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

android/sunflower 13545

A gardening app illustrating Android development best practices with Android Jetpack.

ggfan/android-vulkan-tutorials 4

A set of samples to illustrate Vulkan API on Android

ggfan/hello-cdep 1

lib repo for Android-NDK hello-cdep sample

android-gsi/pie-gsi-builds 0

Builds from Pie-GSI

android-gsi/tools 0

Tools to use GSI

issue commentandroid/architecture-components-samples

Same model for both Retrofit and Room

Hi,

I had the same problem and I found the solution in a Google public course:

https://classroom.udacity.com/courses/ud9012/lessons/c5e4185e-3e76-47fb-962e-ba27c21d36d7/concepts/bcacb6d3-d2d9-478b-ab68-2468e0ac22f7

Actually they recommend to have three kind of models (with extension methods to convert them) to achive entity decoupling:

  • Network Models: mapping your network JSONs to Kotlin objects
  • Database Models mapping your database data to Kotlin objects:
  • Domain Models: the ones you will use in your application logic

hope this will help someone

kazemihabib

comment created time in 18 minutes

issue commentandroid/user-interface-samples

WindowInsetsAnimation message holder translates higher than keyboard height

Stepping back: would you mind pseudo-coding/sketching out the layout? If you'd prefer to chat over email, feel free to email me: <username> at google.com

tinder-levonpetrosyan

comment created time in 2 hours

issue commentplaygameservices/play-games-plugin-for-unity

Resolving Android Dependencies Freezes and Fails

Here's the solution that worked for me Capture

check both the checkboxes I checked under Build Tab.

Sorgon

comment created time in 2 hours

PR opened googlecodelabs/android-room-with-a-view

Fix InstantiationException

java.lang.Class<com.example.android.roomwordssample.WordViewModel> has no zero argument constructor

+3 -1

0 comment

1 changed file

pr created time in 3 hours

issue commentandroid/ndk

[BUG] Global static C++ class instances' constructors are not called in static executables

If I interleave non-bitcode and bitcode input object files, then gold seems to insert its LTO object file at the first bitcode input file. (I don't know where in gold this logic is implemented.)

CC=/x/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang
echo 'void FUNC() {}' >test.c
$CC test.c -c -o test1.o -DFUNC=func1
$CC test.c -c -o test2.o -DFUNC=func2
$CC test.c -c -o test3.o -DFUNC=func3 -flto
$CC test.c -c -o test4.o -DFUNC=func4
$CC test.c -c -o test5.o -DFUNC=func5
$CC test.c -c -o test6.o -DFUNC=func6 -flto
$CC test.c -c -o test7.o -DFUNC=func7
$CC test.c -c -o test8.o -DFUNC=func8
$CC -flto -fuse-ld=gold -O2 -Wl,-Map,a.map -fpic -shared test[12345678].o
cat a.map

layout of .text:

.text           0x0000000000000640       0x5c
 .text          0x0000000000000640       0x3c /x/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/21/crtbegin_so.o
                0x0000000000000654                __atexit_handler_wrapper
                0x000000000000064c                __emutls_unregister_key
                0x0000000000000660                atexit
 .text          0x000000000000067c        0x4 test1.o
                0x000000000000067c                func1
 .text          0x0000000000000680        0x4 test2.o
                0x0000000000000680                func2
 .text          0x0000000000000684        0x0 /tmp/lto-llvm-c4c213.o
 .text.func3    0x0000000000000684        0x4 /tmp/lto-llvm-c4c213.o
                0x0000000000000684                func3
 .text.func6    0x0000000000000688        0x4 /tmp/lto-llvm-c4c213.o
                0x0000000000000688                func6
 .text          0x000000000000068c        0x4 test4.o
                0x000000000000068c                func4
 .text          0x0000000000000690        0x4 test5.o
                0x0000000000000690                func5
 .text          0x0000000000000694        0x4 test7.o
                0x0000000000000694                func7
 .text          0x0000000000000698        0x4 test8.o
                0x0000000000000698                func8
 .text          0x000000000000069c        0x0 /x/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/21/crtend_so.o

I see .init and .fini terminators in the glibc and musl crtn.o files, so if the LTO output has entries for those sections (e.g inline assembly?), then LTO breaks them:

$ cat >test.c <<EOF
#include <stdio.h>
void foo() { printf("foo!\n"); }
asm(".section .init,\"ax\",@progbits\ncall foo\n");
int main() {}
EOF
$ /x/clang+llvm-11.0.1-x86_64-linux-gnu-ubuntu-16.04/bin/clang test.c -O2 -fuse-ld=lld && ./a.out
foo!
$ /x/clang+llvm-11.0.1-x86_64-linux-gnu-ubuntu-16.04/bin/clang test.c -O2 -fuse-ld=lld -flto && ./a.out

The gold behavior seems better to me? (Before I tested it, I also guessed that it might use the last bitcode input.)

topjohnwu

comment created time in 3 hours

issue commentandroid/ndk

requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC

Hiding all symbols that don't need to be public is always a good idea. The linker is free to simplify relocations for hidden symbols because they cannot be interposed. You're paying for those symbols in app startup time by not doing that.

The change in the linked commit will not always work. If you encounter this error with a symbol that is part of your library's interface it will not work. If you encounter this issue with a symbol that is a part of your public interface you need a different fix (the fixes I mentioned earlier in this thread).

We're always happy to help where we can, but we can't fix code we don't have access to, and we can't offer advice without context.

love-ginger

comment created time in 5 hours

issue commentandroid/ndk

requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC

For those of you who still have the issue, take a look at this commit (google/boringssl@16e38b2).

This is what I love about github community, still manages to solve issues even when owners don't give a f. Thanks a lot @hanj73

love-ginger

comment created time in 7 hours

issue commentgoogle/oboe

Distorted audio reported only on Samsung S9/10 family of devices

Thanks for your quick and kind response @dturner! I will dig into these points today and report back to you with additional info ASAP. 👍🏻

derekleerock

comment created time in 8 hours

issue commentandroid/compose-samples

TextField is not respond to delete when keyboard is number or Chinese

Please provide more information

when I input Chinese word , key delete is not work, I can't delete the word in TextField, but it's ok in English

miaoyanrssq

comment created time in 8 hours

issue commentandroid/compose-samples

TextField is not respond to delete when keyboard is number or Chinese

when I input Chinese word , key delete is not work, I can't delete the word in TextField, but it's ok in English

miaoyanrssq

comment created time in 8 hours

issue commentandroid/views-widgets-samples

How to wrap height of Android ViewPager2 to height of current item?

package nz.co.genesisenergy.genesis.feature.billinsight

import android.view.View import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.viewpager2.widget.ViewPager2

class ViewPager2ViewHeightAnimator {

var viewPager2: ViewPager2? = null; set(value) {
    if (field != value) {
        field?.unregisterOnPageChangeCallback(onPageChangeCallback)
        field = value
        value?.registerOnPageChangeCallback(onPageChangeCallback)
    }
}

private val layoutManager: LinearLayoutManager? get() = (viewPager2?.getChildAt(0) as? RecyclerView)?.layoutManager as? LinearLayoutManager


private val onPageChangeCallback = object : ViewPager2.OnPageChangeCallback(){
    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
        super.onPageScrolled(position, positionOffset, positionOffsetPixels)
        recalculate(position, positionOffset)
    }
}

fun recalculate(position: Int, positionOffset: Float = 0f) = layoutManager?.apply {
    val leftView = findViewByPosition(position) ?: return@apply
    val rightView = findViewByPosition(position + 1)
    viewPager2?.apply {
        val leftHeight = getMeasuredViewHeightFor(leftView)
        layoutParams = layoutParams.apply {
            height = if (rightView != null) {
                val rightHeight = getMeasuredViewHeightFor(rightView)
                leftHeight + ((rightHeight - leftHeight) * positionOffset).toInt()
            } else {
                leftHeight
            }
        }
        invalidate()
    }
}

private fun getMeasuredViewHeightFor(view: View) : Int {
    val wMeasureSpec = View.MeasureSpec.makeMeasureSpec(view.width, View.MeasureSpec.EXACTLY)
    val hMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
    view.measure(wMeasureSpec, hMeasureSpec)
    return view.measuredHeight
}

}

sindicly

comment created time in 8 hours

Pull request review commentgoogle/oboe

oboe: fix possible race on close

 oboe::Result ActivityContext::start() {         dataThread = new std::thread(threadCallback, this);     } +#ifdef DEBUG_CLOSE_RACE

Done.

philburk

comment created time in 9 hours

push eventgoogle/oboe

Phil Burk

commit sha 01e8151e305fe46251f6891c4686392b015cf617

Add some comments about the DEBUG code.

view details

push time in 9 hours

pull request commentandroid/compose-samples

[Jetsnack] Update SysUi controller to provide easier theming of status/nav bars

Robot automatic. ######1

nickbutcher

comment created time in 9 hours

issue openedandroid/camera-samples

No way to mimic AVAssetWriterInput in Android

Using CameraX 1.1.0-alpha02, there is not way to minic what iOS does with respect to taking the video buffer, modifying it with CISourceOverCompositing and then use the result to feed AVAssetWriterInput (save the video output). That allows them to easily do things like add overlays to video. We have no way to do that to this day on Android.

Given that we can pass frames to ImageAnalysis, the same mechanism should be able to be done where the final output feed is generated in Android's equivalent of CISourceOverCompositing (sample code available for that many places). It looks like two of the three components already exist then. Android can pull the frame and modify it. We just need a way to use the modified frame as the replacement for the original one in the stream.

So, outputFileOptions needs to be extended to take a frame/bitmap produced by a function (overlay function...the equivalent of CISourceOverCompositing), and then use that in videoCapture.startRecording

created time in 10 hours

issue commentgoogle/oboe

LiveEffects app on Xperia 10 II generates no sound

Can we have the API to know if the mmap is supported or not, so we can put the right value to the setPerformanceMode method?

hisaha

comment created time in 10 hours

issue commentandroid/camera-samples

how to change ImageAnalysis‘fps

See here: https://stackoverflow.com/questions/57485050/how-to-increase-frame-rate-with-android-camerax-imageanalysis

daydreamnist

comment created time in 11 hours

issue commentandroid/camera-samples

Is there any way to have IMAGE_ANALYSIS and VIDEO_CAPTURE use cases at same time?

Yes. https://stackoverflow.com/questions/57485050/how-to-increase-frame-rate-with-android-camerax-imageanalysis

developer--

comment created time in 11 hours

issue commentandroid/camera-samples

Record video

@Taharo video recording is currently in preliminary stages and not officially supported -- but we are working on it! Please see this related StackOverflow question.

how is it then possible that snapchat and whatsapp and instagram use video recording services without problems?

I think he was referring to CameraX's support for it. It can be done in CameraX now though and from what I've seen, works better than Camera2 in many ways. Not everything is there though. No way to add a watermark/overlay like in iOS. No way (that I can find) to shut off audio recording. Etc.

Taharo

comment created time in 11 hours

issue commentandroid/ndk

requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC

For those of you who still have the issue, take a look at this commit (https://github.com/google/boringssl/commit/16e38b2b8f50a3d048f61d2979d5ceddacd70fc3).

love-ginger

comment created time in 11 hours

issue commentandroid/architecture-components-samples

Same model for both Retrofit and Room

I am encountering the same issue, does everyone just have two different data models one for Retrofit and one for Room?

kazemihabib

comment created time in 12 hours

issue closedandroid/ndk

NOT AN NDK BUG! READ THE TEMPLATE AND DO NOT FILE HERE!

This is the wrong bug tracker. Go to https://developer.android.com/studio/report-bugs and follow the instructions for filing an Android Studio bug.

closed time in 14 hours

Rob801130

issue openedandroid/ndk

NOT AN NDK BUG! READ THE TEMPLATE AND DO NOT FILE HERE!

This is the wrong bug tracker. Go to https://developer.android.com/studio/report-bugs and follow the instructions for filing an Android Studio bug.

created time in 14 hours

issue commentgoogle/oboe

[RhythmGame] Error Invalid packageName when running

Fixed by updating gradle and doing clean and full rebuild

dturner

comment created time in 15 hours

PR opened google/oboe

[Samples] Update gradle versions

Fixes https://github.com/google/oboe/issues/1208

+3 -3

0 comment

2 changed files

pr created time in 15 hours

issue commentandroid/ndk

requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC

If you're getting an error that tells you to recompile with PIC then you either didn't recompile everything with PIC or you have non-PIC assembler code.

love-ginger

comment created time in 15 hours

issue closedandroid/ndk

[FR] OCI Image Target

Is your feature request related to a problem? Please describe. This might be a bit out there but...

I want an easy CRI path when developing for platforms that only expose container runtimes. There seems to be a better way to go about doing this then having tens of thousands of man hours spent optimizing dockerfiles.

If I am using a LLVM frontend to create a service that runs on K8s all I am doing in my Dockerfile is starting from scratch and pulling in any dynamic libs I am depending on.

Alot of people struggle with this and end up using base images that happen to have the libs at some version.

Describe the solution you'd like I specify x86_64-unknown-linuxcri and have a container image. It pulls in the linked dependencies at runtime into the file layers.

Taking it further there is probably room for OCI runtime optimizations? Like if we scanned for sys call we could determine whether file mounts are read only.

Describe alternatives you've considered Building a container nowadays is pretty much limit to wrapping a pre-generated binary. So all work happens post-compilation. However, that's a design choice. One that makes container building very portable. You can take very far. But it is not convenient for the creator and results in sub-optimal images.

I could go frontend to frontend and make buildtools that user the buildkit api. Like so in rust:

                   OCI Crago Plugin Crate- --->Rust BuildKit-------------->Buildkit                                        
                      ^                                                             
                      |                                                             
                      |                                                             
User-----------------> Cargo--------------->OCI Image 

Additional context Inspiration for the idea: https://github.com/denzp/cargo-wharf

closed time in 15 hours

MateusAmin

issue commentandroid/ndk

[FR] OCI Image Target

Wrong repository :D

MateusAmin

comment created time in 15 hours

issue openedandroid/ndk

[FR] OCI Image Target

Is your feature request related to a problem? Please describe. This might be a bit our there but...

I want an easy CRI path when developing for platforms that only expose container runtimes. There seems to be a better way to go about doing this then having tens of thousands of man hours spent optimizing dockerfiles.

If I am using a LLVM frontend to create a service that runs on K8s all I am doing in my Dockerfile is starting from scratch and pulling in any dynamic libs I am depending on.

Alot of people struggle with this and end up using base images that happen to have the libs at some version.

Describe the solution you'd like I specify x86_64-unknown-linuxcri and have a container image. It pulls in the linked dependencies at runtime into the file layers.

Taking it further there is probably room for OCI runtime optimizations? Like if we scanned for sys call we could determine whether file mounts are read only.

Describe alternatives you've considered Building a container nowadays is pretty much limit to wrapping a pre-generated binary. So all work happens post-compilation. However, that's a design choice. One that makes container building very portable. You can take very far. But it is not convenient for the creator and results in sub-optimal images.

I could go frontend to frontend and make buildtools that user the buildkit api. Like so in rust: OCI Crago Plugin Crate- --->Rust BuildKit-------------->Buildkit
^
|
|
User-----------------> Cargo--------------->OCI Image

Additional context Inspiration for the idea: https://github.com/denzp/cargo-wharf

created time in 15 hours

issue commentgoogle/oboe

[RhythmGame] Error Invalid packageName when running

Also getting:

Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: Error loading build artifacts from: /Users/donturner/Code/workspace-android/oboe/samples/RhythmGame/build/outputs/apk/ndkExtractor/debug/output-metadata.json
dturner

comment created time in 15 hours