[CLOSED]Dev-Projekt PiRolleo - Toiletpaper Donator + Cashsystem - Raspberry Pi Original Development

Projekt PiRolleo - Toiletpaper Donator + Cashsystem Machine to buy a lil amount of Paper!!!!!
--------
--------
--------
Its an automatic machine which sell some toiletpaper for money like a cokeautomat in cinema or something.
The complete pythonscript+system is 100% brainwork and complete a owner idea,help and ideas from peeps
with interest is welcome,even for the hardware which is an idea and work from us and not complete.
--------
The complete idea is startet in the devbrains of @[email protected] + @-CALIBAN666-
--------
--- Current status is: v4.0.1 alpha ---
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Are you ready to test your might,get ready to feel the new "BUTTNESS",the digital site of Toilets,lol!!!!!
-------
PHP:
import RPi.GPIO as gpio
import time
gpio.setmode(gpio.BCM)
gpio.setup(18, gpio.IN)
gpio.setup(17, gpio.IN)
gpio.setup(14, gpio.IN)
gpio.setup(10, gpio.IN)
gpio.setup(25, gpio.OUT)
gpio.setup(24, gpio.OUT)
gpio.setup(8, gpio.OUT)
gpio.setup(7, gpio.OUT)
free = 0
pin = 0
eur = 0
i = 0
def abrollen():
gpio.output(7, gpio.HIGH)
gpio.output(8, gpio.HIGH)
gpio.output(24, gpio.HIGH)
time.sleep(3)
gpio.output(7, gpio.LOW)
gpio.output(8, gpio.LOW)
gpio.output(24, gpio.LOW)
def schliessen(eur,free):
print " -------------------------"
print " | Kontostand:", eur,"Euro | "
print " -------------------------"
f = file("/media/usb/konto.txt", "w")
f.write("*** Kontostand: ")
f.write(str(eur))
f.write(" Euro *** -PiRolleo gab ")
f.write(str(free))
f.write(" mal gratis Toilettenpapier")
f.close()
gpio.cleanup()
quit()
try:
while True:
gpio.output(7, gpio.LOW)
gpio.output(8, gpio.LOW)
gpio.output(24, gpio.LOW)
gpio.output(25, gpio.LOW)
if gpio.input(14) == gpio.HIGH:
eur = eur + 0.05
abrollen()
if gpio.input(17) == gpio.HIGH:
pin = 0
time.sleep(3)
if gpio.input(17) == gpio.HIGH:
time.sleep(10)
if gpio.input(18) == gpio.HIGH:
pin = pin + 1
time.sleep(1.5)
if gpio.input(18) == gpio.HIGH:
time.sleep(5)
if gpio.input(17) == gpio.HIGH and pin == 3:
time.sleep(3)
if gpio.input(17) == gpio.HIGH and gpio.input(18) == gpio.HIGH:
free = free + 1
abrollen()
if gpio.input(10) == gpio.HIGH:
if eur >= 1 and eur < 2:
gpio.output(25, gpio.HIGH)
time.sleep(3)
if gpio.input(14) == gpio.HIGH:
schliessen(eur,free)
gpio.output(25, gpio.LOW)
time.sleep(3)
gpio.output(25, gpio.HIGH)
time.sleep(1)
gpio.output(25, gpio.LOW)
elif eur >=2 and eur < 3:
gpio.output(25, gpio.HIGH)
time.sleep(3)
if gpio.input(14) == gpio.HIGH:
schliessen(eur,free)
gpio.output(25, gpio.LOW)
time.sleep(3)
gpio.output(25, gpio.HIGH)
time.sleep(1)
gpio.output(25, gpio.LOW)
time.sleep(0.5)
gpio.output(25, gpio.HIGH)
time.sleep(1)
gpio.output(25, gpio.LOW)
elif eur >=3 and eur < 4:
gpio.output(25, gpio.HIGH)
time.sleep(3)
if gpio.input(14) == gpio.HIGH:
schliessen(eur,free)
gpio.output(25, gpio.LOW)
time.sleep(3)
gpio.output(25, gpio.HIGH)
time.sleep(1)
gpio.output(25, gpio.LOW)
time.sleep(0.5)
gpio.output(25, gpio.HIGH)
time.sleep(1)
gpio.output(25, gpio.LOW)
time.sleep(0.5)
gpio.output(25, gpio.HIGH)
time.sleep(1)
gpio.output(25, gpio.LOW)
time.sleep(0.5)
elif eur >= 4:
gpio.output(25, gpio.HIGH)
time.sleep(3)
if gpio.input(14) == gpio.HIGH:
schliessen(eur,free)
gpio.output(25, gpio.LOW)
time.sleep(3)
i = 10
while i>0:
gpio.output(25, gpio.HIGH)
time.sleep(0.1)
gpio.output(25, gpio.LOW)
time.sleep(0.1)
i = i - 1
else:
gpio.output(25, gpio.HIGH)
time.sleep(3)
if gpio.input(14) == gpio.HIGH:
schliessen(eur,free)
gpio.output(25, gpio.LOW)
except KeyboardInterrupt:
gpio.cleanup()
# *** script by [email protected] & -CALIBAN666- v4.0.0 alpha ***
--- Changelog ---
-v4.0.0 alpha-
-fixed some bugs
now you have the option to get free paper (press the two buttons in combination)
​
--------
Note:
Its work in progress,the python based own created system is ready,only the hardware needs time,so stay tuned!!!
---------
The attached screenshots are early alphastage,so you dont see the machine as ready worker,its prototype with touch-
steering over gpios and gertboard,stay tuned friends.
---------
Many greeeetz from @[email protected] + @-CALIBAN666- ​
XDA:DevDB Information
Projekt PiRolleo - Toiletpaper Donator + Cashsystem Machine, Tool/Utility for the Raspberry Pi
Contributors
-CALIBAN666-, [email protected]
Version Information
Status: Alpha
Created 2015-05-12
Last Updated 2015-05-15

Story about this projekt:
-----------------------------
The reason to start this projekt.
I sit on the toilet and need Paper but there is none and thats
weird because i have buy 10 rolls 2-3 days ago so i cant figure out
why the hell its empty now,thats sux and cost money.Sometimes ive
feeling that my friends are eating or smoking my toiletpaper,its damn
fast empty.
So in a funny moment me and my bro have created the Pirolleo,
its a machine where u can buy 6 papers toiletpaper for 5 euro cent.
The software is ready and now we begin the hardware stuff,all is running
over a pi with gertboard based on python,so stay tuned!!!!
BELIEVE ME ITS NOT A JOKE!!!!!

So this is great! I have so many questions:
Will it accept Euro coins or paper bills as well?
Can you add Bitcoin to it? Who uses real money any more...
What is your idea for the toilet paper delivery system?

only 5 cent coins for now,more and other methods will come.
i dont think that bitcoins are the right payment and its not a computer terminal,its for become toiletpaper for 5 cent,lol.
for delivery,in first time i go to a market and buy it.

great to see our Projekt online,see ya tomorow,lol.

renewed image of the hardware (early stage of development is shown) added to post one.Best thanx and greeeetz to @[email protected].

thread updated with a picture about how it looks when its builded,early picture for sure,its the third picture in first place.
Big thanx and credits to @[email protected] for picture and help.

Related

CREATE GPRS CONNECTION RasSetEntryProperties problem

