[DEV] Adding your ROM to ROM Manager - Vibrant Android Development

It's easy, it's free. And here's how you do it!
You will need to create two simple JavaScript files:
A file that describes your ROMs that you send to me.
A file that you host that lists your ROMs, so you can update your ROM Manager section.
First, your developer/ROM description file:
Code:
{
// This is what name you want your ROMs to show up under.
developer: "CyanogenMod",
// Your id. This should have no spaces or other funny characters.
// This would ideally be your Github id, so when you send me your manifest
// I can verify who you are. But it can be anything really.
id: "cyanogen",
// The display summary. Two lines max.
summary: "Mods and bacon for Dream, Sapphire, Droid, and Nexus One",
// The location of the developer's manifest.
manifest: "http://gh-pages.clockworkmod.com/ROMManagerManifest/cyanogenmod.js",
// The list of devices that this developer's ROMs support.
// If you don't support a device, just don't list it!
roms:
{
vibrant: true,
sholes: true
}
}
Send me that file! [email protected]
Link to developer sample: http://gh-pages.clockworkmod.com/ROMManagerManifest/samples/developer.js
And now, create your ROM list file:
Code:
{
// The version of the manifest, so ROM Manager knows how to load it
version: 1,
// The homepage for your ROM, if you have one.
homepage: "http://www.cyanogenmod.com/",
// The donate link for yuor ROM, if you have one.
donate: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3283920",
// Your list of ROMs
roms:
[
{
// Display name of the rom
name: "CyanogenMod 5.0.5",
// Display summary of the rom
summary: "Stable",
// Device that this rom runs on
device: "sholes",
// This is the download URL of your ROM.
// These URLs should have unique filenames per version!
// Ie, don't use a zip with the same name
// as that of a previous version with a new version.
// Otherwise ROM Manager will continue using the
// old cached zip on the SD card.
// This must be a direct download,
// and not a Mediafire type link.
url: "http://www.droidaftermarket.com/koush/motorola/sholes/cyanogen_sholes-ota-eng.koush_5.0.5.zip"
},
// Antother, older ROM!
{
name: "CyanogenMod 5.0.4",
summary: "Stable",
device: "vibrant",
url: "http://www.droidaftermarket.com/koush/motorola/sholes/cyanogen_sholes-ota-eng.koush_5.0.4.zip"
}
]
}
Link to manifest sample: http://gh-pages.clockworkmod.com/ROMManagerManifest/samples/simplemanifest.js
And you're done!
If you're a pro dev, you can even create a ROM customizer. But I won't get into that here
Follow this link for more information: http://www.koushikdutta.com/2010/03/rom-manager-and-third-party-roms.html

Excellent thanks Koush!!

very nice, I love koush lol

Nice
Sent from my SGS Vibrant using tapatalk

Damn Kouch, you seem to be making all this pretty easy for everyone. I'm new to all this rooting stuff, and I've gotta say you've got me really excited about all this. I paid for your Clockwork app to show my support for your hard work, and time you've put into this. Can't wait to see what ROMs hit the Vibrant within the next few weeks!
Thanks!

Related

how can i rebuild 'libhtcgeneric-ril.so'?

