Tizen Native App Development - Display Sensor Data - Android Apps and Games

Could someone help me figure out how to display the gyroscope data as text on the watches screen using Native Tizen code (Tizen 3.0)?
:good:Update: I figured this out. Here is a link to download the Tizen Studio project:
https://drive.google.com/file/d/1izEePFnpUAww7Li7RdlyNxX85_1Mso3n/view?usp=sharing
Should this download link get removed at some point in the future here is the code:
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////SOURCE (.c) FILE///////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
#include <sensor.h>
#include <stdbool.h>
#include <dlog.h> // for logging purposes
//Define objects to appear on screen
Evas_Object *GLOBAL_DEBUG_BOX;
Evas_Object *start, *stop;
Evas_Object *conform;
sensor_listener_h listener;
Evas_Object *event_label;
Evas_Object *GLOBAL_DEBUG_BOX;
Evas_Object *start, *stop;
Evas_Object *conform;
sensor_listener_h listener;
Evas_Object *event_label;
void on_sensor_event(sensor_h sensor, sensor_event_s *event, void *user_data)
{
// Select a specific sensor with a sensor handle
sensor_type_e type;
sensor_get_type(sensor, &type);
switch (type) {
case SENSOR_GYROSCOPE:
dlog_print(DLOG_INFO, LOG_TAG, "%d" , event->values[0], event->values[1], event->values[2]);
char a[100];
sprintf(a,"X:%.2f Y:%.2f Z:%.2f", event->values[0], event->values[1], event->values[2]);
elm_object_text_set(event_label, a);
break;
default:
dlog_print(DLOG_ERROR, LOG_TAG, "Not a gyroscope event");
}
}
void _sensor_accuracy_changed_cb(sensor_h sensor, unsigned long long timestamp,
sensor_data_accuracy_e accuracy, void *data)
{
dlog_print(DLOG_DEBUG, LOG_TAG, "Sensor accuracy change callback invoked");
}
void _sensor_start_cb(void *data, Evas_Object *obj, void *event_info)
{
void *user_data = NULL;
char out[100];
// Retrieving a Sensor
sensor_type_e type = SENSOR_GYROSCOPE;
sensor_h sensor;
bool supported;
int error = sensor_is_supported(type, &supported);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_is_supported error: %d", error);
return;
}
if(supported)
{
dlog_print(DLOG_DEBUG, LOG_TAG, "Gyroscope is%s supported", supported ? "" : " not");
sprintf(out,"Gyroscope is%s supported", supported ? "" : " not");
elm_object_text_set(event_label, out);
}
// Get sensor list
int count;
sensor_h *list;
error = sensor_get_sensor_list(type, &list, &count);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_get_sensor_list error: %d", error);
} else {
dlog_print(DLOG_DEBUG, LOG_TAG, "Number of sensors: %d", count);
free(list);
}
error = sensor_get_default_sensor(type, &sensor);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_get_default_sensor error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "sensor_get_default_sensor");
// Registering a Sensor Event
error = sensor_create_listener(sensor, &listener);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_create_listener error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "sensor_create_listener");
int min_interval = 0;
error = sensor_get_min_interval(sensor, &min_interval);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_get_min_interval error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "Minimum interval of the sensor: %d", min_interval);
// Callback for sensor value change
error = sensor_listener_set_event_cb(listener, min_interval, on_sensor_event, user_data);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_listener_set_event_cb error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "sensor_listener_set_event_cb");
// Registering the Accuracy Changed Callback
error = sensor_listener_set_accuracy_cb(listener, _sensor_accuracy_changed_cb, user_data);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_listener_set_accuracy_cb error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "sensor_listener_set_accuracy_cb");
error = sensor_listener_set_interval(listener, 100);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_listener_set_interval error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "sensor_listener_set_intervals");
error = sensor_listener_set_option(listener, SENSOR_OPTION_ALWAYS_ON);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_listener_set_option error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "sensor_listener_set_option");
error = sensor_listener_start(listener);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_listener_start error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "sensor_listener_start");
sensor_event_s event;
error = sensor_listener_read_data(listener, &event);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_listener_read_data error: %d", error);
return;
}
switch (type) {
case SENSOR_GYROSCOPE:
dlog_print(DLOG_INFO, LOG_TAG, "X:%.2f Y:%.2f Z:%.2f" , event.values[0], event.values[1], event.values[2]);
sprintf(out,"X:%.2f Y:%.2f Z:%.2f", event.values[0], event.values[1], event.values[2]);
elm_object_text_set(event_label, out);
break;
default:
dlog_print(DLOG_ERROR, LOG_TAG, "Not a gyroscope event");
}
dlog_print(DLOG_DEBUG, LOG_TAG, out);
char *name = NULL;
char *vendor = NULL;
float min_range = -571.0;
float max_range = 571.0;
float resolution = 0.0;
error = sensor_get_name(sensor, &name);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_get_name error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "Sensor name: %s", name);
free(name);
error = sensor_get_vendor(sensor, &vendor);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_get_vendor error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "Sensor vendor: %s", vendor);
free(vendor);
error = sensor_get_type(sensor, &type);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_get_type error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "Sensor type: %s",
type == SENSOR_ACCELEROMETER ? "Accelerometer"
: type == SENSOR_GRAVITY ? "Gravity sensor"
: type == SENSOR_LINEAR_ACCELERATION ? "Linear acceleration sensor"
: type == SENSOR_MAGNETIC ? "Magnetic sensor"
: type == SENSOR_ROTATION_VECTOR ? "Rotation Vector sensor"
: type == SENSOR_ORIENTATION ? "Orientation sensor"
: type == SENSOR_GYROSCOPE ? "Gyroscope sensor"
: type == SENSOR_LIGHT ? "Light sensor"
: type == SENSOR_PROXIMITY ? "Proximity sensor"
: type == SENSOR_PRESSURE ? "Pressure sensor"
: type == SENSOR_ULTRAVIOLET ? "Ultraviolet sensor"
: type == SENSOR_TEMPERATURE ? "Temperature sensor"
: type == SENSOR_HUMIDITY ? "Humidity sensor"
: type == SENSOR_HRM ? "Heart Rate Monitor sensor (Since Tizen 2.3.1)"
: type == SENSOR_HRM_LED_GREEN ? "HRM (LED Green) sensor (Since Tizen 2.3.1)"
: type == SENSOR_HRM_LED_IR ? "HRM (LED IR) sensor (Since Tizen 2.3.1)"
: type == SENSOR_HRM_LED_RED ? "HRM (LED RED) sensor (Since Tizen 2.3.1)"
: type == SENSOR_LAST ? "End of sensor enum values" : "Custom sensor");
error = sensor_get_min_range(sensor, &min_range);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_get_min_range error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "Minimum range of the sensor: %f", min_range);
error = sensor_get_max_range(sensor, &max_range);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_get_max_range error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "Maximum range of the sensor: %f", max_range);
error = sensor_get_resolution(sensor, &resolution);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_get_resolution error: %d", error);
return;
}
dlog_print(DLOG_DEBUG, LOG_TAG, "Resolution of the sensor: %f", resolution);
elm_object_disabled_set(start, EINA_TRUE);
elm_object_disabled_set(stop, EINA_FALSE);
}
void _sensor_stop_cb(void *data, Evas_Object *obj, void *event_info)
{
int error = sensor_listener_unset_event_cb(listener);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_listener_unset_event_cb error: %d", error);
}
error = sensor_listener_stop(listener);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_listener_stop error: %d", error);
}
error = sensor_destroy_listener(listener);
if (error != SENSOR_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "sensor_destroy_listener error: %d", error);
}
elm_object_disabled_set(start, EINA_FALSE);
elm_object_disabled_set(stop, EINA_TRUE);
}
static void
win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
{
ui_app_exit();
}
Eina_Bool _pop_cb(void *data, Elm_Object_Item *item)
{
elm_win_lower(((appdata_s *)data)->win);
return EINA_FALSE;
}
Evas_Object *_new_button(appdata_s *ad, Evas_Object *display, char *name, void *cb)
{
// Create a button
Evas_Object *bt = elm_button_add(display);
elm_object_text_set(bt, name);
evas_object_smart_callback_add(bt, "clicked", (Evas_Smart_Cb) cb, ad);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(display, bt);
evas_object_show(bt);
return bt;
}
void _create_new_cd_display(appdata_s *ad, char *name, void *cb)
{
// Create main box
Evas_Object *box = elm_box_add(conform);
elm_object_content_set(conform, box);
elm_box_horizontal_set(box, EINA_FALSE);
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(box);
start = _new_button(ad, box, "Start", _sensor_start_cb);
event_label = elm_label_add(box);
elm_object_text_set(event_label, "Press Start and Wait");
elm_box_pack_end(box, event_label);
evas_object_show(event_label);
stop = _new_button(ad, box, "Stop", _sensor_stop_cb);
}
static void create_base_gui(appdata_s *ad)
{
// Setting the window
ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
elm_win_conformant_set(ad->win, EINA_TRUE);
elm_win_autodel_set(ad->win, EINA_TRUE);
elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
evas_object_smart_callback_add(ad->win, "delete, request", win_delete_request_cb, NULL);
/* Create conformant */
conform = elm_conformant_add(ad->win);
evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(ad->win, conform);
evas_object_show(conform);
// Create a naviframe
ad->navi = elm_naviframe_add(conform);
evas_object_size_hint_align_set(ad->navi, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(ad->navi, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_content_set(conform, ad->navi);
evas_object_show(ad->navi);
// Fill the list with items
//create_buttons_in_main_window(ad);
_create_new_cd_display(ad, "Sensor", _pop_cb);
eext_object_event_callback_add(ad->navi, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
// Show the window after base gui is set up
evas_object_show(ad->win);
}
static bool app_create(void *data)
{
/*
* Hook to take necessary actions before main event loop starts
* Initialize UI resources and application's data
* If this function returns true, the main loop of application starts
* If this function returns false, the application is terminated
*/
create_base_gui((appdata_s *)data);
return true;
}
int main(int argc, char *argv[])
{
appdata_s ad;
memset(&ad, 0x00, sizeof(appdata_s));
ui_app_lifecycle_callback_s event_callback;
memset(&event_callback, 0x00, sizeof(ui_app_lifecycle_callback_s));
event_callback.create = app_create;
int ret = ui_app_main(argc, argv, &event_callback, &ad);
if (ret != APP_ERROR_NONE)
dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() failed with error: %d", ret);
return ret;
}
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////HEADER (.h) FILE//////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __charge2silence_H__
#define __charge2silence_H__
#include <app.h>
#include <Elementary.h>
#include <app.h>
#include <dlog.h>
#include <efl_extension.h>
#include <sensor.h>
#define _PRINT_MSG_LOG_BUFFER_SIZE_ 1024
#define PRINT_MSG(fmt, args...) do { char _log_[_PRINT_MSG_LOG_BUFFER_SIZE_]; \
snprintf(_log_, _PRINT_MSG_LOG_BUFFER_SIZE_, fmt, ##args); _add_entry_text(_log_); } while (0)
typedef struct {
Evas_Object *win;
Evas_Object *navi;
} appdata_s;
void _add_entry_text(const char *text);
Evas_Object *_new_button(appdata_s *ad, Evas_Object *display, char *name, void *cb);
void _create_new_cd_display(appdata_s *ad, char *name, void *cb);
Eina_Bool _pop_cb(void *data, Elm_Object_Item *item);
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "charge2silence"
#if !defined(PACKAGE)
#define PACKAGE "org.volume.charge2silence"
#endif
#endif /* __charge2silence_H__ */
//"charge2silence" is just the name of my project//

Related

Compiling custom modules... failed to insmod

Hi,
I am trying to make custom mtd module, to expand the mtd devices to read whole nand and i am using as an example msm_nand.c
So what i have done is added a few devices to mtd partition and compiled. But at the compilation ld says msm_dmov_exec_cmd in not found.. Does not sound good, because original msm_nand.c compiled good as well as the whole kernel.
Could someone help me?
Here is the code i added, i left last lines from the original and my addition due to the code length restriction here:
Code:
/* drivers/mtd/devices/msm_nand.c
.....
msm_nand_release_ex(&info->mtd);
dma_free_coherent(/*dev*/ NULL, SZ_4K,
info->msm_nand.dma_buffer,
info->msm_nand.dma_addr);
kfree(info);
}
return 0;
}
#define DRIVER_NAME "msm_nand_ex"
static struct platform_driver msm_nand_driver = {
.probe = msm_nand_probe,
.remove = __devexit_p(msm_nand_remove_ex),
.driver = {
.name = DRIVER_NAME,
}
};
MODULE_ALIAS(DRIVER_NAME);
#if defined(CONFIG_ARCH_MSM7X30)
#define MSM_NAND_PHYS 0xA0200000
#else
#define MSM_NAND_PHYS 0xA0A00000
#endif
static struct resource resources_nand[] = {
[0] = {
.name = "msm_nand_dmac",
.start = DMOV_NAND_CHAN,
.end = DMOV_NAND_CHAN,
.flags = IORESOURCE_DMA,
},
[1] = {
.name = "msm_nand_phys",
.start = MSM_NAND_PHYS,
.end = MSM_NAND_PHYS + 0x7FF,
.flags = IORESOURCE_MEM,
},
};
static struct mtd_partition nand_ex_partitions[] = {
{
.name = "bootloader",
.size = 0x00000016,
.offset = 0,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "amss",
.size = 0x000000bf,
.offset = 0x00000016,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "amss_fs",
.size = 0x00000058,
.offset = 0x000000d5,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "fota0",
.size = 0x00000022,
.offset = 0x0000012d,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "fota1",
.size = 0x00000022,
.offset = 0x0000014f,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "recovery",
.size = 0x00000062,
.offset = 0x00000171,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "dsp1",
.size = 0x000000a2,
.offset = 0x000001d3,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "boot",
.size = 0x00000062,
.offset = 0x00000275,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}
};
struct flash_platform_data msm_nand_ex_data = {
.parts = nand_ex_partitions,
.nr_parts = ARRAY_SIZE(nand_ex_partitions),
};
static struct platform_device *msm_device_nand_ex;
static int __init msm_nand_init(void)
{
int ret;
msm_device_nand_ex = platform_device_alloc("msm_nand_ex", -1);
if (!msm_device_nand_ex)
return -ENOMEM;
ret = platform_device_add_data(msm_device_nand_ex, &msm_nand_ex_data,
sizeof(msm_nand_ex_data));
ret = platform_device_add_resources(msm_device_nand_ex, resources_nand,
ARRAY_SIZE(resources_nand));
printk("%s : res=%d\n", __FUNCTION__, ARRAY_SIZE(resources_nand));
if (ret == 0)
ret = platform_device_add(msm_device_nand_ex);
if (ret){
platform_device_put(msm_device_nand_ex);
return ret;
}
return platform_driver_register(&msm_nand_driver);
}
static void __exit msm_nand_exit(void)
{
platform_driver_unregister(&msm_nand_driver);
platform_device_unregister(msm_device_nand_ex);
}
module_init(msm_nand_init);
module_exit(msm_nand_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("msm_nand flash driver code");
And also i get in dmesg weird message that my kernel version string is wrong, though i used same kernel except the last modification string. And i can't find any other kernel..
Thanks guys!
you should edit the Makefile and set
EXTRAVERSION = <your kernel version>.
Yes i managed to bypass it but the insmod then says msm_dmov_exec_cmd is not found..
Weird..
anonymous2183 said:
you should edit the Makefile and set
EXTRAVERSION = <your kernel version>.
Click to expand...
Click to collapse

[Q] Error while compiling a ROM.

I'm getting this error while compiling a CM12 based ROM.
Code:
frameworks/native/libs/ui/GraphicBufferMapper.cpp:52:43: error: definition of implicitly-declared 'android::GraphicBufferMapper::~GraphicBufferMapper()'
GraphicBufferMapper::~GraphicBufferMapper();
There is a "^" under the "()" symbol.
The code is as follows (note: It is a shortened code as the whole code is huge).
Code:
ANDROID_SINGLETON_STATIC_INSTANCE( GraphicBufferMapper )
GraphicBufferMapper::GraphicBufferMapper()
: mAllocMod(0)
{
hw_module_t const* module;
int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID);
if (err == 0) {
mAllocMod = (gralloc_module_t const *)module;
}
}
#ifdef MTK_MT6589
GraphicBufferMapper::~GraphicBufferMapper() //ERROR IN THIS LINE
{
gralloc_extra_close(mExtraDev);
}
#endif

Samsung Galaxy Core Plus (G350 / CS02) CWM & CyanogenMod development

Hey,
I think we have completely stolen the other thread about CWM for our device (SM-G350).
So I started a new one dedicated to development of this phone.
Currently I'm trying to port CyanogenMod 10.1 (4.2.2JB) from Trivalent's source code in GitHub. (Thanks to warlinegtr for finding it)
IF you have any skills that might help with this project, please contact me.
And please don't post links to some basic tutorials, I have already read them.
You can freely post source code that might help us in the future.
Regards, santeri3700
Status 12.9.2015 (DD/MM/YYYY)
Current issue: CM10.1 Cannot boot because of the wrong CWM made for cm_mint. It overwrites init.rc and adds wrong fstab to the system partition.
My own built CWM has graphical bug. Half the screen is black and other half is stretched and pink-ish. Still possible to operate.
graphics.c:
Code:
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* [url]http://www.apache.org/licenses/LICENSE-2.0[/url]
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <linux/fb.h>
#include <linux/kd.h>
#include <pixelflinger/pixelflinger.h>
#include "minui.h"
#ifdef BOARD_USE_CUSTOM_RECOVERY_FONT
#include BOARD_USE_CUSTOM_RECOVERY_FONT
#else
#include "font_10x18.h"
#endif
#ifdef RECOVERY_BGRA
#define PIXEL_FORMAT GGL_PIXEL_FORMAT_BGRA_8888
#define PIXEL_SIZE 4
#endif
#ifdef RECOVERY_RGBX
#define PIXEL_FORMAT GGL_PIXEL_FORMAT_RGBX_8888
#define PIXEL_SIZE 4
#endif
#ifndef PIXEL_FORMAT
#define PIXEL_FORMAT GGL_PIXEL_FORMAT_RGB_565
#define PIXEL_SIZE 2
#endif
#define NUM_BUFFERS 2
// #define PRINT_SCREENINFO 1 // Enables printing of screen info to log
typedef struct {
GGLSurface texture;
unsigned offset[97];
unsigned cheight;
unsigned ascent;
} GRFont;
static GRFont *gr_font = 0;
static GGLContext *gr_context = 0;
static GGLSurface gr_font_texture;
static GGLSurface gr_framebuffer[NUM_BUFFERS];
static GGLSurface gr_mem_surface;
static unsigned gr_active_fb = 0;
static unsigned double_buffering = 0;
static int gr_fb_fd = -1;
static int gr_vt_fd = -1;
static struct fb_var_screeninfo vi;
static struct fb_fix_screeninfo fi;
#ifdef PRINT_SCREENINFO
static void print_fb_var_screeninfo()
{
LOGI("vi.xres: %d\n", vi.xres);
LOGI("vi.yres: %d\n", vi.yres);
LOGI("vi.xres_virtual: %d\n", vi.xres_virtual);
LOGI("vi.yres_virtual: %d\n", vi.yres_virtual);
LOGI("vi.xoffset: %d\n", vi.xoffset);
LOGI("vi.yoffset: %d\n", vi.yoffset);
LOGI("vi.bits_per_pixel: %d\n", vi.bits_per_pixel);
LOGI("vi.grayscale: %d\n", vi.grayscale);
}
#endif
static int get_framebuffer(GGLSurface *fb)
{
int fd;
void *bits, *vi2;
fd = open("/dev/graphics/fb0", O_RDWR);
if (fd < 0) {
perror("cannot open fb0");
return -1;
}
vi2 = malloc(sizeof(vi) + sizeof(__u32));
if (ioctl(fd, FBIOGET_VSCREENINFO, vi2) < 0) {
perror("failed to get fb0 info");
close(fd);
free(vi2);
return -1;
}
memcpy((void*) &vi, vi2, sizeof(vi));
free(vi2);
fprintf(stderr, "Pixel format: %dx%d @ %dbpp\n", vi.xres, vi.yres, vi.bits_per_pixel);
vi.bits_per_pixel = PIXEL_SIZE * 8;
if (PIXEL_FORMAT == GGL_PIXEL_FORMAT_BGRA_8888) {
fprintf(stderr, "Pixel format: BGRA_8888\n");
if (PIXEL_SIZE != 4) fprintf(stderr, "E: Pixel Size mismatch!\n");
vi.red.offset = 8;
vi.red.length = 8;
vi.green.offset = 16;
vi.green.length = 8;
vi.blue.offset = 24;
vi.blue.length = 8;
vi.transp.offset = 0;
vi.transp.length = 8;
} else if (PIXEL_FORMAT == GGL_PIXEL_FORMAT_RGBX_8888) {
fprintf(stderr, "Pixel format: RGBX_8888\n");
if (PIXEL_SIZE != 4) fprintf(stderr, "E: Pixel Size mismatch!\n");
vi.red.offset = 24;
vi.red.length = 8;
vi.green.offset = 16;
vi.green.length = 8;
vi.blue.offset = 8;
vi.blue.length = 8;
vi.transp.offset = 0;
vi.transp.length = 8;
} else if (PIXEL_FORMAT == GGL_PIXEL_FORMAT_RGB_565) {
#ifdef RECOVERY_RGB_565
fprintf(stderr, "Pixel format: RGB_565\n");
vi.blue.offset = 0;
vi.green.offset = 5;
vi.red.offset = 11;
#else
fprintf(stderr, "Pixel format: BGR_565\n");
vi.blue.offset = 11;
vi.green.offset = 5;
vi.red.offset = 0;
#endif
if (PIXEL_SIZE != 2) fprintf(stderr, "E: Pixel Size mismatch!\n");
vi.blue.length = 5;
vi.green.length = 6;
vi.red.length = 5;
vi.blue.msb_right = 0;
vi.green.msb_right = 0;
vi.red.msb_right = 0;
vi.transp.offset = 0;
vi.transp.length = 0;
}
else
{
perror("unknown pixel format");
close(fd);
return -1;
}
vi.vmode = FB_VMODE_NONINTERLACED;
vi.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
if (ioctl(fd, FBIOPUT_VSCREENINFO, &vi) < 0) {
perror("failed to put fb0 info");
close(fd);
return -1;
}
if (ioctl(fd, FBIOGET_FSCREENINFO, &fi) < 0) {
perror("failed to get fb0 info");
close(fd);
return -1;
}
bits = mmap(0, fi.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (bits == MAP_FAILED) {
perror("failed to mmap framebuffer");
close(fd);
return -1;
}
#ifdef RECOVERY_GRAPHICS_USE_LINELENGTH
vi.xres_virtual = fi.line_length / PIXEL_SIZE;
#endif
fb->version = sizeof(*fb);
fb->width = vi.xres;
fb->height = vi.yres;
#ifdef BOARD_HAS_JANKY_BACKBUFFER
LOGI("setting JANKY BACKBUFFER\n");
fb->stride = fi.line_length/2;
#else
fb->stride = vi.xres_virtual;
#endif
fb->data = bits;
fb->format = PIXEL_FORMAT;
memset(fb->data, 0, vi.yres * fb->stride * PIXEL_SIZE);
fb++;
/* check if we can use double buffering */
if (vi.yres * fi.line_length * 2 > fi.smem_len)
return fd;
double_buffering = 1;
fb->version = sizeof(*fb);
fb->width = vi.xres;
fb->height = vi.yres;
#ifdef BOARD_HAS_JANKY_BACKBUFFER
fb->stride = fi.line_length/2;
fb->data = (void*) (((unsigned) bits) + vi.yres * fi.line_length);
#else
fb->stride = vi.xres_virtual;
fb->data = (void*) (((unsigned) bits) + vi.yres * fb->stride * PIXEL_SIZE);
#endif
fb->format = PIXEL_FORMAT;
memset(fb->data, 0, vi.yres * fb->stride * PIXEL_SIZE);
#ifdef PRINT_SCREENINFO
print_fb_var_screeninfo();
#endif
return fd;
}
static void get_memory_surface(GGLSurface* ms) {
ms->version = sizeof(*ms);
ms->width = vi.xres;
ms->height = vi.yres;
ms->stride = vi.xres_virtual;
ms->data = malloc(vi.xres_virtual * vi.yres * PIXEL_SIZE);
ms->format = PIXEL_FORMAT;
}
static void set_active_framebuffer(unsigned n)
{
if (n > 1 || !double_buffering) return;
vi.yres_virtual = vi.yres * NUM_BUFFERS;
vi.yoffset = n * vi.yres;
// vi.bits_per_pixel = PIXEL_SIZE * 8;
if (ioctl(gr_fb_fd, FBIOPUT_VSCREENINFO, &vi) < 0) {
perror("active fb swap failed");
}
}
void gr_flip(void)
{
GGLContext *gl = gr_context;
/* swap front and back buffers */
if (double_buffering)
gr_active_fb = (gr_active_fb + 1) & 1;
#ifdef BOARD_HAS_FLIPPED_SCREEN
/* flip buffer 180 degrees for devices with physicaly inverted screens */
unsigned int i;
for (i = 1; i < (vi.xres * vi.yres); i++) {
unsigned short tmp = gr_mem_surface.data[i];
gr_mem_surface.data[i] = gr_mem_surface.data[(vi.xres * vi.yres * 2) - i];
gr_mem_surface.data[(vi.xres * vi.yres * 2) - i] = tmp;
}
#endif
/* copy data from the in-memory surface to the buffer we're about
* to make active. */
memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
vi.xres_virtual * vi.yres * PIXEL_SIZE);
/* inform the display driver */
set_active_framebuffer(gr_active_fb);
}
void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
GGLContext *gl = gr_context;
GGLint color[4];
color[0] = ((r << 8) | r) + 1;
color[1] = ((g << 8) | g) + 1;
color[2] = ((b << 8) | b) + 1;
color[3] = ((a << 8) | a) + 1;
gl->color4xv(gl, color);
}
int gr_measureEx(const char *s, void* font)
{
GRFont* fnt = (GRFont*) font;
int total = 0;
unsigned pos;
unsigned off;
if (!fnt) fnt = gr_font;
while ((off = *s++))
{
off -= 32;
if (off < 96)
total += (fnt->offset[off+1] - fnt->offset[off]);
}
return total;
}
int gr_measure(const char *s)
{
return gr_measureEx(s, NULL);
}
unsigned character_width(const char *s, void* pFont)
{
GRFont *font = (GRFont*) pFont;
unsigned off;
/* Handle default font */
if (!font) font = gr_font;
off = *s - 32;
if (off == 0)
return 0;
return font->offset[off+1] - font->offset[off];
}
int gr_textEx(int x, int y, const char *s, void* pFont)
{
GGLContext *gl = gr_context;
GRFont *font = (GRFont*) pFont;
unsigned off;
unsigned cwidth;
/* Handle default font */
if (!font) font = gr_font;
gl->bindTexture(gl, &font->texture);
gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->enable(gl, GGL_TEXTURE_2D);
while((off = *s++)) {
off -= 32;
cwidth = 0;
if (off < 96) {
cwidth = font->offset[off+1] - font->offset[off];
gl->texCoord2i(gl, (font->offset[off]) - x, 0 - y);
gl->recti(gl, x, y, x + cwidth, y + font->cheight);
x += cwidth;
}
}
return x;
}
int gr_textExW(int x, int y, const char *s, void* pFont, int max_width)
{
GGLContext *gl = gr_context;
GRFont *font = (GRFont*) pFont;
unsigned off;
unsigned cwidth;
/* Handle default font */
if (!font) font = gr_font;
gl->bindTexture(gl, &font->texture);
gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->enable(gl, GGL_TEXTURE_2D);
while((off = *s++)) {
off -= 32;
cwidth = 0;
if (off < 96) {
cwidth = font->offset[off+1] - font->offset[off];
if ((x + (int)cwidth) < max_width) {
gl->texCoord2i(gl, (font->offset[off]) - x, 0 - y);
gl->recti(gl, x, y, x + cwidth, y + font->cheight);
x += cwidth;
} else {
gl->texCoord2i(gl, (font->offset[off]) - x, 0 - y);
gl->recti(gl, x, y, max_width, y + font->cheight);
x = max_width;
return x;
}
}
}
return x;
}
int gr_textExWH(int x, int y, const char *s, void* pFont, int max_width, int max_height)
{
GGLContext *gl = gr_context;
GRFont *font = (GRFont*) pFont;
unsigned off;
unsigned cwidth;
int rect_x, rect_y;
/* Handle default font */
if (!font) font = gr_font;
gl->bindTexture(gl, &font->texture);
gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->enable(gl, GGL_TEXTURE_2D);
while((off = *s++)) {
off -= 32;
cwidth = 0;
if (off < 96) {
cwidth = font->offset[off+1] - font->offset[off];
if ((x + (int)cwidth) < max_width)
rect_x = x + cwidth;
else
rect_x = max_width;
if (y + font->cheight < (unsigned int)(max_height))
rect_y = y + font->cheight;
else
rect_y = max_height;
gl->texCoord2i(gl, (font->offset[off]) - x, 0 - y);
gl->recti(gl, x, y, rect_x, rect_y);
x += cwidth;
if (x > max_width)
return x;
}
}
return x;
}
int gr_text(int x, int y, const char *s)
{
GGLContext *gl = gr_context;
GRFont *font = gr_font;
unsigned off;
unsigned cwidth = 0;
y -= font->ascent;
gl->bindTexture(gl, &font->texture);
gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->enable(gl, GGL_TEXTURE_2D);
while((off = *s++)) {
off -= 32;
if (off < 96) {
cwidth = font->offset[off+1] - font->offset[off];
gl->texCoord2i(gl, (off * cwidth) - x, 0 - y);
gl->recti(gl, x, y, x + cwidth, y + font->cheight);
}
x += cwidth;
}
return x;
}
void gr_fill(int x, int y, int w, int h)
{
GGLContext *gl = gr_context;
gl->disable(gl, GGL_TEXTURE_2D);
gl->recti(gl, x, y, w, h);
}
void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy) {
if (gr_context == NULL) {
return;
}
GGLContext *gl = gr_context;
gl->bindTexture(gl, (GGLSurface*) source);
gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
gl->enable(gl, GGL_TEXTURE_2D);
gl->texCoord2i(gl, sx - dx, sy - dy);
gl->recti(gl, dx, dy, dx + w, dy + h);
}
unsigned int gr_get_width(gr_surface surface) {
if (surface == NULL) {
return 0;
}
return ((GGLSurface*) surface)->width;
}
unsigned int gr_get_height(gr_surface surface) {
if (surface == NULL) {
return 0;
}
return ((GGLSurface*) surface)->height;
}
void* gr_loadFont(const char* fontName)
{
int fd;
GRFont *font = 0;
GGLSurface *ftex;
unsigned char *bits, *rle;
unsigned char *in, data;
unsigned width, height;
unsigned element;
fd = open(fontName, O_RDONLY);
if (fd == -1)
{
char tmp[128];
sprintf(tmp, "/res/fonts/%s.dat", fontName);
fd = open(tmp, O_RDONLY);
if (fd == -1)
return NULL;
}
font = calloc(sizeof(*font), 1);
ftex = &font->texture;
read(fd, &width, sizeof(unsigned));
read(fd, &height, sizeof(unsigned));
read(fd, font->offset, sizeof(unsigned) * 96);
font->offset[96] = width;
bits = malloc(width * height);
memset(bits, 0, width * height);
unsigned pos = 0;
while (pos < width * height)
{
int bit;
read(fd, &data, 1);
for (bit = 0; bit < 8; bit++)
{
if (data & (1 << (7-bit))) bits[pos++] = 255;
else bits[pos++] = 0;
if (pos == width * height) break;
}
}
close(fd);
ftex->version = sizeof(*ftex);
ftex->width = width;
ftex->height = height;
ftex->stride = width;
ftex->data = (void*) bits;
ftex->format = GGL_PIXEL_FORMAT_A_8;
font->cheight = height;
font->ascent = height - 2;
return (void*) font;
}
int gr_getFontDetails(void* font, unsigned* cheight, unsigned* maxwidth)
{
GRFont *fnt = (GRFont*) font;
if (!fnt) fnt = gr_font;
if (!fnt) return -1;
if (cheight) *cheight = fnt->cheight;
if (maxwidth)
{
int pos;
*maxwidth = 0;
for (pos = 0; pos < 96; pos++)
{
unsigned int width = fnt->offset[pos+1] - fnt->offset[pos];
if (width > *maxwidth)
{
*maxwidth = width;
}
}
}
return 0;
}
void gr_font_size(int *x, int *y)
{
// *x = gr_font->cwidth;
// *y = gr_font->cheight;
gr_getFontDetails(NULL, y, x);
}
static void gr_init_font(void)
{
int fontRes;
GGLSurface *ftex;
unsigned char *bits, *rle;
unsigned char *in, data;
unsigned width, height;
unsigned element;
gr_font = calloc(sizeof(*gr_font), 1);
ftex = &gr_font->texture;
width = font.width;
height = font.height;
bits = malloc(width * height);
rle = bits;
in = font.rundata;
while((data = *in++))
{
memset(rle, (data & 0x80) ? 255 : 0, data & 0x7f);
rle += (data & 0x7f);
}
for (element = 0; element < 97; element++)
{
gr_font->offset[element] = (element * font.cwidth);
}
ftex->version = sizeof(*ftex);
ftex->width = width;
ftex->height = height;
ftex->stride = width;
ftex->data = (void*) bits;
ftex->format = GGL_PIXEL_FORMAT_A_8;
gr_font->cheight = height;
gr_font->ascent = height - 2;
return;
}
int gr_init(void)
{
gglInit(&gr_context);
GGLContext *gl = gr_context;
gr_init_font();
gr_vt_fd = open("/dev/tty0", O_RDWR | O_SYNC);
if (gr_vt_fd < 0) {
// This is non-fatal; post-Cupcake kernels don't have tty0.
} else if (ioctl(gr_vt_fd, KDSETMODE, (void*) KD_GRAPHICS)) {
// However, if we do open tty0, we expect the ioctl to work.
perror("failed KDSETMODE to KD_GRAPHICS on tty0");
gr_exit();
return -1;
}
gr_fb_fd = get_framebuffer(gr_framebuffer);
if (gr_fb_fd < 0) {
perror("Unable to get framebuffer.\n");
gr_exit();
return -1;
}
get_memory_surface(&gr_mem_surface);
fprintf(stderr, "framebuffer: fd %d (%d x %d)\n",
gr_fb_fd, gr_framebuffer[0].width, gr_framebuffer[0].height);
/* start with 0 as front (displayed) and 1 as back (drawing) */
gr_active_fb = 0;
set_active_framebuffer(0);
gl->colorBuffer(gl, &gr_mem_surface);
gl->activeTexture(gl, 0);
gl->enable(gl, GGL_BLEND);
gl->blendFunc(gl, GGL_SRC_ALPHA, GGL_ONE_MINUS_SRC_ALPHA);
// gr_fb_blank(true);
// gr_fb_blank(false);
return 0;
}
void gr_exit(void)
{
close(gr_fb_fd);
gr_fb_fd = -1;
free(gr_mem_surface.data);
ioctl(gr_vt_fd, KDSETMODE, (void*) KD_TEXT);
close(gr_vt_fd);
gr_vt_fd = -1;
}
int gr_fb_width(void)
{
return gr_framebuffer[0].width;
}
int gr_fb_height(void)
{
return gr_framebuffer[0].height;
}
gr_pixel *gr_fb_data(void)
{
return (unsigned short *) gr_mem_surface.data;
}
int gr_fb_blank(int blank)
{
int ret;
ret = ioctl(gr_fb_fd, FBIOBLANK, blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK);
if (ret < 0)
perror("ioctl(): blank");
return ret;
}
int gr_get_surface(gr_surface* surface)
{
GGLSurface* ms = malloc(sizeof(GGLSurface));
if (!ms) return -1;
// Allocate the data
get_memory_surface(ms);
// Now, copy the data
memcpy(ms->data, gr_mem_surface.data, vi.xres * vi.yres * vi.bits_per_pixel / 8);
*surface = (gr_surface*) ms;
return 0;
}
int gr_free_surface(gr_surface surface)
{
if (!surface)
return -1;
GGLSurface* ms = (GGLSurface*) surface;
free(ms->data);
free(ms);
return 0;
}
void gr_write_frame_to_file(int fd)
{
write(fd, gr_mem_surface.data, vi.xres * vi.yres * vi.bits_per_pixel / 8);
}
Edit: I can see the boot animation.