Hi
I must create programmatically a new connection to a VPN network whit "Cellular Line (GPRS)".What's wrong in this code?
#include "stdafx.h"
#include <commctrl.h>
#include <aygshell.h>
#include <sipapi.h>
// (DEBUT) DECLARATIONS+PROTOTYPES CONCERNANT LES ENTREES RAS
// Code ajouté pour entrées RAS
#include "stdlib.h"
#include "tchar.h"
#include "windows.h"
// ----
#include "ras.h"
#include "raserror.h"
#include "tapi.h"
#ifndef TAPI_CURRENT_VERSION
#define TAPI_CURRENT_VERSION 0x00020000
#endif
#define TAPI_VERSION_1_0 0x00010003
#define TAPI_VERSION_3_0 0x00030000
LPVARSTRING lpDevCfg = NULL;
DWORD WINAPI GetDevCfg(DWORD dwLineId, HWND Hwnd, bool bShowDialog);
DWORD WINAPI RasEnumDev(LPWSTR lpstr);
DWORD WINAPI RasEnum(LPWSTR lpstr);
DWORD WINAPI test();
DWORD WINAPI CreateRasEntry(LPWSTR lpszName, LPWSTR lpszLogin, LPWSTR lpszPassword, LPWSTR lpszDeviceName);
DWORD GetConnectionStatus();
BOOLEAN showErr=TRUE; BOOLEAN debug=TRUE;
DWORD TraitementsRAS(); // SPECIFIQUE A CETTE APPLICATION
// (FIN) DECLARATIONS+PROTOTYPES CONCERNANT LES ENTREES RAS
// (DEBUT) DECLARATIONS+PROTOTYPES CONCERNANT LA BASE DE REGISTRES
#include "winreg.h"
DWORD WriteKey();
DWORD DeleteKey();
// (FIN) DECLARATIONS+PROTOTYPES CONCERNANT LA BASE DE REGISTRES
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst; // The current instance
HWND hwndCB; // The command bar handle
static SHACTIVATEINFO s_sai;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
//RasEnum(_T(""));
// RasEnumDev(_T(""));
TraitementsRAS();
// test();
return TRUE;
}
DWORD WINAPI test(){
//RETAILMSG(1,(TEXT("start\r\n")));
RASENTRY RasEntry;
RASDIALPARAMS RasDialParams;
HRASCONN hRasConn=NULL;
DWORD dwSize;
DWORD dwError;
TCHAR szError[100];
TCHAR szMsg[100];
// Initialize the RASENTRY structure.
dwSize=sizeof(RasEntry);
memset (&RasEntry, 0, dwSize);
RasEntry.dwSize=dwSize;
RasEntry.dwfOptions=0;
wcscpy(RasEntry.szLocalPhoneNumber,TEXT("4"));
RasEntry.dwfNetProtocols=RASNP_Ip;
RasEntry.dwFramingProtocol=RASFP_Ppp;
wcscpy(RasEntry.szDeviceType,RASDT_Modem);
// Get the name of the modem, i left this function out...
//InitializeTAPI();
wcscpy(RasEntry.szDeviceName,_T("Cellular Line"));
// Create a new phone-book entry.
dwError=RasSetEntryProperties(NULL,
TEXT("entry"),&RasEntry,sizeof(RASENTRY),NULL,0);
if (dwError!=0)
{
wsprintf (szError, TEXT("Unable to create the phonebook entry!%ld\r\n"),dwError);
MessageBox(NULL, szError, _T("ERROR:GetDevCfg"), MB_OK);
//RETAILMSG(1,(szError));
return(0);
}
// Initialize the RASDIALPARAMS structure.
memset (&RasDialParams,0,sizeof(RasDialParams));
RasDialParams.dwSize=sizeof(RasDialParams);
wcscpy(RasDialParams.szEntryName,TEXT("entry"));
RasDialParams.szPhoneNumber[0]=NULL;
RasDialParams.szCallbackNumber[0]=NULL;
wcscpy(RasDialParams.szUserName,TEXT("testuser"));
wcscpy(RasDialParams.szPassword,TEXT("secret"));
wcscpy(RasDialParams.szDomain,TEXT("testdomain"));
// Change the connection data.
dwError=RasSetEntryDialParams (NULL, &RasDialParams, FALSE);
if (dwError!=0)
{
wsprintf (szError, TEXT("Unable to set the connection information.")
TEXT(" Error %ld\r\n"), dwError);
MessageBox(NULL, szError, _T("ERROR:GetDevCfg"), MB_OK);
//RETAILMSG(1,(szError));
return(0);
}
hRasConn = NULL;
DWORD dwRval;
dwRval=RasDial(NULL,NULL,&RasDialParams,0,NULL,&hRasConn);
if (dwRval!=0)
{
wsprintf(szMsg,TEXT("Error RasDial(): %ld\r\n"),dwRval);
MessageBox(NULL,szMsg, _T("ERROR:GetDevCfg"), MB_OK);
}
else
{
MessageBox(NULL,_T("RasDial ok!"), _T("ERROR:GetDevCfg"), MB_OK);
}
return(0);
}
DWORD WINAPI TraitementsRAS() {
DWORD ret;
TCHAR szMess[128];
wsprintf(szMess, _T("OK per lanciare la connessione Cancel per annullarla"));
int rep=MessageBox(NULL, szMess, _T("Connessione"), MB_OKCANCEL);
if (rep!=IDCANCEL) {
// OBTENTION DEVICE CONFIGURATION POUR dwLineID=1 (Modem IrDA générique) HKEY_LOC_MACH\DRIVERS\BUILTIN
ret=GetDevCfg(3,NULL,FALSE);
if ( (ret!=0) && (showErr==TRUE) ) {
wsprintf(szMess, _T("ret=%ld"), ret);
MessageBox(NULL, szMess, _T("ERROR:GetDevCfg"), MB_OK);
}
else {
if (debug==TRUE) {
wsprintf(szMess, _T("ret=%ld"), ret);
MessageBox(NULL, szMess, _T("DBG:GetDevCfg:OK"), MB_OK);
}
}
// RAS CREATE ENTRY
ret=CreateRasEntry(_T("RFI"),_T("pippo"),_T("pippo"), _T("Cellular Line (GPRS)"));
if ( (ret!=0) && (showErr==TRUE) ) {
wsprintf(szMess, _T("ret=%ld"), ret);
MessageBox(NULL, szMess, _T("ERROR:CreateRasEntry"), MB_OK);
}
else {
if (debug==TRUE) {
wsprintf(szMess, _T("ret=%ld"), ret);
MessageBox(NULL, szMess, _T("DBG:CreateRasEntry:OK"), MB_OK);
}
}
// PER RENDERE VISIBILE LA CONNESSIONE
WriteKey();
// RAS DIAL ENTRY
RASDIALPARAMS rasDialParam;
// Configure the RASDIALPARAMS structure.
rasDialParam.dwSize = sizeof (RASDIALPARAMS);
rasDialParam.szPhoneNumber[0] = TEXT('\0');
rasDialParam.szCallbackNumber[0] = TEXT('\0');
wcscpy (rasDialParam.szEntryName, _T("RFI"));
HRASCONN rasConn=NULL;
unsigned long connection;
ret=RasDial(NULL, NULL, &rasDialParam, NULL, NULL, &rasConn);
if ( (ret!=0) && (showErr==TRUE) ) {
wsprintf(szMess, _T("ret=%ld"), ret);
MessageBox(NULL, szMess, _T("ERROR:RasDial"), MB_OK);
}
else {
if (debug==TRUE) {
wsprintf(szMess, _T("ret=%ld"), ret);
MessageBox(NULL, szMess, _T("DBG:RasDial:OK"), MB_OK);
}
}
if (ret==0) {
connection = (unsigned long) rasConn;
wsprintf(szMess, _T("Cliquez sur OK lorsque vous voudrez déconnecter la borne infrarouge..."));
MessageBox(NULL, szMess, _T("JAHLIGHT CONNEXION INFRAROUGE"), MB_OK);
}
/*
ret=RasHangUp((HRASCONN) connection);
if ( (ret!=0) && (showErr==TRUE) ) {
wsprintf(szMess, _T("ret=%ld"), ret);
MessageBox(NULL, szMess, _T("ERROR:RasHangUp"), MB_OK);
}
else {
if (debug==TRUE) {
wsprintf(szMess, _T("ret=%ld"), ret);
MessageBox(NULL, szMess, _T("DBG:RasHangUp:OK"), MB_OK);
}
}
DeleteKey();
LPWSTR lpszEntry=_T("JAHLIGHT");
ret=RasDeleteEntry(NULL, lpszEntry);
if ( (ret!=0) && (showErr==TRUE) ) {
wsprintf(szMess, _T("RasDeleteEntry returned %ld"), ret);
MessageBox(NULL, szMess, _T("ERROR:RasDeleteEntry"), MB_OK);
}
else {
if (debug==TRUE) {
wsprintf(szMess, _T("ret=%ld"), ret);
MessageBox(NULL, szMess, _T("DBG:RasDeleteEntry:OK"), MB_OK);
}
}
*/
}
return 0;
}
DWORD WINAPI GetDevCfg(DWORD dwLineId, HWND Hwnd, bool bShowDialog)
{
DWORD dwErr = 0;
LPVARSTRING cfg = NULL;
WCHAR lpszString[20];
wcscpy(lpszString,_T("/0"));
if (!(cfg = (LPVARSTRING) LocalAlloc(LPTR, 280)))
{
return 1;
}
if (!(lpDevCfg = (LPVARSTRING) LocalAlloc(LPTR, 280)))
{
return 1;
}
cfg->dwTotalSize = 280;
cfg->dwStringFormat=STRINGFORMAT_BINARY;
lpDevCfg->dwTotalSize = 280;
lpDevCfg->dwStringFormat=STRINGFORMAT_BINARY;
if (bShowDialog)
{
dwErr = lineGetDevConfig(dwLineId, cfg, _T("tapi/line"));
dwErr = lineConfigDialogEdit(dwLineId, Hwnd , _T("tapi/line"),
(LPVOID)((LPBYTE)cfg + cfg->dwStringOffset),
cfg->dwNeededSize,
lpDevCfg);
}
else
{
dwErr = lineGetDevConfig(dwLineId, lpDevCfg, _T("tapi/line"));
}
return dwErr;
LocalFree(cfg);
}
void WINAPI RasHang(HRASCONN &connection)
{
if (connection == 0)
connection = NULL;
if (connection != NULL)
{
RasHangUp(connection);
connection = NULL;
}
else
MessageBox(NULL,_T("Pas de connexion active."),_T("Connexions"),MB_OK | MB_ICONWARNING);
}
DWORD WINAPI RasConnect(LPWSTR sName, DWORD &connection)
{
HRASCONN g_hRasConn = NULL;
RASDIALPARAMS rasDialParams;
DWORD dwRes;
BOOL bPassword;
rasDialParams.dwSize = sizeof(RASDIALPARAMS);
wcscpy(rasDialParams.szEntryName,sName);
dwRes = RasGetEntryDialParams(NULL, &rasDialParams, &bPassword);
if (dwRes != 0)
{
// Error getting Dial params
return dwRes;
}
if(!bPassword)
MessageBox(NULL,_T("Pas de mot de passe"),_T("Connexions"),MB_OK | MB_ICONINFORMATION);
dwRes = RasDial(NULL,NULL,&rasDialParams,0,NULL,&g_hRasConn);
if (dwRes != 0)
{
// Error Dialing RAS
RasHangUp(g_hRasConn);
g_hRasConn = NULL;
return dwRes;
}
connection = (unsigned long)g_hRasConn;
return dwRes;
}
DWORD WINAPI RasEnum(LPWSTR lpstr) {
LPRASENTRYNAME lpRasEntry = NULL;
RASENTRY RasEntry;
DWORD dwRes,dwError, dwSize, dwSize2, dwEntries, dw;
TCHAR szError[100];
WCHAR szTmp[255];
wcscpy(szTmp,_T(""));
lpRasEntry = new RASENTRYNAME[20];
if(lpRasEntry == NULL) {
return 1;
}
lpRasEntry[0].dwSize = sizeof(RASENTRYNAME);
dwSize = sizeof(RASENTRYNAME) * 20;
memset(&RasEntry,0,sizeof(RASENTRY));
dwSize2 = sizeof(RASENTRY);
RasEntry.dwSize = dwSize2;
dwRes = RasEnumEntries(NULL, NULL, lpRasEntry, &dwSize, &dwEntries);
if (dwRes != 0)
MessageBox(NULL,_T("Error getting RAS entries"),_T("Connexions"),MB_OK | MB_ICONWARNING);
else {
//for(dw = 0; dw < dwEntries; dw++) {
for(dw = 0; dw < 1; dw++) {
MessageBox(NULL,lpRasEntry[dw].szEntryName,_T("TEST"),MB_OK);
// Retrieve the entry properties
if (dwError = RasGetEntryProperties(NULL, lpRasEntry[dw].szEntryName, &RasEntry, &dwSize2, NULL, NULL)) {
wsprintf(szError, _T("Unable to read default entry properties.")_T(" Error %ld"),dwError);
MessageBox(NULL,szError,_T("RasGetEntryProperties Error"),MB_OK | MB_ICONWARNING);
}
else{
// RASIPADDR mio = RasEntry.ipaddr;
wsprintf(szError, _T("dwfOptions")_T(" Error %ld"),RasEntry.dwCountryCode);
MessageBox(NULL,szError,_T("TROVO"),MB_OK | MB_ICONWARNING);
// MessageBox(NULL,mio.a,_T("ipaddr"),MB_OK | MB_ICONWARNING);
//RASIPADDR
/*
wsprintf(szError, _T("dwFramingProtocol")_T(" Error %ld"),RasEntry.dwFramingProtocol);
MessageBox(NULL,szError,_T("TROVO"),MB_OK | MB_ICONWARNING);
wsprintf(szError, _T("dwAlternatesOffset")_T(" Error %ld"),RasEntry.dwAlternatesOffset);
MessageBox(NULL,szError,_T("TROVO"),MB_OK | MB_ICONWARNING);
wsprintf(szError, _T("dwFrameSize")_T(" Error %ld"),RasEntry.dwFrameSize);
MessageBox(NULL,szError,_T("TROVO"),MB_OK | MB_ICONWARNING);
wsprintf(szError, _T("dwfNetProtocols")_T(" Error %ld"),RasEntry.dwfNetProtocols);
MessageBox(NULL,szError,_T("TROVO"),MB_OK | MB_ICONWARNING);
MessageBox(NULL,RasEntry.szScript,_T("szScript"),MB_OK | MB_ICONWARNING);
MessageBox(NULL,RasEntry.szAutoDialDll,_T("szAutoDialDll"),MB_OK | MB_ICONWARNING);
MessageBox(NULL,RasEntry.szAutoDialFunc,_T("szAutoDialFunc"),MB_OK | MB_ICONWARNING);
MessageBox(NULL,RasEntry.szDeviceType,_T("szDeviceType"),MB_OK | MB_ICONWARNING);
MessageBox(NULL,RasEntry.szDeviceName,_T("szDeviceName"),MB_OK | MB_ICONWARNING);
MessageBox(NULL,RasEntry.szX25PadType,_T("szX25PadType"),MB_OK | MB_ICONWARNING);
MessageBox(NULL,RasEntry.szAutoDialFunc,_T("szAutoDialFunc"),MB_OK | MB_ICONWARNING);
wsprintf(szError, _T("dwChannels")_T(" Error %ld"),RasEntry.dwChannels);
MessageBox(NULL,szError,_T("TROVO"),MB_OK | MB_ICONWARNING);
*/
}
wcscat(szTmp,lpRasEntry[dw].szEntryName);
wcscat(szTmp,_T("\n"));
}
wcscpy(lpstr,szTmp);
}
delete [] lpRasEntry;
return dwRes;
}
DWORD WINAPI RasEnumDev(LPWSTR lpstr) {
DWORD lpcb = 0 , lpcDevices, nRet, dw;
WCHAR szTmp[255];
LPRASDEVINFOW lpRasDevInfo = NULL;
RasEnumDevices(lpRasDevInfo, &lpcb, &lpcDevices);
lpRasDevInfo = (LPRASDEVINFOW) GlobalAlloc(GPTR, lpcb);
lpRasDevInfo->dwSize = sizeof(RASDEVINFOW);
nRet = RasEnumDevices(lpRasDevInfo, &lpcb, &lpcDevices);
/* debug only
// convert long to string
_ltow(lpcDevices, szTmp, 10);
MessageBox(NULL,szTmp,_T("Connexions"),MB_OK | MB_ICONWARNING);
*/
// initialisation de la variable temporaire szTmp
wcscpy(szTmp,_T(""));
if (nRet !=0) {
MessageBox(NULL,_T("RasEnumDevices failed"),_T("Connexions"),MB_OK | MB_ICONWARNING);
}
else {
for (dw = 0; dw < lpcDevices; dw++) {
wcscat(szTmp, lpRasDevInfo->szDeviceName);
wcscat(szTmp,_T("\n"));
MessageBox(NULL,szTmp,_T("Connexions"),MB_OK | MB_ICONWARNING);
lpRasDevInfo++;
}
wcscpy(lpstr,szTmp);
}
return nRet;
}
DWORD WINAPI CreateRasEntry(LPWSTR lpszName, LPWSTR lpszLogin, LPWSTR lpszPassword, LPWSTR lpszDeviceName) {
DWORD dwSize,
dwDevInfo = 280 /* 128 */,
dwError = 0;
//PDEVCFG pDevCfg;
TCHAR szError[100];
RASENTRY RasEntry;
RASIPADDR ipaddrDns ;
ipaddrDns.a = 145;
ipaddrDns.b = 130;
ipaddrDns.c = 233;
ipaddrDns.d = 10;
RASDIALPARAMS RasDialParams;
// Validate the format of a connection entry name
//
if (dwError = RasValidateEntryName(NULL, lpszName)) {
wsprintf(szError, _T("Unable to validate entry name.")_T(" Error %ld"),dwError);
MessageBox(NULL,szError,_T("Create Entry"),MB_OK | MB_ICONWARNING);
return dwError;
}
// initialize the RASENTRY structure
//
memset(&RasEntry,0,sizeof(RASENTRY));
dwSize = sizeof(RASENTRY);
RasEntry.dwSize = dwSize;
// Retrieve the entry properties
if (dwError = RasGetEntryProperties(NULL, _T(""), &RasEntry, &dwSize, NULL, NULL)) {
wsprintf(szError, _T("Unable to read default entry properties.")_T(" Error %ld"),dwError);
MessageBox(NULL,szError,_T("Create Entry"),MB_OK | MB_ICONWARNING);
return dwError;
}
// Fill the RASENTRY structure
//
// _tcscpy(RasEntry.szAreaCode, _T("\0"));
RasEntry.dwCountryID=(DWORD) 0;
// RasEntry.dwCountryCode = (DWORD) 0;
//_tcscpy(RasEntry.szAreaCode, lpszAreaCode);
RasEntry.dwCountryCode = (DWORD) 0;
_tcscpy(RasEntry.szLocalPhoneNumber, _T("~GPRS!rfi.tim.it"));
_tcscpy(RasEntry.szDeviceType, RASDT_Modem);
//_tcscpy(RasEntry.szDeviceName, _T("GSM Modem on COM2:"));
_tcscpy(RasEntry.szDeviceName, lpszDeviceName);
// RasEntry.dwfOptions = RASEO_UseCountryAndAreaCodes;
RasEntry.dwfOptions = RASEO_SpecificNameServers ;
RasEntry.dwAlternatesOffset=(DWORD) 1;
RasEntry.ipaddrDns = ipaddrDns;
RasEntry.dwfNetProtocols = (DWORD) 4;
RasEntry.dwFramingProtocol=RASFP_Ppp;
//memcpy( &(RasEntry.ipaddrDns), &RasEntry, sizeof( RASIPADDR ) );
// Create a new phone-book entry.
if (dwError = RasSetEntryProperties(NULL, lpszName, &RasEntry,sizeof(RASENTRY), (LPBYTE)lpDevCfg + lpDevCfg->dwStringOffset, lpDevCfg->dwStringSize)) {
//wsprintf(szError, _T("Unable to create the phone-book entry.")_T(" Error %ld"),dwError);
//MessageBox(NULL,szError,_T("Create Entry"),MB_OK | MB_ICONWARNING);
LocalFree(lpDevCfg);
return dwError;
}
LocalFree(lpDevCfg);
// Initialize a RASDIALPARAMS structure
//
memset(&RasDialParams,0,sizeof(RASDIALPARAMS));
RasDialParams.dwSize = sizeof(RASDIALPARAMS);
_tcscpy(RasDialParams.szEntryName, lpszName);
// Insert code here to fill up the RASDIALPARAMS structure
// RasDialParams.szPhoneNumber, lpszPhoneNumber;
// RasDialParams.szCallbackNumber[0], _T("\0");
RasDialParams.szPhoneNumber[0]=NULL;
RasDialParams.szCallbackNumber[0]=NULL;
wcscpy(RasDialParams.szUserName,lpszLogin);
wcscpy(RasDialParams.szPassword,lpszPassword);
wcscpy(RasDialParams.szDomain,TEXT("rfi.tim.it"));
// _tcscpy(RasDialParams.szUserName, lpszLogin);
// _tcscpy(RasDialParams.szPassword, lpszPassword);
// Change the connection data
//
if (dwError = RasSetEntryDialParams(NULL, &RasDialParams, FALSE)) {
//wsprintf(szError, _T("Unable to create the phone-book entry.")_T(" Error %ld"),dwError);
//MessageBox(NULL,szError,_T("Create Entry"),MB_OK | MB_ICONWARNING);
return dwError;
}
return dwError;
}
// ----------------------------------------------------------------
// (FIN) FONCTIONS CONCERNANT LA CREATION/DESTRUCTION D'ENTREES RAS
// ----------------------------------------------------------------
// -------------------------------------------------
// (DEBUT) FONCTIONS CONCERNANT LA BASE DE REGISTRES
// -------------------------------------------------
DWORD WriteKey()
{
//{ADB0B001-10B5-3F39-27C6-9742E785FCD4} = DestId (param internet)
//{18AD9FBD-F716-ACB6-FD8A-1965DB95B814} (param travail)
HKEY RegKey;
DWORD dwDisposition;
// Ouverture de la clé racine HKCU/Software
// if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\ConnMgr\\Providers\\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\\Connections"), 0, 0, &RegKey)==ERROR_SUCCESS)
if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\ConnMgr\\Providers\\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\\Connections"), 0, TEXT(""), 0, 0, NULL, &RegKey,
&dwDisposition)==ERROR_SUCCESS)
{
HKEY WorkKey;
DWORD dwDisposition;
// Création ou ouverture de la clé MyRegistryKey
if (RegCreateKeyEx (RegKey, TEXT("RFI"), 0, TEXT(""), 0, 0, NULL, &WorkKey,
&dwDisposition)==ERROR_SUCCESS)
{
TCHAR Key[32], Value[64];
wsprintf (Key, TEXT("DestId"));
wsprintf (Value, TEXT("{ADB0B001-10B5-3F39-27C6-9742E785FCD4}"));
RegSetValueEx (WorkKey, Key, 0, REG_SZ, (BYTE *)Value, lstrlen(Value)*sizeof(TCHAR));
DWORD dwValue;
wsprintf(Key, TEXT("RequirePw"));
dwValue=1;
RegSetValueEx (WorkKey, Key, 0, REG_DWORD, (BYTE *)&dwValue, sizeof(DWORD));
wsprintf(Key, TEXT("Enabled"));
dwValue=1;
RegSetValueEx (WorkKey, Key, 0, REG_DWORD, (BYTE *)&dwValue, sizeof(DWORD));
wsprintf(Key, TEXT("EntryType"));
dwValue=0;
RegSetValueEx (WorkKey, Key, 0, REG_DWORD, (BYTE *)&dwValue, sizeof(DWORD));
RegCloseKey(WorkKey);
if (debug==TRUE)
{
MessageBox(NULL, _T("RAS entry added in registry."), _T("DBG:RegCreateKeyEx"), MB_OK);
}
}
else
{
if (showErr==TRUE)
{
MessageBox(NULL, _T("Error while adding RAS entry in registry"), _T("ERROR:RegCreateEntryEx"), MB_OK);
}
}
RegCloseKey(RegKey);
}
return 0;
}
DWORD DeleteKey()
{
//{ADB0B001-10B5-3F39-27C6-9742E785FCD4} = DestId (param internet)
//{18AD9FBD-F716-ACB6-FD8A-1965DB95B814} (param travail)
DWORD ret=NULL;
ret=RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\ConnMgr\\Providers\\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\\Connections\\RFI"));
if (ret==ERROR_SUCCESS)
{
if (debug==TRUE)
{
MessageBox(NULL, _T("Key successfully deleted."), _T("JAHLIGHT IR connect"), MB_OK);
}
}
else
{
if (showErr==TRUE)
{
TCHAR szMess[128];
if (ret!=87) wsprintf(szMess, _T("ERROR: Key not deleted, Error code=%ld"), ret);
else wsprintf(szMess, _T("RegDeleteKey:ERROR_INVALID_PARAMETER"));
MessageBox(NULL, szMess, _T("ERROR:RegDeleteKey"), MB_OK);
}
}
return 0;
}
// -------------------------------------------------
// (FIN) FONCTIONS CONCERNANT LA BASE DE REGISTRES
// -------------------------------------------------
Thank's in advance
CREATE RAS ENTRY
Why don't work :? :? :? :? :?
DWORD WINAPI CreateRasEntry(LPWSTR lpszName, LPWSTR lpszLogin, LPWSTR lpszPassword) {
DWORD dwSize,
dwDevInfo = 280 /* 128 */,
dwError = 0;
//PDEVCFG pDevCfg;
TCHAR szError[100];
RASENTRY RasEntry;
RASIPADDR ipaddrDns ;
RASDIALPARAMS RasDialParams;
// Validate the format of a connection entry name
//
if (dwError = RasValidateEntryName(NULL, lpszName)) {
return dwError;
}
// initialize the RASENTRY structure
//
memset(&RasEntry,0,sizeof(RASENTRY));
dwSize = sizeof(RASENTRY);
RasEntry.dwSize = dwSize;
// Retrieve the entry properties
if (dwError = RasGetEntryProperties(NULL, _T(""), &RasEntry, &dwSize, NULL, NULL)) {
return dwError;
}
// Fill the RASENTRY structure
//
ipaddrDns.a = 145;
ipaddrDns.b = 130;
ipaddrDns.c = 233;
ipaddrDns.d = 10;
_tcscpy(RasEntry.szDeviceType, RASDT_Vpn);
_tcscpy(RasEntry.szDeviceName, _T("Cellular Line (GPRS)"));
RasEntry.dwfOptions = RASEO_SpecificNameServers ;
RasEntry.ipaddrDns = ipaddrDns;
// Create a new phone-book entry.
if (dwError = RasSetEntryProperties(NULL, lpszName, &RasEntry,sizeof(RASENTRY), (LPBYTE)lpDevCfg + lpDevCfg->dwStringOffset, lpDevCfg->dwStringSize)) {
LocalFree(lpDevCfg);
return dwError;
}
LocalFree(lpDevCfg);
// Initialize a RASDIALPARAMS structure
//
memset(&RasDialParams,0,sizeof(RASDIALPARAMS));
RasDialParams.dwSize = sizeof(RASDIALPARAMS);
_tcscpy(RasDialParams.szEntryName, lpszName);
// Insert code here to fill up the RASDIALPARAMS structure
wcscpy(RasDialParams.szUserName,lpszLogin);
wcscpy(RasDialParams.szPassword,lpszPassword);
// Change the connection data
//
if (dwError = RasSetEntryDialParams(NULL, &RasDialParams, FALSE)) {
return dwError;
}
return dwError;
}