previous i posted about korean sms.. but no response.
So i can find a way rebuild '.so' file. but i couldnt..
i must add this code in libhtcgeneric-ril.so
msg = new String( inData, "KSC5601" );
'----------------------------------------------------------
void decode_cdma_sms(char *pdu, char *from, char *message, int *is_vm,int *msg_len) {
unsigned int i=1;
int code,length;
strcpy(from,"000000"); // in case something fails
strcpy(message,"UNKNOWN");
if (is_vm)
*is_vm = 0;
while(i*2<strlen(pdu)) {
get_code_and_length(pdu+i*2,&code,&length);
if(code==2) // from
decode_number(pdu+i*2+4,length,from);
if(code==8) // bearer_data
// probably code add. msg = new String( inData, "KSC5601" );
decode_bearer_data(pdu+i*2+4,length,message,is_vm,msg_len); i+=length+2;
}
}
please.. help me.
You need to have an Android source tree to rebuild any components. The xdandroid guide would be the quickest:
http://xdandroid.com/wiki/Getting_the_Source
Any rebuilds of the RIL need to be placed in /lib/froyo/ of the rootfs rather than /system/lib where Android puts it.
BTW htcgeneric-ril.so is C, while the line you want to add is Java. Are you sure thats the right place to patch it?
Thanks Tremere.
Tremere said:
You need to have an Android source tree to rebuild any components. The xdandroid guide would be the quickest:
http://xdandroid.com/wiki/Getting_the_Source
Any rebuilds of the RIL need to be placed in /lib/froyo/ of the rootfs rather than /system/lib where Android puts it.
BTW htcgeneric-ril.so is C, while the line you want to add is Java. Are you sure thats the right place to patch it?
Click to expand...
Click to collapse
i am newbie in C and java.
So i can not figure out this code is wrong.
i am sure that postion of code is right.
but just android source is download and make then compile is complete ?
must compile whole android source but only 'libhtcgeneric-ril.so' ?
that's too difficult to me. i am newbie at linux, C .
Sorry i am totally wrong.
thas is too difficult.
mmmmm......
I am give up..

Development team V2