[Help]Want To crack Android app To make Php

Hello Guys,Its My First Post In Forum I am Sorry If I made Any Mistake..
Actually i am tring to creat a php for android app before sometime i dont have any idea about how to view source code but thanks to xda-forum developer ...now i have knowledge to view source code of android app
Now Coming to point ..
Android App Contain Many java File In classes.dex Folder .... i have checked every file but i didnt get any web link
here is web links means ....
example-if we have any website like www . somesite . com
then if will view its soruce code then we will get like; -
action-register.php
something like this
i am searching the links in apk so please guys help me to find out it
Here is i am show off some codes of my apk file
Code:
import a.a.a.a.f;
import a.a.a.a.p;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.location.Location;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.aj;
import android.util.SparseArray;
import com.android.volley.toolbox.m;
import com.android.volley.u;
import com.appsflyer.AppsFlyerLib;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.am;
import com.google.android.gms.common.api.an;
import com.google.android.gms.common.api.aq;
import com.google.android.gms.common.api.ar;
import com.google.android.gms.common.api.i;
import com.google.android.gms.common.api.j;
import com.google.android.gms.common.api.l;
import free.bux.d.b;
import free.bux.e.g;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
public class FreeBuzzApp
extends Application
implements j, l
{
public static final String a = FreeBuzzApp.class.getSimpleName();
private static FreeBuzzApp c;
protected com.google.android.gms.common.api.h b;
private u d;
private m e;
private g f;
private Handler g;
private HashMap h = new HashMap();
public static FreeBuzzApp a()
{
return c;
}
public static boolean a(String paramString)
{
Iterator localIterator = c.getPackageManager().getInstalledApplications(0).iterator();
do
{
if (!localIterator.hasNext()) {
break;
}
} while (!((ApplicationInfo)localIterator.next()).packageName.equals(paramString));
for (boolean bool = true;; bool = false) {
return bool;
}
}
private void c()
{
Object localObject1 = null;
boolean bool1 = true;
for (;;)
{
i locali;
try
{
locali = new i(this);
locali.j.add(this);
locali.k.add(this);
com.google.android.gms.common.api.a locala = com.google.android.gms.location.h.a;
locali.c.put(locala, null);
locali.a.addAll(locala.c);
boolean bool2;
if (!locali.c.isEmpty())
{
bool2 = bool1;
com.google.android.gms.common.internal.ap.b(bool2, "must call addApi() to add at least one API");
if (locali.e < 0) {
continue;
}
am localam = am.a(locali.d);
localObject1 = new com.google.android.gms.common.api.y(locali.b.getApplicationContext(), locali.h, locali.a(), locali.i, locali.c, locali.j, locali.k, locali.e, -1);
int k = locali.e;
l locall2 = locali.g;
com.google.android.gms.common.internal.ap.a(localObject1, "GoogleApiClient instance cannot be null");
if (localam.c.indexOfKey(k) < 0)
{
com.google.android.gms.common.internal.ap.a(bool1, "Already managing a GoogleApiClient with id " + k);
an localan = new an(localam, k, (com.google.android.gms.common.api.h)localObject1, locall2);
localam.c.put(k, localan);
if ((localam.a) && (!localam.b)) {
((com.google.android.gms.common.api.h)localObject1).a();
}
this.b = ((com.google.android.gms.common.api.h)localObject1);
}
}
else
{
bool2 = false;
continue;
}
bool1 = false;
continue;
if (locali.f < 0) {
break label497;
}
com.google.android.gms.common.api.ap localap = com.google.android.gms.common.api.ap.a(locali.d);
int i = locali.f;
if (localap.D != null)
{
aq localaq = localap.b(i);
if (localaq != null) {
localObject1 = localaq.i;
}
}
if (localObject1 == null) {
localObject1 = new com.google.android.gms.common.api.y(locali.b.getApplicationContext(), locali.h, locali.a(), locali.i, locali.c, locali.j, locali.k, -1, locali.f);
}
int j = locali.f;
l locall1 = locali.g;
com.google.android.gms.common.internal.ap.a(localObject1, "GoogleApiClient instance cannot be null");
if (localap.a.indexOfKey(j) < 0)
{
bool3 = bool1;
com.google.android.gms.common.internal.ap.a(bool3, "Already managing a GoogleApiClient with id " + j);
ar localar = new ar((com.google.android.gms.common.api.h)localObject1, locall1, (byte)0);
localap.a.put(j, localar);
if (localap.D == null) {
continue;
}
android.support.v4.app.al.a = false;
localap.j().a(j, localap);
continue;
}
boolean bool3 = false;
}
finally {}
continue;
label497:
localObject1 = new com.google.android.gms.common.api.y(locali.b, locali.h, locali.a(), locali.i, locali.c, locali.j, locali.k, -1, -1);
}
}
/* Error */
public final com.google.android.gms.analytics.u a(h paramh)
{
// Byte code:
// 0: aload_0
// 1: monitorenter
// 2: aload_0
// 3: getfield 42 free/bux/FreeBuzzApp:h Ljava/util/HashMap;
// 6: aload_1
// 7: invokevirtual 262 java/util/HashMap:containsKey (Ljava/lang/Object;)Z
// 10: ifne +43 -> 53
// 13: aload_0
// 14: invokestatic 267 com/google/android/gms/analytics/l:a (Landroid/content/Context;)Lcom/google/android/gms/analytics/l;
// 17: astore 4
// 19: aload_1
// 20: getstatic 272 free/bux/h:a Lfree/bux/h;
// 23: if_acmpne +46 -> 69
// 26: aload 4
// 28: ldc_w 274
// 31: invokevirtual 277 com/google/android/gms/analytics/l:a (Ljava/lang/String;)Lcom/google/android/gms/analytics/u;
// 34: astore 7
// 36: aload 7
// 38: iconst_1
// 39: putfield 280 com/google/android/gms/analytics/u:a Z
// 42: aload_0
// 43: getfield 42 free/bux/FreeBuzzApp:h Ljava/util/HashMap;
// 46: aload_1
// 47: aload 7
// 49: invokevirtual 281 java/util/HashMap:put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
// 52: pop
// 53: aload_0
// 54: getfield 42 free/bux/FreeBuzzApp:h Ljava/util/HashMap;
// 57: aload_1
// 58: invokevirtual 285 java/util/HashMap:get (Ljava/lang/Object;)Ljava/lang/Object;
// 61: checkcast 279 com/google/android/gms/analytics/u
// 64: astore_3
// 65: aload_0
// 66: monitorexit
// 67: aload_3
// 68: areturn
// 69: getstatic 287 free/bux/h:b Lfree/bux/h;
// 72: pop
// 73: aload 4
// 75: invokevirtual 290 com/google/android/gms/analytics/l:b ()Lcom/google/android/gms/analytics/u;
// 78: astore 6
// 80: aload 6
// 82: astore 7
// 84: goto -48 -> 36
// 87: astore_2
// 88: aload_0
// 89: monitorexit
// 90: aload_2
// 91: athrow
// Local variable table:
// start length slot name signature
// 0 92 0 this FreeBuzzApp
// 0 92 1 paramh h
// 87 4 2 localObject1 Object
// 64 4 3 localu1 com.google.android.gms.analytics.u
// 17 57 4 locall com.google.android.gms.analytics.l
// 78 3 6 localu2 com.google.android.gms.analytics.u
// 34 49 7 localObject2 Object
// Exception table:
// from to target type
// 2 65 87 finally
// 69 80 87 finally
}
public final void a(int paramInt)
{
this.b.a();
}
public final void a(Bundle paramBundle)
{
Location localLocation = com.google.android.gms.location.h.b.a(this.b);
if (localLocation != null)
{
free.bux.e.d.b(this, "latitude", String.valueOf(localLocation.getLatitude()));
free.bux.e.d.b(this, "longitude", String.valueOf(localLocation.getLongitude()));
new StringBuilder("startLocationUpdates--> User lat ").append(String.valueOf(localLocation.getLatitude()));
}
}
public final void a(ConnectionResult paramConnectionResult)
{
new StringBuilder("Connection failed: ConnectionResult.getErrorCode() = ").append(paramConnectionResult.c);
}
public final m b()
{
if (this.d == null) {
this.d = com.android.volley.toolbox.y.a(getApplicationContext());
}
if (this.e == null)
{
if (this.f == null) {
this.f = new g();
}
this.e = new m(this.d, this.f);
}
return this.e;
}
public void onCreate()
{
super.onCreate();
p[] arrayOfp = new p[1];
arrayOfp[0] = new com.a.a.a();
f.a(this, arrayOfp);
if (Build.VERSION.SDK_INT >= 9)
{
boolean bool = getSharedPreferences("free.bux_preferences", 0).getBoolean("APP_FLYER_TRACKING", true);
AppsFlyerLib.setAppsFlyerKey("4ffriSMaSjMyjrv5EDKJEB");
if (bool)
{
AppsFlyerLib.sendTracking(getApplicationContext());
SharedPreferences.Editor localEditor = getSharedPreferences("free.bux_preferences", 0).edit();
localEditor.putBoolean("APP_FLYER_TRACKING", false);
localEditor.commit();
}
}
try
{
PackageInfo localPackageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
b.a = "Freebuzz/" + localPackageInfo.versionCode + "(Android" + Build.VERSION.RELEASE + ";" + Build.MODEL + " Build /" + Build.FINGERPRINT + ";" + Locale.getDefault() + ";)";
new StringBuilder("http header is ").append(b.a);
c();
c = this;
this.g = new Handler();
a(h.b);
this.b.a();
return;
}
catch (PackageManager.NameNotFoundException localNameNotFoundException)
{
for (;;)
{
new StringBuilder("Cannot find package details with name ").append(getPackageName());
}
}
}
public void onLowMemory()
{
super.onLowMemory();
}
public void onTerminate()
{
super.onTerminate();
}
}