Writing a Today Plugin

I am trying to write a today plugin. I've used most of the same code from the sample but it doesn't work. The plugin displays for a few seconds then disappears.
Code:
// HelloToday2.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "todaycmn.h"
#define HELLOTODAY TEXT("HelloToday")
HINSTANCE hInst;
//HWND hWnd;
void OnPaint(HWND);
BOOL OnQueryRefreshCache(HWND, TODAYLISTITEM*);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
hInst = (HINSTANCE)hModule;
//RegisterClass(hInst);
break;
}
case DLL_PROCESS_DETACH:
{
UnregisterClass(HELLOTODAY, hInst);
break;
}
}
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_PAINT:
OnPaint(hWnd);
break;
case WM_TODAYCUSTOM_CLEARCACHE:
break;
case WM_TODAYCUSTOM_QUERYREFRESHCACHE:
OnQueryRefreshCache(hWnd, (TODAYLISTITEM*)wParam);
break;
case WM_LBUTTONUP:
// ButtonProc();
break;
}
return 0;
}
void OnPaint(HWND hWnd)
{
PAINTSTRUCT ps;
HDC hDC;
COLORREF crText = (COLORREF)SendMessage(GetParent(hWnd), TODAYM_GETCOLOR, (WPARAM)TODAYCOLOR_TEXT, 0);
COLORREF crHighlight = (COLORREF)SendMessage(GetParent(hWnd), TODAYM_GETCOLOR, (WPARAM)TODAYCOLOR_HIGHLIGHT, 0);
TODAYDRAWWATERMARKINFO dwi;
RECT rc;
GetClientRect(hWnd, &rc);
dwi.rc = rc;
dwi.hwnd = hWnd;
dwi.hdc = hDC;
hDC = BeginPaint(hWnd, &ps);
SetTextColor(hDC, crText);
int nBkMode = SetBkMode(hDC, OPAQUE);
SetBkColor(hDC, crHighlight);
DrawText(hDC, TEXT("Hello World!"), -1, &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
SetBkMode(hDC, nBkMode);
EndPaint(hWnd, &ps);
}
BOOL OnQueryRefreshCache(HWND hWnd, TODAYLISTITEM* pItem)
{
if(!pItem)
return FALSE;
pItem->cyp = DRA::SCALEY(20);
return TRUE;
}
HWND APIENTRY InitializeCustomItem(TODAYLISTITEM *pItem, HWND hWndParent)
{
if(!pItem->fEnabled)
return NULL;
WNDCLASS wc;
memset(&wc, 0, sizeof(wc));
wc.style = 0;
wc.lpfnWndProc = (WNDPROC)WndProc;
//wc.cbClsExtra = 0;
//wc.cbWndExtra = 0;
wc.hInstance = hInst;
wc.hIcon = 0;
wc.hCursor = 0;
wc.lpszClassName = TEXT("HelloToday");
wc.hbrBackground = NULL;
RegisterClass(&wc);
HWND hWnd = CreateWindow(TEXT("HelloToday"), NULL, WS_VISIBLE | WS_CHILD, 0, 0, 240, 20, hWndParent, NULL, hInst, 0);
if(pItem->fEnabled = TRUE)
ShowWindow(hWnd, SW_SHOW);
return hWnd;
}

HTC Compass

Hello experts,
I am using : vs 2008 – MFC – Smart Device – dlg (Windows Mobile)
I tried to write c++ codes to have access to hardware compass parameters on the bases of sample codes I saw in this forum , but I had no success. My codes are :
.h file
public:
struct compass_data
{
short x;
short y;
short z;
short angle;
short d;
short dummy[10]; //just to make sure nothing get overwritten
};
struct compass
{
compass_data* data;
HANDLE h;
HANDLE service;
int init();
short update();
int deinit();
};
.cpp file
struct Crotate1Dlg::compass cmps;
cmps.init();
for(int iii=0; iii<5; iii++)
{
cmps.update();
char buffer1[65];_itoa_s(myangle, buffer1, 65, 10);//myangle is integer and initializes 9999
SetDlgItemText(IDC_mySTATIC1, (CString)buffer1);
}
cmps.deinit();
}
int Crotate1Dlg::compass::init()
{
Crotate1Dlg::compass::h = CreateFile( TEXT( "SEN0:" ), 0, 0, 0, OPEN_EXISTING, 0x80, 0 );
if( Crotate1Dlg::compass::h == INVALID_HANDLE_VALUE || Crotate1Dlg::compass::h == 0 )
{
Crotate1Dlg::compass::h = 0;
Crotate1Dlg::compass::service = RegisterService( TEXT( "SEN" ), 0, TEXT( "HTCSensorService.dll" ), 1 );
if( Crotate1Dlg::compass::service == 0 )
{
return 0;
}
Crotate1Dlg::compass::h = CreateFile( TEXT( "SEN0:" ), 0, 0, 0, OPEN_EXISTING, 0x80, 0 );
if( Crotate1Dlg::compass::h == INVALID_HANDLE_VALUE || Crotate1Dlg::compass::h == 0 )
{
Crotate1Dlg::compass::h = 0;
return 0;
}
}
if( 0 == DeviceIoControl( Crotate1Dlg::compass::h, DIO_INIT, 0, 0, 0, 0, 0, 0 ))
{
CloseHandle( Crotate1Dlg::compass::h );
Crotate1Dlg::compass::h = 0;
return 0;
}
return true;
}
short Crotate1Dlg::compass::update()
{
if( !Crotate1Dlg::compass::h )
{
return 0;
}
DWORD read = 0;
if( 0 == DeviceIoControl( Crotate1Dlg::compass::h, DIO_READ, 0, 0, Crotate1Dlg::compass::data, 5, &read, 0 ))
{
myangle = (int)Crotate1Dlg::compass::data->angle;
return 0;
}
else
{
return 1;
}
}
int Crotate1Dlg::compass::deinit()
{
if( Crotate1Dlg::compass::h )
{
if( 0 == DeviceIoControl( Crotate1Dlg::compass::h, 0x3000002, 0, 0, 0, 0, 0, 0 ))
{
CloseHandle( Crotate1Dlg::compass::h );
Crotate1Dlg::compass::h = 0;
return 0;
}
}
return 1;
}
This code compiles fine, deploys on emulator with no error (does not give proper output of course) , but gives error on the device (HTC HT2) . I am sure I am doing something wrong , please correct me.
Thank you in advance.
any screenshots ?
HTC compass
All I get on screen is : "A problem has occured with Test1.exe" then asks me to report to Microsoft .

