Hi,
I'm playing with a MTK ROM (4.2.2), I have to modify it in various ways, but I'm new to the whole area and I'm taking it one thing at a time. I'd really appreciate any help and advice I can get.
Currently I have to find out how to change the default rotation of the camera image/feed. The device has only one camera, the CameraInfo.orientation value is set to 90 and the image is upside-down. I want to find a way to set it to 270, so it would be ok.
So far I've found this in /frameworks.av.camera/ICameraService.cpp:
Code:
// get information about a camera
virtual status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo) {
Parcel data, reply;
data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
data.writeInt32(cameraId);
remote()->transact(BnCameraService::GET_CAMERA_INFO, data, &reply);
cameraInfo->facing = reply.readInt32();
cameraInfo->orientation = reply.readInt32();
return reply.readInt32();
}
and this in /frameworks/base/core/jni/android_hardware_Camera.cpp:
Code:
static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz,
jint cameraId, jobject info_obj)
{
CameraInfo cameraInfo;
status_t rc = Camera::getCameraInfo(cameraId, &cameraInfo);
if (rc != NO_ERROR) {
jniThrowRuntimeException(env, "Fail to get camera info");
return;
}
env->SetIntField(info_obj, fields.facing, cameraInfo.facing);
env->SetIntField(info_obj, fields.orientation, cameraInfo.orientation);
char value[PROPERTY_VALUE_MAX];
property_get("ro.camera.sound.forced", value, "0");
jboolean canDisableShutterSound = (strncmp(value, "0", 2) == 0);
env->SetBooleanField(info_obj, fields.canDisableShutterSound,
canDisableShutterSound);
}
Neither of those are actually the place where the CameraInfo.orientation is being set, which is what I'm looking for. Also I want to find out where can I set the camera to be facing front or back.
Again, I'd really appreciate any pointers you could give me. Thanks!
Chris_M. said:
Hi,
I'm playing with a MTK ROM (4.2.2), I have to modify it in various ways, but I'm new to the whole area and I'm taking it one thing at a time. I'd really appreciate any help and advice I can get.
Currently I have to find out how to change the default rotation of the camera image/feed. The device has only one camera, the CameraInfo.orientation value is set to 90 and the image is upside-down. I want to find a way to set it to 270, so it would be ok.
So far I've found this in /frameworks.av.camera/ICameraService.cpp:
Code:
// get information about a camera
virtual status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo) {
Parcel data, reply;
data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
data.writeInt32(cameraId);
remote()->transact(BnCameraService::GET_CAMERA_INFO, data, &reply);
cameraInfo->facing = reply.readInt32();
cameraInfo->orientation = reply.readInt32();
return reply.readInt32();
}
and this in /frameworks/base/core/jni/android_hardware_Camera.cpp:
Code:
static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz,
jint cameraId, jobject info_obj)
{
CameraInfo cameraInfo;
status_t rc = Camera::getCameraInfo(cameraId, &cameraInfo);
if (rc != NO_ERROR) {
jniThrowRuntimeException(env, "Fail to get camera info");
return;
}
env->SetIntField(info_obj, fields.facing, cameraInfo.facing);
env->SetIntField(info_obj, fields.orientation, cameraInfo.orientation);
char value[PROPERTY_VALUE_MAX];
property_get("ro.camera.sound.forced", value, "0");
jboolean canDisableShutterSound = (strncmp(value, "0", 2) == 0);
env->SetBooleanField(info_obj, fields.canDisableShutterSound,
canDisableShutterSound);
}
Neither of those are actually the place where the CameraInfo.orientation is being set, which is what I'm looking for. Also I want to find out where can I set the camera to be facing front or back.
Again, I'd really appreciate any pointers you could give me. Thanks!
Click to expand...
Click to collapse
Hello,
Please refer here [Guide]How To Port & Modify Roms For Mediatek[Everything] and read the entire thread carefully.
If you still run into queries please post in the thread itself, the experts there might be able to assist you.
Regards
Vatsal,
Forum Moderator.
Thanks, Vatsal!
Just to share - in the end I found that all the camera settings are in ../mediatek/custom/mt6572/hal/imgsensor/src/cfg_setting_imgsensor.cpp
Glad you found the fix mate.
Thread closed!
Related
Hi Everyone,
Using the SkeletonApp default code, how would I insert a void or whatever (sorry not knowing the terminology yet) that would run each cycle of the program like a counter or something?
Just keep it simple, just a "run this always" loop while maintaining the button functions would be great.
thanks and hope you all had a happy thanksgiving
So I added this and it does not work, how in the world do I get a counter working ?
Please, Please someone point me in the right direction?
All I want it to do (in the default SkellyApp) is count to 30, then end the proggy. And yes, I did make the mytimer a variable at the top of my proggy.
public int mytimer;
-------- stuff ---------
@Override
public void onResume() {
mytimer = (mytimer + 1);
if (mytimer == 30) finish();
super.onResume();
}
thank you in advance for taking the time to look, and HOPEFULLY answer this for me.
I missed one class of my java programming class, and now i do not know what to do at all. If anyone could do the problems for me, i would be grateful. Before i get bashed for having someone do my homework, i can learn really easy if someone does it for me, and i can work out how they did it through a matter of trial and error.
Thank you.
Everything you need to know about the Java String class is on this page, including a few samples that are very similar to your assignment.
http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html
I still don't understand it. I can only learn when someone shows me, so unless someone here can do it i guess i have to turn it in as a zero.
Answer to 1. is here 2 and 3 are up to you.
Code:
class StringApp {
public static void main(String[] args) {
String str,str1,str2,str3;
int length;
str="CSE 201";
length=str.length();
str1="ABC";
str2="XYZ";
str3=str1.concat(str2);
}
}
P.S. I've never written a line of Java code before. Luckily it is not that far from C#.
Thank you! Two more problems left.
Awwwwww....... What the hell.....
Answers to 2 and 4:
Code:
class TestApp
{
public static void main(String[] args)
{
String phrase = "To be or not to be";
String anotherPhrase="not";
String longphrase;
String today ="Tuesday,January 18";
int commapos;
System.out.printf("a. %s is %d characters long.\n",phrase, phrase.length());
System.out.printf("b. %d\n",phrase.indexOf(anotherPhrase));
System.out.printf ("c. %s\n",phrase.substring(3, 12));
longphrase=phrase + ", that is the question.";
System.out.printf ("d. %s\n",longphrase);
System.out.printf("e. %d\n",phrase.indexOf("Alien"));
System.out.printf("f. %c\n",phrase.charAt(0));
System.out.printf("g. %c\n",phrase.charAt(phrase.length()-1));
commapos=today.indexOf(",");
System.out.printf("Today is %s. What a great %s!\n",today.substring(commapos+1),today.substring(0,commapos));
}
}
When run produces:-
Code:
a. To be or not to be is 18 characters long.
b. 9
c. be or not
d. To be or not to be, that is the question.
e. -1
f. T
g. e
Today is January 18. What a great Tuesday!
Question 3.
c. str.charAt(0); // str. missing
d. int n=str1.indexOf(str2); // dot missing between str1 and IndexOf()
I have been looking into the C-Sharp__DLLImport project here:
http://forum.xda-developers.com/showthread.php?t=1006331&highlight=dllimport
I am trying to modify the FileSystem project to be able to get a list of the modules that are loaded for each process.
Code:
STDMETHODIMP CFileSystemIO::GetModulesForProcess(DWORD dwPID, BSTR* result)
{
// Get the process snapshot
HANDLE hModuleSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
// Initialize the module entry structure
MODULEENTRY32 moduleEntry = { 0 };
moduleEntry.dwSize = sizeof( moduleEntry );
// Get the first module info
BOOL Return = FALSE;
Return = Module32First( hModuleSnapshot, &moduleEntry);
// Getting process info failed.
if( !Return )
{
CloseHandle( hModuleSnapshot );
return S_FALSE;
}
int x = 1;
CString modList(TEXT(""));
do
{
modList.AppendFormat(TEXT("%d-%d-%d-%d-%d-%d-%s-%s\n"),
moduleEntry.dwSize,
moduleEntry.th32ProcessID,
moduleEntry.GlblcntUsage,
moduleEntry.ProccntUsage,
moduleEntry.modBaseAddr,
moduleEntry.modBaseSize,
moduleEntry.szModule,
moduleEntry.szExePath);
}
while( Module32Next( hModuleSnapshot, &moduleEntry ));
// Close the handle
CloseHandle( hModuleSnapshot );
// set the result
*result = (modList.AllocSysString());
return S_OK;
}
The code is based off a similar function that is already in the project (the CFileSystemIO::MessageBoxRunningProc function which works fine).
By putting some MessageBoxes in there for debugging, I can confirm that the Module32First and Module32Next methods are working correctly. When it gets to the line:
*result = (modList.AllocSysString());
The application crashes. I put a try/catch around there and it didn't trigger a CMemoryException or any other exception.
Any idea why this method would be causing the app to crash?
As an update to this, I was able to figure out the problem. I was unaware of this, but closing the handle generated in the method to get the process messes up the generation of the modules. I didn't think this would be the case since when you generate the handle it also takes a pid. I ended up combining the 2 methods.
The final project uses com interop to call the native methods and it builds a tasklist with all the corresponding modules as subclasses. You can find out which libraries and interfaces are in use by which applications, and where those dll files are located on your phone. If anyone wants to see it, I can post it at some point. It's not a very elegant looking interface, but it gets the job done.
Hi, I'm trying to do a simple login with Facebook in my app but I'm having trouble with Shared Preferences.
The idea is to start the app, it opens Activity A, checks if it's logged, and if it isn't, it sends you to activity B, you login and then go back to A.
My problem is that I can't get the SharedPreferences. I can save it, but I can't get it in the other activity.
So, it gets in a loop: A can't get the SP, so thinks it's not logged in, so send you to B, but B is logged on, and sends you to A...
That's my code in B:
Code:
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
Editor edit = fbSP.edit();
edit.putString("access_token", fb.getAccessToken());
edit.putLong("access_expires", fb.getAccessExpires());
edit.commit();
aIMG();
ir();
}
And that's my code in A, where the problem is:
Code:
private SharedPreferences prefs;
public static String TOKEN = null;
public static final String FACEBOOK_DATA = "FacebookStuff";
long EXPIRES = 0;
...
private void SharedP() {
// TODO Auto-generated method stub
prefs = getSharedPreferences(FACEBOOK_DATA, MODE_PRIVATE);
TOKEN = prefs.getString("access_token", null);
EXPIRES = prefs.getLong("access_expires", 0);
if (TOKEN == null && EXPIRES == 0) { //If it's not logged in...
Intent login = new Intent("android.intent.action.FACELOGIN");
startActivity(login);
}
}
Edit: I got it. I was iniciating fbSP with getPreferences, not getSharedPreferences.
Hey guys,
I have a small app I have been working on that uses the front camera. The way I have been obtaining use of the front camera seems to work on most phones, but users have been reporting trouble on the S3 and various other new devices. The way I have been accessing the front camera is like so:
Code:
// Find the ID of the front camera
CameraInfo cameraInfo = new CameraInfo();
for(int i = 0; i < numberOfCameras; i++) {
Camera.getCameraInfo(i, cameraInfo);
if(cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT) {
defaultCameraId = i;
mCameraFound = true;
}
}
if(!mCameraFound)
displayDialog(8);
From some of the error reporting I've added into the app, I've noticed the S3 actually finds the front camera, but users report it only shows a blank screen? I was hoping someone here may have some experience with this or may be able to help me solve this issue. If you want to try the app out on your S3, check the link below. Thanks in advance.