Hello everyone,
I want to start again with a development team. After miroslav decided to finish the project on his own, I want to try it again. But this time with a real team Only with people who want to participate, and not just type make. Who wants to join?
miroslav_mm said:
So, I opened your eyes and showed real face our "superstar"!?
Ok! Let's stop this stupid discussion and continuous develop ROM.
At this moment I have main part:
Torchscreen +
BT (BT-calling) +
WiFi (need to test) +
Sensor +
GSM (Waiting call) +
Mobile Data +
Audio +
Vibrate +
HW + 3D ??? (need new kernel or port new 3D kernel driver (kgsl) (in progress))
usb storage ??? (only with special app (native in progress))
Camera ??? (in progress)
Video codec ??? (in progress)
Anyone doing something? Maybe fix some stuff?
Click to expand...
Click to collapse
He just want to clean his topic. Send him a PM.
I understand that but there is still no team. He just made his project open for patches. And I think, personally, a team could help the speed on development of a ROM So please join
Sent from my GT540 using Tapatalk
So join his team , and start patching?
wwenigma said:
So join his team , and start patching?
Click to expand...
Click to collapse
Since when does he have a team? What I know about it, is that he just made some kind of open-source project where you can add your own updates and where he gets no credit.
Sent from my GT540 using Tapatalk
I can help you with Java stuff!
I think miroslav_mm wants to release ICS under name of SWIFT-TEAM, with developer names in credits.... may you ask him about it?
Do not split guys...
Miroslav said that it's only him on the team...so i don't see any team there..if we are more than 1 guy in a team we can get faster a daily ROM for our Phones
rexes13 said:
Miroslav said that it's only him on the team
Click to expand...
Click to collapse
Jep, because PCF+MGP join then leave and jasper580 cant make neccessary steps... ask him. All two, ask him about it.
wwenigma said:
Jep, because PCF+MGP join then leave and jasper580 cant make neccessary steps... ask him. All two, ask him about it.
Click to expand...
Click to collapse
I can make nesseccary steps if I want, but I don't want to. I want to start cleaned up. That's why I created this topic. So:
If you want to join: welcome.
If you don't want to: stop spamming
@rexes13 Welcome to the team!
Sent from my GT540 using Tapatalk
Good news.
Yesterday I successfully ported 3d kernel driver (kgsl) from 35, so now we have full functionality kernel with OpenGL ES-CM 1.1.
So HW, 3D and other stuff with support OpenGL working, not excellent but working, need improve source code Surfaceflinger and HardwareDisplay.
Maybe next weak I will make new thread and publish first public test version, but all development moments we can discus here.
Before I need redownload all sources CM9 again. Yesterday I had the same error like in wwenigma and aaa801
Code:
target thumb C: libhardware_legacy <= hardware/libhardware_legacy/power/power.c
arm-linux-androideabi-gcc: ": No such file or directory
<command-line>: warning: missing terminating " character
and I dont know WTF, so delete all source tree. Maybe today will try download again and build again.
hell yeah! im just another non-dev member LOL sry
Need help!
Look on code:
Code:
//static int32_t msm_tscal_scaler = 65536;
static int32_t msm_tscal_xscale = 70046;
static int32_t msm_tscal_xoffset = -4191987;
static int32_t msm_tscal_yscale = 71735;
static int32_t msm_tscal_yoffset = -3004437;
this pointers for torch 320*240. So when I using that I need tap on 2mm high on icon for open something. This pointer need for screen calibration. Need find right pointer.
I can't find a logic in this numbers.
miroslav_mm said:
Need help!
Look on code:
Code:
//static int32_t msm_tscal_scaler = 65536;
static int32_t msm_tscal_xscale = 70046;
static int32_t msm_tscal_xoffset = -4191987;
static int32_t msm_tscal_yscale = 71735;
static int32_t msm_tscal_yoffset = -3004437;
this pointers for torch 320*240. So when I using that I need tap on 2mm high on icon for open something. This pointer need for screen calibration. Need find right pointer.
I can't find a logic in this numbers.
Click to expand...
Click to collapse
The offsets appear to have a ~4:3 ratio. It doesn't make sense though why it's x:y=4:3, and not the other way around, since the screen is usually 3:4(e.g. 320x480 or 240x320). Also, considering our screen is 320x480, which is a ratio of 1,5 and not 1,(3), I think those would be totally wrong for our phone. Maybe try to modify one of the two to match 1,5 ratio. E.g. make xoffset=-4506655. I don't know. :/
Please discuss development on your page. I want to make a dev team here
Sent from my GT540 using Tapatalk
deleted
10 character
This numbers working with this java code together:
]
Code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Read current values
final int xoffset = (readValue("xoffset")*240+480)/960;
final int yoffset = (readValue("yoffset")*320+460)/920;
final int xscale = readValue("xscale");
final int yscale = readValue("yscale");
view = new View(this) {
private int step = 1;
private int rawx1;
private int rawy1;
private int rawx2;
private int rawy2;
private void writeValue(String parameter, int value) {
try {
FileOutputStream fos = new FileOutputStream(new File("/sys/module/msm_touch/parameters/tscal_" + parameter));
fos.write(String.valueOf(value).getBytes());
fos.flush();
fos.getFD().sync();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (ev.getAction() != MotionEvent.ACTION_UP)
return true;
if(step==1) {
rawx1 = ((int)ev.getRawX()*65536-xoffset+32768)/xscale;
rawy1 = ((int)ev.getRawY()*65536-yoffset+32768)/yscale;
if(rawx1<100 && rawy1<100)
step = 2;
} else if(step==2) {
rawx2 = ((int)ev.getRawX()*65536-xoffset+32768)/xscale;
rawy2 = ((int)ev.getRawY()*65536-yoffset+32768)/yscale;
if(rawx2>140 && rawy2>220)
step = 3;
} else {
int distx = rawx2 - rawx1;
int new_xscale = (140*65536 + distx/2)/distx;
int disty = rawy2 - rawy1;
int new_yscale = (220*65536 + disty/2)/disty;
int new_xoffset = 1;
new_xoffset += 50*65536-rawx1*new_xscale;
new_xoffset += 190*65536-rawx2*new_xscale;
new_xoffset /= 2;
new_xoffset = (new_xoffset*960+120)/240;
int new_yoffset = 1;
new_yoffset += 50*65536-rawy1*new_yscale;
new_yoffset += 270*65536-rawy2*new_yscale;
new_yoffset /= 2;
new_yoffset = (new_yoffset*920+160)/320;
// Pass new calibration to kernel
writeValue("xoffset", new_xoffset);
writeValue("yoffset", new_yoffset);
writeValue("xscale", new_xscale);
writeValue("yscale", new_yscale);
// Save calibraiton data to /data/system/pointercal
StringBuilder sb = new StringBuilder();
sb.append(new_xscale);
sb.append(" ");
sb.append(0);
sb.append(" ");
sb.append(new_xoffset);
sb.append(" ");
sb.append(0);
sb.append(" ");
sb.append(new_yscale);
sb.append(" ");
sb.append(new_yoffset);
sb.append(" ");
sb.append(65536);
App + ui input framework + kernel working together.
App - creation poinercal
ui input framework - reading pointercal send correct info to kernel
kernel touch driver - doing move.
Öhm, the touchscreen driver use a virtual square (320*320) to detect touch, stretched to a rectangle(320*480)?
mod: about calibration, http://code.google.com/p/openeve/issues/detail?id=91
jasper580 said:
Please discuss development on your page. I want to make a dev team here
Click to expand...
Click to collapse
I cant understand you! What do you mean? Do you wanna make new dev team? Working on my sources but without me?
I exactly want to ask that. Maybe he start from scratch, his github is near empty.

Build Variants / APK naming

So I can't seem to find an answer to get this to work the way i want, hoping someone here may know...
I have my gradle setup with different build variants and it works fine to switch between them or generate signed apk for the chosen variant. However what I'm looking to do (ideally in 1 click) is generate each variant's apk and name it accordingly with the version number and variant name.
Any ideas?
I've tried the following snippet
Code:
android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = outputFile.name.replace('.apk', "-${versionName}.apk")
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
}
but no joke, if i went to modify it..it froze android studio. thanks!

How to save & load module settings after MODE_WORLD_READABLE is gone?

According to document, trying to use MODE_WORLD_READABLE will crash the module UI with a SecurityException.
I've tried to use a ContentProvider, but unable to get the Context object in handleLoadPackage (Illegal state).
Is there any better way?
Tried to downgrade targetSdkVersion, the app no longer crashes but XSharedPreferences still can't read the file (the preferences file is already world readable)
You can use Remotepreferences (awesome library!). You will need a context however, so it is not suitable for methods in initzigote or where you can't access the context. I think is the only way as of now.
Massi-X said:
You can use Remotepreferences (awesome library!). You will need a context however, so it is not suitable for methods in initzigote or where you can't access the context. I think is the only way as of now.
Click to expand...
Click to collapse
Remotepreferences will complicate things.
The easiest way to do is to remove the below line
Code:
getPreferenceManager().setSharedPreferencesMode(MODE_WORLD_READABLE);
And add the following on class level.
Code:
@Override
public void onPause() {
super.onPause();
// Set preferences permissions to be world readable
// Workaround for Android N and above since MODE_WORLD_READABLE will cause security exception and FC.
final File dataDir = new File(getActivity().getApplicationInfo().dataDir);
final File prefsDir = new File(dataDir, "shared_prefs");
final File prefsFile = new File(prefsDir, getPreferenceManager().getSharedPreferencesName() + ".xml");
if (prefsFile.exists()) {
dataDir.setReadable(true, false);
dataDir.setExecutable(true, false);
prefsDir.setReadable(true, false);
prefsDir.setExecutable(true, false);
prefsFile.setReadable(true, false);
prefsFile.setExecutable(true, false);
}
}
This method will work on any sdk :good:
I tested it myself and it is working fine.
Thanks to @PunchUp @pyler
laura almeida said:
Remotepreferences will complicate things.
The easiest way to do is to remove the below line
Code:
getPreferenceManager().setSharedPreferencesMode(MODE_WORLD_READABLE);
And add the following on class level.
Code:
@Override
public void onPause() {
super.onPause();
// Set preferences permissions to be world readable
// Workaround for Android N and above since MODE_WORLD_READABLE will cause security exception and FC.
final File dataDir = new File(getActivity().getApplicationInfo().dataDir);
final File prefsDir = new File(dataDir, "shared_prefs");
final File prefsFile = new File(prefsDir, getPreferenceManager().getSharedPreferencesName() + ".xml");
if (prefsFile.exists()) {
dataDir.setReadable(true, false);
dataDir.setExecutable(true, false);
prefsDir.setReadable(true, false);
prefsDir.setExecutable(true, false);
prefsFile.setReadable(true, false);
prefsFile.setExecutable(true, false);
}
}
This method will work on any sdk :good:
I tested it myself and it is working fine.
Thanks to @PunchUp @pyler
Click to expand...
Click to collapse
Yeah but it seems an hacky thing. It will work with any Android? With selinux enabled? On custom ROMs? Surely Remotepreferences complicate things but is the best way (also for previous Android versions) of reading the preferences file. Anyway this can be another solution :good:
EDIT: I also found in marshmallow my apps was randomly failing reading the preferences (no real reason) and Remotepreferences solved the problem.
Massi-X said:
Remotepreferences will complicate things.
The easiest way to do is to remove the below line
And add the following on class level.
Yeah but it seems an hacky thing. It will work with any Android? With selinux enabled? On custom ROMs? Surely Remotepreferences complicate things but is the best way (also for previous Android versions) of reading the preferences file. Anyway this can be another solution :highfive:
Click to expand...
Click to collapse
With any android version - Yes
Will it work with previous android version - Yes
On custom ROMs - Yes
With selinux enabled ? - not tested yet. But I think it works.
laura almeida said:
With any android version - Yes
Will it work with previous android version - Yes
On custom ROMs - Yes
With selinux enabled ? - not tested yet. But I think it works.
Click to expand...
Click to collapse
Previous versions: I was speaking about another thing. See edit. Anyway it's another way, 2 is always better than 1.

Help enabling downloads through webview (Kotlin)

Good day. I'm new to android development and I'm trying to develop a simple webview application, picked a nice template and went through the steps and made good progress, I managed to load my site fully and enable javascript, that works as intended, however I'm not able to make the app download anything, I host a few pdf files that should open or download through it, but nothing happens.
I looked at a few answers here and it is to my understanding that I need to specifically add a function for that, could you give me a hand? I have tried multiple different code and tweaking them, but I wasn't able to get it to work, here is my base code:
Code:
package com.logista.test.ui.home
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient
import android.app.DownloadManager
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.logista.test.R
class HomeFragment : Fragment() {
private lateinit var homeViewModel: HomeViewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
homeViewModel =
ViewModelProvider(this).get(HomeViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_home, container, false)
val myWebView: WebView = root.findViewById(R.id.webview)
myWebView.webViewClient = WebViewClient()
myWebView.settings.javaScriptEnabled = true
myWebView.loadUrl("https://www.example.org/")
return root
}
}
I believe I should be adding
Code:
import android.app.DownloadManager
And tweak this
Code:
// Set web view download listener
web_view.setDownloadListener(DownloadListener {
url,
userAgent,
contentDescription,
mimetype,
contentLength ->
// Initialize download request
val request = DownloadManager.Request(Uri.parse(url))
// Get the cookie
val cookies = CookieManager.getInstance().getCookie(url)
// Add the download request header
request.addRequestHeader("Cookie",cookies)
request.addRequestHeader("User-Agent",userAgent)
// Set download request description
request.setDescription("Downloading requested file....")
// Set download request mime tytpe
request.setMimeType(mimetype)
// Allow scanning
request.allowScanningByMediaScanner()
// Download request notification setting
request.setNotificationVisibility(
DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
// Guess the file name
val fileName = URLUtil.guessFileName(url, contentDescription, mimetype)
// Set a destination storage for downloaded file
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName)
// Set request title
request.setTitle(URLUtil.guessFileName(url, contentDescription, mimetype));
// DownloadManager request more settings
request.setAllowedOverMetered(true)
request.setAllowedOverRoaming(false)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
request.setRequiresCharging(false)
request.setRequiresDeviceIdle(false)
}
request.setVisibleInDownloadsUi(true)
// Get the system download service
val dManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
// Finally, request the download to system download service
dManager.enqueue(request)
})
// Load button click listener
button_load.setOnClickListener{
// Load url in a web view
web_view.loadUrl(url)
}
}
Taken from here: https://android--code.blogspot.com/2018/03/android-kotlin-webview-file-download.html
I did the basics, renaming the function accordingly and such, but it gives me quite a few errors when building the app, for instance uri isn't defined, cookiemanager isn't defined, environment isn't defined, build isn't defined, and such, could you give me some guidance?

Categories

Resources