TV OUT port for our ROMS - FIND SOLUTION and GET YOUR DONATE

Hi,
I bought MHL cable and RCA cable for connect my phone to TV ( play games on big screen and internet etc) . Today my RCA cable arrived MHL still on the way.
For few peoples who dont know diffrence between two cables. RCA connects on 3.5mm , MHL on mini-usb and MHL have hardware for TV out but rca doesnt.
I tried RCA but didnt work cus there is no TV-OUT option in our roms.
So is there anyway port TV-OUT option (app etc) from other roms?
I will try MHL too when it arrives.
EDIT: If you find a solution for TVOUT you can get DONATE from me [/SIZE]
I had the same question.
Sent from my HTC_A510c using XDA App
junxracr said:
I had the same question.
Sent from my HTC_A510c using XDA App
Click to expand...
Click to collapse
I Think is not posible because the jack of the wildfire dont have video signal, so even if you had the software you cannot
maybe the mhl one will work. tell us the result when you receive it
mud_f1 said:
I Think is not posible because the jack of the wildfire dont have video signal, so even if you had the software you cannot
Click to expand...
Click to collapse
We've already got a whole thread about peoples opinions on this matter. Please guys, only weigh in if you have REAL experience as this is something we all want to know for sure.
Oh sorry i didnt know that.
I will try mhl too when i get it but still ,any rom maker can try to port TV-OUT option from other phones or ROMS ?
Can any rom maker check this thread please.
http://forum.xda-developers.com/showthread.php?t=674041
There is few people trying to port tv out apk to hero.
Bump
There is 3 file i found, copied but looks didnt worked. I tried to install tvout apk but got an error " Application not installed".
system/app/TVOUT.apk
system/app/TVOUT.odex
system/lib/libTVOUT.so
I found new post here : http://forum.xda-developers.com/showthread.php?t=750043
They are talking about services.jar file and kernel.
If can someone help me please post here. And where the hell is services.jar file. Thanks.
Originally Posted by adrynalyne View Post
Does anyone here know which part of the framework also controls TV-OUT? Its not just the apk.
Turns out that there are kernel drivers necessary - there's a framebuffer TVOut driver as well as a USB projector gadget driver. These are built into the CM6 kernel (the one packaged in the nightly builds, not the cm-kernel tree) and obviously the latest RUU from HTC.
Not only that, at least under CM6, there's both fb0 and fb1 display devices present (/dev/display/). I'm assuming the fb1 display is for TV Out.
This leads me to believe that it is most definitely a non-kernel matter, which should help focus efforts (unless you have a vanilla AOSP kernel, in which case it will require kernel driver porting).
logcat/the kernel still doesn't recognize the USB device when I plug in the cable, and I'm not sure what to do at this point.
Click to expand...
Click to collapse
anyone know where is services.jar file in our phone??
/system/framework
Sent from my HTC_A510c using Tapatalk
Codes from our wildfire s
services.jar\classes.dex\com\android\server\TVOUTCableObserver.class
Any clue ???
Code:
public class TVOUTCableObserver
{
private Context mContext;
private BroadcastReceiver receiver = new BroadcastReceiver()
{
private final int TVOUT_BIT = 256;
private int oldState;
public void onReceive(Context paramContext, Intent paramIntent)
{
int i = paramIntent.getIntExtra("state", 0);
paramIntent.getStringExtra("name");
paramIntent.getIntExtra("microphone", 0);
int j = i & 0x100;
if (j != this.oldState)
{
if (j <= 0)
break label73;
TVOUTCableObserver.this.log("plug");
ActivityManagerNative.broadcastStickyIntent(new Intent("android.intent.action.CABLE_PLUG"), null);
}
while (true)
{
this.oldState = j;
return;
label73: TVOUTCableObserver.this.log("unplug");
ActivityManagerNative.broadcastStickyIntent(new Intent("android.intent.action.CABLE_UNPLUG"), null);
}
}
};
public TVOUTCableObserver(Context paramContext)
{
this.mContext = paramContext;
}
private void log(String paramString)
{
}
public void start()
{
IntentFilter localIntentFilter = new IntentFilter("android.intent.action.HEADSET_PLUG");
this.mContext.registerReceiver(this.receiver, localIntentFilter);
}
public void stop()
{
this.mContext.unregisterReceiver(this.receiver);
}
}
And this is from Galaxy S
services.jar\classes.dex\com\android\server\TvOutService.class
There is no TVOUTCableObserver.class.
So is it posibble to delete our TVOUTCableObserver.class and replace TvOutService.class from galaxy s?
Code:
package com.android.server;
import android.app.ActivityManagerNative;
import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.hardware.TvOut;
import android.os.Handler;
import android.os.ITvOutService;
import android.os.ITvOutService.Stub;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.provider.Settings.System;
import android.util.Log;
import android.view.IRotationWatcher.Stub;
import android.view.IWindowManager;
import android.view.IWindowManager.Stub;
import android.widget.TextView;
public class TvOutService extends ITvOutService.Stub
{
static final int DEFAULT_TVSTATUS = 0;
static final int DEFAULT_TVSYSTEM = 2;
private static int HDMI_SUBTITLE_HEIGHT = 0;
static final int HDMI_SUBTITLE_MAX_HEIGHT = 304;
static final int HDMI_SUBTITLE_MAX_WIDTH = 1856;
private static int HDMI_SUBTITLE_WIDTH = 0;
public static final String LOCALE_CHANGE_ACTION = "android.intent.action.locale.changed";
private static final boolean LOG = 1;
private static final String TAG = "TvOut-Observer";
static final int TVSTATUS_OFF = 0;
static final int TVSTATUS_ON = 1;
static final int TVSYSTEM_NTSC = 1;
static final int TVSYSTEM_PAL = 2;
private static boolean mIsScreenOff;
private static boolean mIsTvWaitResume;
private static boolean mTvCableConnected;
private static boolean mTvSuspend;
private static int sRotation = 0;
private static IWindowManager sWindowManager;
private Bitmap bitmap_subtitle = null;
private Canvas canvas_subtile = null;
private Context mContext;
Handler mHandler;
private Notification mHeadsetNotification;
final Object mLock = new Object();
private boolean mPlaySounds;
private int mPrevFontSize = 0;
private String mPrevSubtitle = "";
private final BroadcastReceiver mReceiver = new BroadcastReceiver()
{
public void onReceive(Context paramContext, Intent paramIntent)
{
String str = paramIntent.getAction();
Log.i("TvOut-Observer", "ACTION " + str);
Log.i("TvOut-Observer", " tvOutSetImageString BroadcastReceiver broadcast received");
if ("android.intent.action.locale.changed".equals(str))
{
Log.i("TvOut-Observer", " tvOutSetImageString BroadcastReceiver broadcast received");
TvOutService.this.tvOutSetImageString();
}
if ("android.intent.action.SCREEN_OFF".equals(str))
{
Log.i("TvOut-Observer", "ACTION_SCREEN_OFF");
TvOutService.access$602(true);
TvOutService.this.updateTVoutOnScreenOnOff();
}
while (true)
{
return;
if (!("android.intent.action.SCREEN_ON".equals(str)))
continue;
Log.i("TvOut-Observer", "ACTION_SCREEN_ON ");
TvOutService.access$602(false);
TvOutService.this.updateTVoutOnScreenOnOff();
}
}
};
private int mTvStatus;
private int mTvSystem = -1;
private PowerManager.WakeLock mWakeLock = null;
private TvOut tvout;
static
{
mTvCableConnected = false;
mTvSuspend = false;
mIsTvWaitResume = false;
HDMI_SUBTITLE_WIDTH = 0;
HDMI_SUBTITLE_HEIGHT = 0;
mIsScreenOff = false;
}
public TvOutService(Context paramContext)
{
Log.e("TvOut-Observer", "TVOU_DEBUG TvOutService");
this.mContext = paramContext;
this.mPlaySounds = SystemProperties.get("persist.service.mount.playsnd", "1").equals("1");
init();
sWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
if (sWindowManager != null);
try
{
sRotation = sWindowManager.watchRotation(new IRotationWatcher.Stub()
{
public void onRotationChanged(int paramInt)
{
TvOutService.onRotationChanged(paramInt);
}
});
return;
}
catch (RemoteException localRemoteException)
{
}
}
public static void onRotationChanged(int paramInt)
{
ITvOutService localITvOutService = ITvOutService.Stub.asInterface(ServiceManager.getService("tvoutservice"));
if (localITvOutService == null)
Log.e("TvOut-Observer", " setTvoutOrientation TvOutService Not running");
while (true)
{
return;
if (sRotation == paramInt)
continue;
sRotation = paramInt;
try
{
Log.i("TvOut-Observer", "setTvoutOrientation rotation = " + paramInt);
localITvOutService.SetOrientation(paramInt);
}
catch (RemoteException localRemoteException)
{
Log.e("TvOut-Observer", "setTvoutOrientation ", localRemoteException);
}
}
}
private void stayAwake(boolean paramBoolean)
{
if (this.mWakeLock != null)
if ((paramBoolean) && (!(this.mWakeLock.isHeld())))
{
Log.e("TvOut-Observer", "stayAwake Accuring the lock SCREEN_ON_DEBUG");
this.mWakeLock.acquire();
}
while (true)
{
return;
if ((paramBoolean) || (!(this.mWakeLock.isHeld())))
continue;
Log.e("TvOut-Observer", "stayAwake relesing the lock SCREEN_ON_DEBUG");
this.mWakeLock.release();
continue;
Log.e("TvOut-Observer", "stayAwake mWakeLock is null SCREEN_ON_DEBUG");
}
}
private int textSizeForSubtitle()
{
switch (HDMI_SUBTITLE_HEIGHT)
{
default:
case 120:
case 144:
case 180:
case 270:
}
for (int i = 37; ; i = 37)
while (true)
{
Log.e("TvOut-Observer", "textSizeForSubtitle subtitletextsize = " + i);
return i;
i = 16;
continue;
i = 20;
continue;
i = 25;
}
}
private void tvOutSetImageString()
{
String str = this.mContext.getString(17040351);
Log.i("TvOut-Observer", "tvOutSetImageString " + str);
this.tvout.TvOutSetImageString(str);
}
private void updatescreensize()
{
Log.e("TvOut-Observer", "updatescreensize");
}
private void updatetvstatus()
{
Log.e("TvOut-Observer", "updatetvstatus");
if (this.mTvStatus == 0)
{
Log.i("TvOut-Observer", "updatetvstatus tvstatus off mTvCableConnected : " + mTvCableConnected);
if ((this.tvout.isEnabled()) || (isSuspended()))
{
Intent localIntent3 = new Intent("android.intent.action.TVOUT_PLUG");
localIntent3.addFlags(1073741824);
localIntent3.putExtra("state", 0);
localIntent3.putExtra("name", "h2w");
localIntent3.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent3, null);
Log.i("TvOut-Observer", "ACTION_TVOUT_PLUG : disable");
Intent localIntent4 = new Intent("android.intent.action.HEADSET_PLUG");
localIntent4.addFlags(1073741824);
localIntent4.putExtra("state", 1);
localIntent4.putExtra("name", "h2w");
localIntent4.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent4, null);
Log.i("TvOut-Observer", "ACTION_HEADSET_PLUG : enable");
DisableTvOut();
setTvoutCableConnected(0);
}
}
while (true)
{
return;
if (this.mTvStatus == 1)
{
Log.i("TvOut-Observer", "updatetvstatus tvstatus on mTvCableConnected : " + mTvCableConnected);
if ((this.tvout.isEnabled()) || (mTvCableConnected != true))
continue;
Log.i("TvOut-Observer", "updatetvstatus enable tvout mTvCableConnected : " + mTvCableConnected);
Intent localIntent1 = new Intent("android.intent.action.HEADSET_PLUG");
localIntent1.addFlags(1073741824);
localIntent1.putExtra("state", 0);
localIntent1.putExtra("name", "h2w");
localIntent1.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent1, null);
Log.i("TvOut-Observer", "ACTION_HEADSET_PLUG : disable");
Intent localIntent2 = new Intent("android.intent.action.TVOUT_PLUG");
localIntent2.addFlags(1073741824);
localIntent2.putExtra("state", 1);
localIntent2.putExtra("name", "h2w");
localIntent2.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent2, null);
Log.i("TvOut-Observer", "ACTION_TVOUT_PLUG : enable");
EnableTvOut();
setTvoutCableConnected(1);
}
Log.e("TvOut-Observer", "updatetvsystem system shuldnot come here... error in tvout status values");
}
}
private void updatetvsystem()
{
Log.e("TvOut-Observer", "updatetvsystem");
this.tvout.SetTvSystem(this.mTvSystem);
}
public void CableConnected(boolean paramBoolean)
{
Log.e("TvOut-Observer", "CableConnected : " + paramBoolean);
mTvCableConnected = paramBoolean;
if (paramBoolean == true)
{
setTvoutCableConnected(1);
label40: if ((this.mTvStatus != 0) && (mTvCableConnected))
break label94;
Log.i("TvOut-Observer", "CableConnected tvstatus off mTvCableConnected : " + mTvCableConnected);
DisableTvOut();
}
while (true)
{
return;
setTvoutCableConnected(0);
break label40:
label94: if (this.mTvStatus != 1)
continue;
Log.i("TvOut-Observer", "CableConnected tvstatus on mTvCableConnected : " + mTvCableConnected);
if ((!(this.tvout.isEnabled())) && (mTvCableConnected == true))
{
Log.i("TvOut-Observer", "CableConnected enable tvout mTvCableConnected : " + mTvCableConnected);
if (!(mIsScreenOff))
EnableTvOut();
Log.i("TvOut-Observer", "CableConnected enable tvout mIsScreenOff : " + mIsScreenOff);
}
Log.e("TvOut-Observer", "updatetvsystem system shuldnot come here... error in tvout status values");
}
}
public void DisableTvOut()
{
Log.e("TvOut-Observer", "DisableTvOut");
this.tvout.DisableTvOut();
stayAwake(false);
mTvSuspend = false;
mIsTvWaitResume = false;
}
public void DisableTvOutForce()
{
Log.e("TvOut-Observer", "DisableTvOut");
Intent localIntent1 = new Intent("android.intent.action.TVOUT_PLUG");
localIntent1.addFlags(1073741824);
localIntent1.putExtra("state", 0);
localIntent1.putExtra("name", "h2w");
localIntent1.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent1, null);
Log.i("TvOut-Observer", "ACTION_TVOUT_PLUG : disable");
Intent localIntent2 = new Intent("android.intent.action.HEADSET_PLUG");
localIntent2.addFlags(1073741824);
localIntent2.putExtra("state", 1);
localIntent2.putExtra("name", "h2w");
localIntent2.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent2, null);
Log.i("TvOut-Observer", "ACTION_HEADSET_PLUG : enable");
this.tvout.DisableTvOut();
stayAwake(false);
mTvSuspend = false;
mIsTvWaitResume = false;
}
public void EnableTvOut()
{
Log.i("TvOut-Observer", "EnableTvOut");
tvOutSetImageString();
this.tvout.SetOrientation(sRotation);
if (this.tvout.isEnabled())
DisableTvOut();
if ((mTvCableConnected != true) || (this.mTvStatus != 1))
return;
this.tvout.EnableTvOut();
stayAwake(true);
}
public void EnableTvOutForce()
{
Log.e("TvOut-Observer", "EnableTvOut");
Intent localIntent1 = new Intent("android.intent.action.HEADSET_PLUG");
localIntent1.addFlags(1073741824);
localIntent1.putExtra("state", 0);
localIntent1.putExtra("name", "h2w");
localIntent1.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent1, null);
Log.i("TvOut-Observer", "ACTION_HEADSET_PLUG : disable");
Intent localIntent2 = new Intent("android.intent.action.TVOUT_PLUG");
localIntent2.addFlags(1073741824);
localIntent2.putExtra("state", 1);
localIntent2.putExtra("name", "h2w");
localIntent2.putExtra("microphone", 0);
ActivityManagerNative.broadcastStickyIntent(localIntent2, null);
Log.i("TvOut-Observer", "ACTION_TVOUT_PLUG : enable");
this.tvout.SetOrientation(sRotation);
this.tvout.EnableTvOut();
stayAwake(true);
}
public void SetCableStatus(boolean paramBoolean)
{
Log.i("TvOut-Observer", "SetCableStatus : " + paramBoolean);
mTvCableConnected = paramBoolean;
}
public void SetOrientation(int paramInt)
{
Log.e("TvOut-Observer", "SetOrientation");
this.tvout.SetOrientation(paramInt);
}
public void TvOutResume()
{
Log.e("TvOut-Observer", "TvOutResume");
if (mTvSuspend == true)
if ((!(this.tvout.isEnabled())) || (isTvoutCableConnected()))
{
Log.e("TvOut-Observer", "Call Tvout resume");
this.tvout.SetOrientation(sRotation);
this.tvout.TvOutResume(3);
mTvSuspend = false;
mIsTvWaitResume = true;
}
while (true)
{
return;
Log.e("TvOut-Observer", "tvout.isEnabled()" + this.tvout.isEnabled());
continue;
Log.e("TvOut-Observer", "mTvSuspend " + mTvSuspend);
}
}
public void TvOutSetImage(int paramInt)
{
Log.e("TvOut-Observer", "TvOutSetImage");
if (!(this.tvout.isEnabled()))
return;
}
public void TvOutSuspend(String paramString)
{
if ((!(this.tvout.isEnabled())) && (!(this.tvout.isSuspended())))
return;
TvOutSuspendAnalog(paramString);
}
public void TvOutSuspendAnalog(String paramString)
{
Log.e("TvOut-Observer", "TvOutSuspend");
if (isTvoutCableConnected())
if ((!(mTvSuspend)) || (mIsTvWaitResume == true))
{
Log.e("TvOut-Observer", "Call Suspend");
this.tvout.TvOutSuspend(this.mContext, paramString);
mTvSuspend = true;
mIsTvWaitResume = false;
}
while (true)
{
return;
Log.e("TvOut-Observer", "mTvSuspend" + mTvSuspend + " mIsTvWaitResume" + mIsTvWaitResume);
continue;
Log.e("TvOut-Observer", "isTvoutCableConnected()" + isTvoutCableConnected());
}
}
public boolean TvoutSubtitleIsEnable()
{
Log.e("TvOut-Observer", "isHDMISubtitleOn");
return this.tvout.TvoutSubtitleIsEnable();
}
public boolean TvoutSubtitlePostString(String paramString, int paramInt)
{
Log.e("TvOut-Observer", "TvoutSubtitlePostString string = " + paramString + " fontsize : " + paramInt);
int i = 0;
textSizeForSubtitle();
if ((this.mPrevSubtitle.equals(paramString)) && (this.mPrevFontSize == paramInt));
for (int i1 = 0; ; i1 = 1)
{
TextView localTextView;
Bitmap localBitmap;
while (true)
{
return i1;
localTextView = new TextView(this.mContext);
localTextView.setDrawingCacheQuality(524288);
localTextView.setGravity(17);
localTextView.setTextSize((float)(0.8D * paramInt));
localTextView.layout(0, 0, HDMI_SUBTITLE_WIDTH, HDMI_SUBTITLE_HEIGHT);
localTextView.setDrawingCacheBackgroundColor(-16777216);
localTextView.setText(paramString);
localTextView.setDrawingCacheEnabled(true);
localTextView.invalidate();
localTextView.buildDrawingCache();
localBitmap = localTextView.getDrawingCache();
if (localBitmap != null)
break;
Log.e("TvOut-Observer", "TvoutHDMIPostSubtitle bitmap is null ");
i1 = 0;
}
int j = localTextView.getLineCount();
int k = localTextView.getLineHeight();
int l = HDMI_SUBTITLE_HEIGHT - (j * k);
if (l > 0)
i = l / 2 - (k / 2);
Log.e("TvOut-Observer", "subttle y : " + i);
this.bitmap_subtitle.eraseColor(-16777216);
this.canvas_subtile.drawBitmap(localBitmap, 0, i, null);
this.tvout.TvoutSubtitlePostBitmap(this.bitmap_subtitle, -16777216);
localTextView.setDrawingCacheEnabled(false);
this.mPrevSubtitle = paramString;
this.mPrevFontSize = paramInt;
}
}
public boolean TvoutSubtitleSetStatus(int paramInt)
{
Log.e("TvOut-Observer", "TvoutSubtitleSetStatus :" + paramInt);
if (paramInt > 0)
{
if ((!(isEnabled())) || (isSuspended()) || (TvoutSubtitleIsEnable()))
break label135;
HDMI_SUBTITLE_WIDTH = this.tvout.TvoutSubtitleGetWidth();
HDMI_SUBTITLE_HEIGHT = this.tvout.TvoutSubtitleGetHeight();
this.bitmap_subtitle = Bitmap.createBitmap(HDMI_SUBTITLE_WIDTH, HDMI_SUBTITLE_HEIGHT, Bitmap.Config.RGB_565);
this.bitmap_subtitle.eraseColor(-16777216);
this.canvas_subtile = new Canvas(this.bitmap_subtitle);
}
label135: for (boolean bool = this.tvout.TvoutSubtitleSetStatus(1); ; bool = false)
while (true)
{
return bool;
bool = this.tvout.TvoutSubtitleSetStatus(0);
}
}
public String getIntent()
{
return "android.intent.action.locale.changed";
}
void init()
{
Log.e("TvOut-Observer", "TVOUT_DEBUG_VIVEK_ANALOG1");
this.tvout = new TvOut();
this.mHandler = new Handler();
this.mTvStatus = 0;
SettingsObserver localSettingsObserver = new SettingsObserver(this.mHandler);
Settings.System.putInt(this.mContext.getContentResolver(), "tv_out", 0);
localSettingsObserver.observe();
Log.e("TvOut-Observer", "TVOUT_DEBUG_VIVEK_ANALOG2");
IntentFilter localIntentFilter = new IntentFilter();
localIntentFilter.addAction("android.intent.action.locale.changed");
localIntentFilter.addAction("android.intent.action.SCREEN_OFF");
localIntentFilter.addAction("android.intent.action.SCREEN_ON");
this.mContext.registerReceiver(this.mReceiver, localIntentFilter);
setWakeMode(this.mContext, 6);
Log.e("TvOut-Observer", "TVOUT_DEBUG_VIVEK_ANALOG3");
}
public boolean isEnabled()
{
Log.e("TvOut-Observer", "isEnabled");
return this.tvout.isEnabled();
}
public boolean isSuspended()
{
Log.e("TvOut-Observer", "isSuspended");
return this.tvout.isSuspended();
}
public boolean isTvoutCableConnected()
{
Log.e("TvOut-Observer", "isTvoutCableConnected");
return this.tvout.isTvoutCableConnected();
}
public void setTvoutCableConnected(int paramInt)
{
Log.e("TvOut-Observer", "setTvoutCableConnected");
this.tvout.setTvoutCableConnected(paramInt);
}
public void setWakeMode(Context paramContext, int paramInt)
{
int i = 0;
if (this.mWakeLock != null)
{
if (this.mWakeLock.isHeld())
{
i = 1;
this.mWakeLock.release();
}
this.mWakeLock = null;
}
Log.e("TvOut-Observer", "setWakeMode is called SCREEN_ON_DEBUG");
this.mWakeLock = ((PowerManager)paramContext.getSystemService("power")).newWakeLock(0x20000000 | paramInt, "TvOut-Observer");
Log.e("TvOut-Observer", "setWakeMode setting the mode SCREEN_ON_DEBUG mode : " + paramInt);
if (this.mWakeLock == null)
Log.e("TvOut-Observer", "setWakeMode mWakeLock is null SCREEN_ON_DEBUG");
this.mWakeLock.setReferenceCounted(false);
if (i == 0)
return;
this.mWakeLock.acquire();
}
void updateTVoutOnScreenOnOff()
{
if (mIsScreenOff == true)
{
Log.i("TvOut-Observer", "updateTVoutOnScreenOnOff tvstatus off mTvCableConnected : " + mTvCableConnected);
if ((this.mTvStatus == 1) && (mTvCableConnected == true) && (this.tvout.isEnabled()))
DisableTvOut();
}
while (true)
{
return;
if (this.mTvStatus != 1)
continue;
Log.i("TvOut-Observer", "updateTVoutOnScreenOnOff tvstatus on mTvCableConnected : " + mTvCableConnected);
if ((this.tvout.isEnabled()) || (mTvCableConnected != true))
continue;
Log.i("TvOut-Observer", "CableConnected enable tvout mTvCableConnected : " + mTvCableConnected);
if (!(mIsScreenOff))
EnableTvOut();
Log.i("TvOut-Observer", "updateTVoutOnScreenOnOff enable tvout mIsScreenOff : " + mIsScreenOff);
}
}
class SettingsObserver extends ContentObserver
{
SettingsObserver(Handler paramHandler)
{
super(paramHandler);
}
void observe()
{
Log.e("TvOut-Observer", "observe");
ContentResolver localContentResolver = TvOutService.this.mContext.getContentResolver();
localContentResolver.registerContentObserver(Settings.System.getUriFor("tv_system"), false, this);
localContentResolver.registerContentObserver(Settings.System.getUriFor("tv_out"), false, this);
update();
}
public void onChange(boolean paramBoolean)
{
Log.e("TvOut-Observer", "onChange");
update();
}
public void update()
{
Log.e("TvOut-Observer", "update");
ContentResolver localContentResolver = TvOutService.this.mContext.getContentResolver();
int i = 0;
int j = 0;
synchronized (TvOutService.this.mLock)
{
int k = Integer.parseInt(Settings.System.getString(TvOutService.this.mContext.getContentResolver(), "tv_system"));
if (TvOutService.this.mTvSystem != k)
{
TvOutService.access$102(TvOutService.this, k);
i = 1;
}
int l = Settings.System.getInt(localContentResolver, "tv_out", 0);
if (TvOutService.this.mTvStatus != l)
{
TvOutService.access$202(TvOutService.this, l);
j = 1;
}
if (i != 0)
TvOutService.this.updatetvsystem();
if (j != 0)
TvOutService.this.updatetvstatus();
return;
}
}
}
}
I will make this thread more interesting.
If you find a solution for TVOUT you can get DONATE from me
Another link
Galaxy Player 4.0, 5.0
HDMI Capable
http://forum.xda-developers.com/showthread.php?t=1406174&page=3
Looks its not that hard for real developer.
Any help?
I changed services.jar. Added few tv out files from galaxy s.
But still didnt find a solution for install TVOUT.apk
Tried recovery zip and other force to install apk programs. I dont know whats wrong about TVOUT.apk file.
Any develepor can check TVOUT.apk please?
Have you tried copying and pasting the TVOUT files to /system/app?
MrTaco505 said:
Have you tried copying and pasting the TVOUT files to /system/app?
Click to expand...
Click to collapse
Yes i did. same error. and cant see shortcut on menu or anywhere.