[HELP] weird errors with compiling kernel for s3ve3g

So, I decided I want to put Kali-Linux on my samsung s3 neo device, and I succeeded after hard work and a lots of research... Now I had another problem, that my built-in chipset does not support aircrack-ng, so i decided to work around it, and use a wireless usb adapter.
what i did is modifying the kernel, to be able to support some of the wireless devices... the point where i got stuck is at compiling the new-made kernel... basically i followed the following guide:
PHP:
http://forum.xda-developers.com/showthread.php?t=2338179
and i got stuck at the final section of the compiling segment...
So here is my error.
arch/arm/crypto/sha512_neon_glue.c: In function 'sha512_neon_update':
arch/arm/crypto/sha512_neon_glue.c:144:3: warning: implicit declaration of function 'crypto_sha512_update' [-Wimplicit-function-declaration]
error, forbidden warning: sha512_neon_glue.c:144
scripts/Makefile.build:307: recipe for target 'arch/arm/crypto/sha512_neon_glue.o' failed
make[1]: *** [arch/arm/crypto/sha512_neon_glue.o] Error 1
Makefile:950: recipe for target 'arch/arm/crypto' failed
make: *** [arch/arm/crypto] Error 2
Click to expand...
Click to collapse
so, first of all I have a question, where exactly do i put "KCONFIG_CFLAGS += -w" in the code of the Makefile, and if it would solve the error? according to the guide it should ignore errors that the compiler makes.
2nd question right under the code lines.
Makefile:
PHP:
https://github.com/CyanogenMod/android_kernel_samsung_s3ve3g/blob/cm-12.1/Makefile
Couldn't post it here, too long.
Second question, in case the first solution would not work, if i wanted to edit the problematic file, so it would see the declared functions, how do i do that?
NOTE: the error is in line 144
(will be marked with "------->")
Code:
*
* Glue code for the SHA512 Secure Hash Algorithm assembly implementation
* using NEON instructions.
*
* Copyright © 2014 Jussi Kivilinna <[email protected]>
*
* This file is based on sha512_ssse3_glue.c:
* Copyright (C) 2013 Intel Corporation
* Author: Tim Chen <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
*/
#include <crypto/internal/hash.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/cryptohash.h>
#include <linux/types.h>
#include <linux/string.h>
#include <crypto/sha.h>
#include <asm/byteorder.h>
#include <asm/simd.h>
#include <asm/neon.h>
static const u64 sha512_k[] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL,
0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL,
0xd807aa98a3030242ULL, 0x12835b0145706fbeULL,
0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL,
0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL,
0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL,
0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL,
0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL,
0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL,
0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
0x06ca6351e003826fULL, 0x142929670a0e6e70ULL,
0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL,
0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL,
0x81c2c92e47edaee6ULL, 0x92722c851482353bULL,
0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL,
0xd192e819d6ef5218ULL, 0xd69906245565a910ULL,
0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL,
0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL,
0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL,
0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL,
0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL,
0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL,
0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL,
0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL,
0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
0x28db77f523047d84ULL, 0x32caab7b40c72493ULL,
0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL,
0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL
};
asmlinkage void sha512_transform_neon(u64 *digest, const void *data,
const u64 k[], unsigned int num_blks);
static int sha512_neon_init(struct shash_desc *desc)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
sctx->state[0] = SHA512_H0;
sctx->state[1] = SHA512_H1;
sctx->state[2] = SHA512_H2;
sctx->state[3] = SHA512_H3;
sctx->state[4] = SHA512_H4;
sctx->state[5] = SHA512_H5;
sctx->state[6] = SHA512_H6;
sctx->state[7] = SHA512_H7;
sctx->count[0] = sctx->count[1] = 0;
return 0;
}
static int __sha512_neon_update(struct shash_desc *desc, const u8 *data,
unsigned int len, unsigned int partial)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
unsigned int done = 0;
sctx->count[0] += len;
if (sctx->count[0] < len)
sctx->count[1]++;
if (partial) {
done = SHA512_BLOCK_SIZE - partial;
memcpy(sctx->buf + partial, data, done);
sha512_transform_neon(sctx->state, sctx->buf, sha512_k, 1);
}
if (len - done >= SHA512_BLOCK_SIZE) {
const unsigned int rounds = (len - done) / SHA512_BLOCK_SIZE;
sha512_transform_neon(sctx->state, data + done, sha512_k,
rounds);
done += rounds * SHA512_BLOCK_SIZE;
}
memcpy(sctx->buf, data + done, len - done);
return 0;
}
static int sha512_neon_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
unsigned int partial = sctx->count[0] % SHA512_BLOCK_SIZE;
int res;
/* Handle the fast case right here */
if (partial + len < SHA512_BLOCK_SIZE) {
sctx->count[0] += len;
if (sctx->count[0] < len)
sctx->count[1]++;
memcpy(sctx->buf + partial, data, len);
return 0;
}
if (!may_use_simd()) {
------------> res = crypto_sha512_update(desc, data, len);
} else {
kernel_neon_begin();
res = __sha512_neon_update(desc, data, len, partial);
kernel_neon_end();
}
return res;
}
/* Add padding and return the message digest. */
static int sha512_neon_final(struct shash_desc *desc, u8 *out)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
unsigned int i, index, padlen;
__be64 *dst = (__be64 *)out;
__be64 bits[2];
static const u8 padding[SHA512_BLOCK_SIZE] = { 0x80, };
/* save number of bits */
bits[1] = cpu_to_be64(sctx->count[0] << 3);
bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61);
/* Pad out to 112 mod 128 and append length */
index = sctx->count[0] & 0x7f;
padlen = (index < 112) ? (112 - index) : ((128+112) - index);
if (!may_use_simd()) {
crypto_sha512_update(desc, padding, padlen);
crypto_sha512_update(desc, (const u8 *)&bits, sizeof(bits));
} else {
kernel_neon_begin();
/* We need to fill a whole block for __sha512_neon_update() */
if (padlen <= 112) {
sctx->count[0] += padlen;
if (sctx->count[0] < padlen)
sctx->count[1]++;
memcpy(sctx->buf + index, padding, padlen);
} else {
__sha512_neon_update(desc, padding, padlen, index);
}
__sha512_neon_update(desc, (const u8 *)&bits,
sizeof(bits), 112);
kernel_neon_end();
}
/* Store state in digest */
for (i = 0; i < 8; i++)
dst[i] = cpu_to_be64(sctx->state[i]);
/* Wipe context */
memset(sctx, 0, sizeof(*sctx));
return 0;
}
static int sha512_neon_export(struct shash_desc *desc, void *out)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
memcpy(out, sctx, sizeof(*sctx));
return 0;
}
static int sha512_neon_import(struct shash_desc *desc, const void *in)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
memcpy(sctx, in, sizeof(*sctx));
return 0;
}
static int sha384_neon_init(struct shash_desc *desc)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
sctx->state[0] = SHA384_H0;
sctx->state[1] = SHA384_H1;
sctx->state[2] = SHA384_H2;
sctx->state[3] = SHA384_H3;
sctx->state[4] = SHA384_H4;
sctx->state[5] = SHA384_H5;
sctx->state[6] = SHA384_H6;
sctx->state[7] = SHA384_H7;
sctx->count[0] = sctx->count[1] = 0;
return 0;
}
static int sha384_neon_final(struct shash_desc *desc, u8 *hash)
{
u8 D[SHA512_DIGEST_SIZE];
sha512_neon_final(desc, D);
memcpy(hash, D, SHA384_DIGEST_SIZE);
memset(D, 0, SHA512_DIGEST_SIZE);
return 0;
}
static struct shash_alg algs[] = { {
.digestsize = SHA512_DIGEST_SIZE,
.init = sha512_neon_init,
.update = sha512_neon_update,
.final = sha512_neon_final,
.export = sha512_neon_export,
.import = sha512_neon_import,
.descsize = sizeof(struct sha512_state),
.statesize = sizeof(struct sha512_state),
.base = {
.cra_name = "sha512",
.cra_driver_name = "sha512-neon",
.cra_priority = 250,
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
.cra_blocksize = SHA512_BLOCK_SIZE,
.cra_module = THIS_MODULE,
}
}, {
.digestsize = SHA384_DIGEST_SIZE,
.init = sha384_neon_init,
.update = sha512_neon_update,
.final = sha384_neon_final,
.export = sha512_neon_export,
.import = sha512_neon_import,
.descsize = sizeof(struct sha512_state),
.statesize = sizeof(struct sha512_state),
.base = {
.cra_name = "sha384",
.cra_driver_name = "sha384-neon",
.cra_priority = 250,
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
.cra_blocksize = SHA384_BLOCK_SIZE,
.cra_module = THIS_MODULE,
}
} };
static int __init sha512_neon_mod_init(void)
{
if (!cpu_has_neon())
return -ENODEV;
return crypto_register_shashes(algs, ARRAY_SIZE(algs));
}
static void __exit sha512_neon_mod_fini(void)
{
crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
}
module_init(sha512_neon_mod_init);
module_exit(sha512_neon_mod_fini);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("SHA512 Secure Hash Algorithm, NEON accelerated");
MODULE_ALIAS("sha512");
MODULE_ALIAS("sha384");
Please help me I will be very thankful.
(NOTE: I am not a developer, and I wish I was, or at least i'm ought to be so please explain carefully your solutions since I'm not familiar with any coding language, and for me, reaching this stage of the kernel compiling was time consuming and my only tools were my logic and the internet). thanks in advance for any help i can get i wish it will work so i can move on in learning kali better!

Categories

Resources