Hook contacts data

Hello,
I'm currently working with Xposed and i need to restrict access of contacts to applications installed on smartphone i allready tried some codes but not working anyone can help me?
try {
// final Class<?> cResolver = findClass("android.content.ContentResolver",lpparam.classLoader);
//android.content.ContentProviderClient
final Class<?> cResolver = findClass("android.content.ContentResolver",lpparam.classLoader);
XposedBridge.log("<--------ENTROUUUUUUUUUUUUUU COntentResolver----------->: " + lpparam.packageName);
XposedBridge.hookAllMethods(cResolver, "query", new XC_MethodHook() {
@SuppressLint("DefaultLocale")
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log(" Hooked method: " + param.method);
XposedBridge.log(" uri=" + param.args[0]);
String uri = ((Uri) param.args[0]).toString().toLowerCase();
String[] projection = (param.args[1] instanceof String[] ? (String[]) param.args[1] :null);
if (uri.startsWith("content://com.android.contacts/contacts/name_phone_or_email")) {
} else if (uri.startsWith("content://com.android.contacts/") && !uri.equals("content://com.android.contacts/")) {
XposedBridge.log("JOAAAAAAAAAAAAAAAOOOOOOOOOOOOOOOOOOOO 111111111111111111");
String[] components = uri.replace("content://com.android.", "").split("/");
String methodName = components[0] + "/" + components[1].split("\\?")[0];
if (methodName.equals("contacts/contacts") || methodName.equals("contacts/data") || methodName.equals("contacts/phone_lookup") || methodName.equals("contacts/raw_contacts")){
XposedBridge.log("JOAAAAAAAAAAAAAAAOOOOOOOOOOOOOOOOOOOO 22222222222222");
int urlid = -1;
if ((methodName.equals("contacts/contacts") || methodName.equals("contacts/phone_lookup")) && components.length > 2 && TextUtils.isDigitsOnly(components[2])){
urlid = Integer.parseInt(components[2]);
boolean added = false;
if (projection != null && urlid < 0) {
List<String> listProjection = new ArrayList<String>();
listProjection.addAll(Arrays.asList(projection));
String cid = getIdForUri(uri);
if (cid != null && !listProjection.contains(cid)) {
XposedBridge.log("ENTROUU nesta merda do CID");
added = true;
listProjection.add(cid);
}
param.args[1] = listProjection.toArray(new String[0]);
}
if (added)
XposedBridge.log("ENTROUU nesta merda do added");
param.setObjectExtra("column_added", added);
}
}
}
}
@SuppressLint("DefaultLocale")
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (param.args.length > 1 && param.args[0] instanceof Uri && param.getResult() != null) {
String uri = ((Uri) param.args[0]).toString().toLowerCase();
String[] projection = (param.args[1] instanceof String[] ? (String[]) param.args[1] : null);
String selection = (param.args[2] instanceof String ? (String) param.args[2] : null);
Cursor cursor = (Cursor) param.getResult();
if (uri.startsWith("content://com.android.contacts/")&& !uri.equals("content://com.android.contacts/")) {
// Contacts provider: allow selected contacts
String[] components = uri.replace("content://com.android.", "").split("/");
String methodName = components[0] + "/" + components[1].split("\\?")[0];
if (methodName.equals("contacts/contacts") || methodName.equals("contacts/data") || methodName.equals("contacts/phone_lookup") || methodName.equals("contacts/raw_contacts")) {
int urlid = -1;
if ((methodName.equals("contacts/contacts") || methodName.equals("contacts/phone_lookup")) && components.length > 2 && TextUtils.isDigitsOnly(components[2])){
urlid = Integer.parseInt(components[2]);
}
// Modify column names back
Object column_added = param.getObjectExtra("column_added");
boolean added = (column_added == null ? false : (Boolean) param.getObjectExtra("column_added"));
List<String> listColumn = new ArrayList<String>();
listColumn.addAll(Arrays.asList(cursor.getColumnNames()));
if (added) listColumn.remove(listColumn.size() - 1);
MatrixCursor result = new MatrixCursor(listColumn.toArray(new String[0]));
// Filter rows
String cid = getIdForUri(uri);
int iid = (cid == null ? -1 : cursor.getColumnIndex(cid));
if (iid >= 0 || urlid >= 0)
while (cursor.moveToNext()) {
copyColumns(cursor, result, listColumn.size());
}
else{
XposedBridge.log("ENTROUUUU NO ELSE");
XposedBridge.log("ID missing URI=" + uri + " added=" + added + "/" + cid
+ " columns=" + TextUtils.join(",", cursor.getColumnNames()) + " projection="
+ (projection == null ? "null" : TextUtils.join(",", projection)) + " selection="
+ selection);
}
result.respond(cursor.getExtras());
param.setResult(result);
cursor.close();
}else{
methodName = null;
if (uri.startsWith("content://com.android.contacts/profile"))
methodName = "contacts/profile";
else
methodName = "ContactsProvider2"; // fall-back
if (methodName != null){
// Return empty cursor
MatrixCursor result = new MatrixCursor(cursor.getColumnNames());
result.respond(cursor.getExtras());
XposedBridge.log(cursor.getExtras().toString());
param.setResult(result);
cursor.close();
}
}
}
}
}
});
} catch (Throwable t) {
throw t;
}

Categories

Resources